diff --git a/gridinfo/gridinfo-txt2json.py b/gridinfo/gridinfo-txt2json.py
index 92957303..195486d2 100644
--- a/gridinfo/gridinfo-txt2json.py
+++ b/gridinfo/gridinfo-txt2json.py
@@ -46,11 +46,7 @@ with open("%s.txt" % sys.argv[1]) as f:
continue
if line[0] == "SLICEBIT":
- for i in range(50):
- 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)
+ db_site_bit[line[1]] = line[2]
continue
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))
database = dict()
+loc_to_tile = dict()
+
+database["device"] = sys.argv[2]
database["tiles"] = dict()
for tile in db_tiles:
@@ -68,15 +67,70 @@ for tile in db_tiles:
entry["sites"] = db_tile_sites[tile]
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()
for site in db_sites:
entry = dict()
entry["props"] = db_site_prop[site]
entry["tile"] = db_site_tile[site]
- if site in db_site_bit:
- entry["bit"] = db_site_bit[site]
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:
print(json.dumps(database, sort_keys=True, indent="\t"), file=f)
diff --git a/gridinfo/gridinfo.html b/gridinfo/gridinfo.html
index ed8b94a7..8a26c281 100644
--- a/gridinfo/gridinfo.html
+++ b/gridinfo/gridinfo.html
@@ -9,8 +9,10 @@
var device = "xc7a50tfgg484-1";
var database;
+var cfgcols = { };
var numrows = 1;
var numcols = 1;
+var marker;
var hide_props = [
"ALTERNATE_SITE_TYPES",
@@ -72,6 +74,8 @@ function getBaseURL() {
function tileInfo(tile) {
var props = database["tiles"][tile]["props"];
+ var row = +props["ROW"];
+ var col = +props["COLUMN"];
var html_text = "
Tile: " + tile + "
\n";
@@ -80,13 +84,22 @@ function tileInfo(tile) {
if (hide_props.indexOf(p) >= 0) continue;
html_text += "| " + p + " | " + props[p] + " |
\n";
}
-
html_text += "\n";
- for (var site_idx in database["tiles"][tile]["sites"])
- {
- var site = database["tiles"][tile]["sites"][site_idx];
+ if ("cfgcol" in database["tiles"][tile]) {
+ props = database["tiles"][tile]["cfgcol"]
+ html_text += "Configuration Column
\n";
+ html_text += "\n";
+ for (var p in props) {
+ if (hide_props.indexOf(p) >= 0) continue;
+ html_text += "| " + p + " | " + props[p] + " |
\n";
+ }
+ html_text += "
\n";
+ }
+
+ for (var site_idx in database["tiles"][tile]["sites"]) {
+ var site = database["tiles"][tile]["sites"][site_idx];
props = database["sites"][site]["props"];
html_text += "Site: " + tile + "
\n";
@@ -99,12 +112,15 @@ function tileInfo(tile) {
if (hide_props.indexOf(p) >= 0) continue;
html_text += "| " + p + " | " + props[p] + " |
\n";
}
-
html_text += "\n";
}
var infos = document.getElementById("infos");
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) {
@@ -115,7 +131,7 @@ function createSvgTile(tile) {
if (row >= numrows) numrows = row + 1;
if (col >= numcols) numcols = col + 1;
- color = "Gray";
+ var color = "Gray";
if (props["TYPE"].startsWith("CLBLM_")) color = "Khaki";
if (props["TYPE"].startsWith("CLBLL_")) color = "Gold";
@@ -146,17 +162,66 @@ function createSvgTile(tile) {
var gridview = document.getElementById("gridview");
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() {
for (var tile in database["tiles"])
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});
- document.getElementById("loading").style.visibility = "hidden";
+ document.getElementById("title").innerHTML = "Project X-Ray Grid Viewer -- " + database["device"];
document.getElementById("infos").style.visibility = "visible";
}
@@ -170,7 +235,7 @@ window.onload = function() {
//-->
-Loading device database. Please wait...
+Loading device database. Please wait...
|
|