mirror of https://github.com/openXC7/prjxray.git
Add cfgcol information to gridinfo database
Signed-off-by: Clifford Wolf <clifford@clifford.at> Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
parent
65c84d43dd
commit
91e552faf8
|
|
@ -46,11 +46,7 @@ with open("%s.txt" % sys.argv[1]) as f:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line[0] == "SLICEBIT":
|
if line[0] == "SLICEBIT":
|
||||||
for i in range(50):
|
db_site_bit[line[1]] = line[2]
|
||||||
assert line[1] not in db_site_bit
|
|
||||||
db_site_bit[line[1]] = line[2] + ("" if i == 0 else " ?")
|
|
||||||
m = re.match("(.*)Y([0-9]+)", line[1])
|
|
||||||
line[1] = "%sY%d" % (m.group(1), int(m.group(2))+1)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
assert False
|
assert False
|
||||||
|
|
@ -60,6 +56,9 @@ print("Number of sites: %d" % len(db_sites))
|
||||||
print("Number of sites with bit: %d" % len(db_site_bit))
|
print("Number of sites with bit: %d" % len(db_site_bit))
|
||||||
|
|
||||||
database = dict()
|
database = dict()
|
||||||
|
loc_to_tile = dict()
|
||||||
|
|
||||||
|
database["device"] = sys.argv[2]
|
||||||
|
|
||||||
database["tiles"] = dict()
|
database["tiles"] = dict()
|
||||||
for tile in db_tiles:
|
for tile in db_tiles:
|
||||||
|
|
@ -68,15 +67,70 @@ for tile in db_tiles:
|
||||||
entry["sites"] = db_tile_sites[tile]
|
entry["sites"] = db_tile_sites[tile]
|
||||||
database["tiles"][tile] = entry
|
database["tiles"][tile] = entry
|
||||||
|
|
||||||
|
col = int(db_tile_prop[tile]["COLUMN"])
|
||||||
|
row = int(db_tile_prop[tile]["ROW"])
|
||||||
|
loc_to_tile[(col, row)] = tile
|
||||||
|
|
||||||
database["sites"] = dict()
|
database["sites"] = dict()
|
||||||
for site in db_sites:
|
for site in db_sites:
|
||||||
entry = dict()
|
entry = dict()
|
||||||
entry["props"] = db_site_prop[site]
|
entry["props"] = db_site_prop[site]
|
||||||
entry["tile"] = db_site_tile[site]
|
entry["tile"] = db_site_tile[site]
|
||||||
if site in db_site_bit:
|
|
||||||
entry["bit"] = db_site_bit[site]
|
|
||||||
database["sites"][site] = entry
|
database["sites"][site] = entry
|
||||||
|
|
||||||
|
for site, bit in db_site_bit.items():
|
||||||
|
bit = bit.split("_")
|
||||||
|
bit_type = int(bit[4][1:])
|
||||||
|
bit_half = int(bit[5][1:])
|
||||||
|
bit_row = int(bit[6][1:])
|
||||||
|
bit_col = int(bit[7][1:])
|
||||||
|
bit_word = int(bit[9][1:])
|
||||||
|
assert len(bit) == 11
|
||||||
|
|
||||||
|
for i in range(50):
|
||||||
|
m = re.match("(.*)Y([0-9]+)", site)
|
||||||
|
this_site = "%sY%d" % (m.group(1), int(m.group(2))+i)
|
||||||
|
|
||||||
|
tile = db_site_tile[this_site]
|
||||||
|
|
||||||
|
word = bit_word + 2*i
|
||||||
|
if word >= 50: word += 1
|
||||||
|
|
||||||
|
entry = dict()
|
||||||
|
entry["BASE_FRAMEID"] = "0x%08x" % ((bit_type << 23) | (bit_half << 22) | (bit_row << 17) | (bit_col << 7))
|
||||||
|
entry["FRAME_TYPE"] = bit_type
|
||||||
|
entry["FRAME_HALF"] = bit_half
|
||||||
|
entry["FRAME_ROW"] = bit_row
|
||||||
|
entry["FRAME_COLUMN"] = bit_col
|
||||||
|
entry["WORDS"] = [word, word+1]
|
||||||
|
|
||||||
|
database["tiles"][tile]["cfgcol"] = entry
|
||||||
|
|
||||||
|
if database["tiles"][tile]["props"]["TILE_TYPE"] in ("CLBLL_L", "CLBLM_L"):
|
||||||
|
col = int(db_tile_prop[tile]["COLUMN"])
|
||||||
|
row = int(db_tile_prop[tile]["ROW"])
|
||||||
|
right_tile = loc_to_tile[(col+1, row)]
|
||||||
|
|
||||||
|
database["tiles"][right_tile]["cfgcol"] = entry
|
||||||
|
|
||||||
|
if database["tiles"][tile]["props"]["TILE_TYPE"] in ("CLBLL_R", "CLBLM_R"):
|
||||||
|
col = int(db_tile_prop[tile]["COLUMN"])
|
||||||
|
row = int(db_tile_prop[tile]["ROW"])
|
||||||
|
left_tile = loc_to_tile[(col-1, row)]
|
||||||
|
|
||||||
|
database["tiles"][left_tile]["cfgcol"] = entry
|
||||||
|
|
||||||
|
tile_cfgcol_count = 0
|
||||||
|
cfgcols = set()
|
||||||
|
|
||||||
|
for tile in db_tiles:
|
||||||
|
if "cfgcol" in database["tiles"][tile]:
|
||||||
|
cfgcols.add(database["tiles"][tile]["cfgcol"]["BASE_FRAMEID"])
|
||||||
|
tile_cfgcol_count += 1
|
||||||
|
|
||||||
|
print("Number of assigned columns: %d" % len(cfgcols))
|
||||||
|
print("Number of tiles with assigned column: %d" % tile_cfgcol_count)
|
||||||
|
|
||||||
with open("%s.json" % sys.argv[1], "w") as f:
|
with open("%s.json" % sys.argv[1], "w") as f:
|
||||||
print(json.dumps(database, sort_keys=True, indent="\t"), file=f)
|
print(json.dumps(database, sort_keys=True, indent="\t"), file=f)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@
|
||||||
var device = "xc7a50tfgg484-1";
|
var device = "xc7a50tfgg484-1";
|
||||||
|
|
||||||
var database;
|
var database;
|
||||||
|
var cfgcols = { };
|
||||||
var numrows = 1;
|
var numrows = 1;
|
||||||
var numcols = 1;
|
var numcols = 1;
|
||||||
|
var marker;
|
||||||
|
|
||||||
var hide_props = [
|
var hide_props = [
|
||||||
"ALTERNATE_SITE_TYPES",
|
"ALTERNATE_SITE_TYPES",
|
||||||
|
|
@ -72,6 +74,8 @@ function getBaseURL() {
|
||||||
|
|
||||||
function tileInfo(tile) {
|
function tileInfo(tile) {
|
||||||
var props = database["tiles"][tile]["props"];
|
var props = database["tiles"][tile]["props"];
|
||||||
|
var row = +props["ROW"];
|
||||||
|
var col = +props["COLUMN"];
|
||||||
|
|
||||||
var html_text = "<h3>Tile: " + tile + "</h3>\n";
|
var html_text = "<h3>Tile: " + tile + "</h3>\n";
|
||||||
|
|
||||||
|
|
@ -80,13 +84,22 @@ function tileInfo(tile) {
|
||||||
if (hide_props.indexOf(p) >= 0) continue;
|
if (hide_props.indexOf(p) >= 0) continue;
|
||||||
html_text += "<tr><td>" + p + "</td><td>" + props[p] + "</td></tr>\n";
|
html_text += "<tr><td>" + p + "</td><td>" + props[p] + "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
html_text += "</table>\n";
|
html_text += "</table>\n";
|
||||||
|
|
||||||
for (var site_idx in database["tiles"][tile]["sites"])
|
if ("cfgcol" in database["tiles"][tile]) {
|
||||||
{
|
props = database["tiles"][tile]["cfgcol"]
|
||||||
var site = database["tiles"][tile]["sites"][site_idx];
|
|
||||||
|
|
||||||
|
html_text += "<h3>Configuration Column</h3>\n";
|
||||||
|
html_text += "<table>\n";
|
||||||
|
for (var p in props) {
|
||||||
|
if (hide_props.indexOf(p) >= 0) continue;
|
||||||
|
html_text += "<tr><td>" + p + "</td><td>" + props[p] + "</td></tr>\n";
|
||||||
|
}
|
||||||
|
html_text += "</table>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var site_idx in database["tiles"][tile]["sites"]) {
|
||||||
|
var site = database["tiles"][tile]["sites"][site_idx];
|
||||||
props = database["sites"][site]["props"];
|
props = database["sites"][site]["props"];
|
||||||
|
|
||||||
html_text += "<h3>Site: " + tile + "</h3>\n";
|
html_text += "<h3>Site: " + tile + "</h3>\n";
|
||||||
|
|
@ -99,12 +112,15 @@ function tileInfo(tile) {
|
||||||
if (hide_props.indexOf(p) >= 0) continue;
|
if (hide_props.indexOf(p) >= 0) continue;
|
||||||
html_text += "<tr><td>" + p + "</td><td>" + props[p] + "</td></tr>\n";
|
html_text += "<tr><td>" + p + "</td><td>" + props[p] + "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
html_text += "</table>\n";
|
html_text += "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
var infos = document.getElementById("infos");
|
var infos = document.getElementById("infos");
|
||||||
infos.innerHTML = html_text;
|
infos.innerHTML = html_text;
|
||||||
|
|
||||||
|
marker.setAttribute("cx", 5 + 10 * col);
|
||||||
|
marker.setAttribute("cy", 5 + 10 * row);
|
||||||
|
marker.setAttribute("style", "fill: none; stroke: Black;");
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSvgTile(tile) {
|
function createSvgTile(tile) {
|
||||||
|
|
@ -115,7 +131,7 @@ function createSvgTile(tile) {
|
||||||
if (row >= numrows) numrows = row + 1;
|
if (row >= numrows) numrows = row + 1;
|
||||||
if (col >= numcols) numcols = col + 1;
|
if (col >= numcols) numcols = col + 1;
|
||||||
|
|
||||||
color = "Gray";
|
var color = "Gray";
|
||||||
|
|
||||||
if (props["TYPE"].startsWith("CLBLM_")) color = "Khaki";
|
if (props["TYPE"].startsWith("CLBLM_")) color = "Khaki";
|
||||||
if (props["TYPE"].startsWith("CLBLL_")) color = "Gold";
|
if (props["TYPE"].startsWith("CLBLL_")) color = "Gold";
|
||||||
|
|
@ -146,17 +162,66 @@ function createSvgTile(tile) {
|
||||||
|
|
||||||
var gridview = document.getElementById("gridview");
|
var gridview = document.getElementById("gridview");
|
||||||
gridview.appendChild(rect);
|
gridview.appendChild(rect);
|
||||||
|
|
||||||
|
if ("cfgcol" in database["tiles"][tile]) {
|
||||||
|
var frameid = database["tiles"][tile]["cfgcol"]["BASE_FRAMEID"];
|
||||||
|
if (!(frameid in cfgcols)) {
|
||||||
|
cfgcols[frameid] = {
|
||||||
|
"first_row": row,
|
||||||
|
"last_row": row,
|
||||||
|
"first_col": col,
|
||||||
|
"last_col": col
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row < cfgcols[frameid].first_row) cfgcols[frameid].first_row = row;
|
||||||
|
if (row > cfgcols[frameid].last_row) cfgcols[frameid].last_row = row;
|
||||||
|
|
||||||
|
if (col < cfgcols[frameid].first_col) cfgcols[frameid].first_col = col;
|
||||||
|
if (col > cfgcols[frameid].last_col) cfgcols[frameid].last_col = col;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
for (var tile in database["tiles"])
|
for (var tile in database["tiles"])
|
||||||
createSvgTile(tile);
|
createSvgTile(tile);
|
||||||
|
|
||||||
document.getElementById("gridview").setAttribute("viewBox", "0 0 " + (10 * numcols) + " " + (10 * numrows));
|
var gridview = document.getElementById("gridview");
|
||||||
|
|
||||||
|
rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||||
|
rect.setAttribute("id", "tile_" + tile);
|
||||||
|
rect.setAttribute("x", 0);
|
||||||
|
rect.setAttribute("y", 0);
|
||||||
|
rect.setAttribute("width", 10 * numcols);
|
||||||
|
rect.setAttribute("height", 10 * numrows);
|
||||||
|
rect.setAttribute("style", "fill: none; stroke: Black;");
|
||||||
|
gridview.appendChild(rect);
|
||||||
|
|
||||||
|
marker = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
||||||
|
marker.setAttribute("cx", 0);
|
||||||
|
marker.setAttribute("cy", 0);
|
||||||
|
marker.setAttribute("r", 5);
|
||||||
|
marker.setAttribute("style", "fill: none; stroke: none;");
|
||||||
|
gridview.appendChild(marker);
|
||||||
|
|
||||||
|
for (var frameid in cfgcols) {
|
||||||
|
var cfgcol = cfgcols[frameid];
|
||||||
|
|
||||||
|
rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||||
|
rect.setAttribute("id", "tile_" + tile);
|
||||||
|
rect.setAttribute("x", 10 * cfgcol.first_col);
|
||||||
|
rect.setAttribute("y", 10 * cfgcol.first_row);
|
||||||
|
rect.setAttribute("width", 10 + 10 * (cfgcol.last_col - cfgcol.first_col));
|
||||||
|
rect.setAttribute("height", 10 + 10 * (cfgcol.last_row - cfgcol.first_row));
|
||||||
|
rect.setAttribute("style", "fill: none; stroke: Black; stroke-width: 0.5px;");
|
||||||
|
gridview.appendChild(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
gridview.setAttribute("viewBox", "0 0 " + (10 * numcols) + " " + (10 * numrows));
|
||||||
|
|
||||||
svgPanZoom('#gridview', {zoomEnabled: true});
|
svgPanZoom('#gridview', {zoomEnabled: true});
|
||||||
|
|
||||||
document.getElementById("loading").style.visibility = "hidden";
|
document.getElementById("title").innerHTML = "Project X-Ray Grid Viewer -- " + database["device"];
|
||||||
document.getElementById("infos").style.visibility = "visible";
|
document.getElementById("infos").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -170,7 +235,7 @@ window.onload = function() {
|
||||||
//--></script>
|
//--></script>
|
||||||
</head><body bgcolor="#aaaaaa">
|
</head><body bgcolor="#aaaaaa">
|
||||||
|
|
||||||
<div id="loading">Loading device database. Please wait...</div>
|
<div><b><span id="title">Loading device database. Please wait...</span></b></div>
|
||||||
|
|
||||||
<table><tr><td valign="top">
|
<table><tr><td valign="top">
|
||||||
<div style="background-color: white; width: 600px; height:800px"><svg xmlns="http://www.w3.org/2000/svg"
|
<div style="background-color: white; width: 600px; height:800px"><svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
|
|
||||||
|
|
@ -69,5 +69,5 @@ vivado -nojournal -log design.log -mode batch -source design.tcl
|
||||||
done
|
done
|
||||||
} > grid-${XRAY_PART}-db.txt
|
} > grid-${XRAY_PART}-db.txt
|
||||||
|
|
||||||
python3 gridinfo-txt2json.py grid-${XRAY_PART}-db
|
python3 gridinfo-txt2json.py grid-${XRAY_PART}-db ${XRAY_PART}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue