mirror of https://github.com/openXC7/prjxray.git
Improve htmlgen, Simplify LUT init tags
Signed-off-by: Clifford Wolf <clifford@clifford.at> Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
parent
85f366bac9
commit
778905ff09
|
|
@ -82,7 +82,13 @@ for tilename, tiledata in grid["tiles"].items():
|
|||
assert 0
|
||||
|
||||
for name, value in luts[site].items():
|
||||
segments[segname]["tags"]["%s.%s.%s" % (re.sub("_[LR]$", "", tile_type), sitekey, name)] = value
|
||||
tag = "%s.%s.%s" % (re.sub("_[LR]$", "", tile_type), sitekey, name)
|
||||
tag = tag.replace("SLICE_X0.SLICEM", "SLICEM_X0")
|
||||
tag = tag.replace("SLICE_X1.SLICEM", "SLICEM_X1")
|
||||
tag = tag.replace("SLICE_X0.SLICEL", "SLICEL_X0")
|
||||
tag = tag.replace("SLICE_X1.SLICEL", "SLICEL_X1")
|
||||
tag = tag.replace("6LUT", "LUT")
|
||||
segments[segname]["tags"][tag] = value
|
||||
|
||||
base_frame = int(segdata["baseaddr"][0][2:], 16)
|
||||
for wordidx in range(segdata["baseaddr"][1], segdata["baseaddr"][1]+2):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ for segname, segdata in grid["segments"].items():
|
|||
if segtype not in segbits:
|
||||
segbits[segtype] = dict()
|
||||
segbits_r[segtype] = dict()
|
||||
segframes[segtype] = 36
|
||||
segframes[segtype] = segdata["frames"]
|
||||
|
||||
print("Loading %s segbits." % segtype)
|
||||
with open("../database/%s/seg_%s.segbits" % (os.getenv("XRAY_DATABASE"), segtype)) as f:
|
||||
|
|
@ -42,6 +42,9 @@ print("Writing %s/index.html." % os.getenv("XRAY_DATABASE"))
|
|||
os.makedirs(os.getenv("XRAY_DATABASE"), exist_ok=True)
|
||||
with open("%s/index.html" % os.getenv("XRAY_DATABASE"), "w") as f:
|
||||
print("<html><title>X-Ray %s Database</title><body>" % os.getenv("XRAY_DATABASE").upper(), file=f)
|
||||
print("<h3>X-Ray %s Database</h3>" % os.getenv("XRAY_DATABASE").upper(), file=f)
|
||||
|
||||
print("<p><b>Part: %s<br/>ROI: %s<br/>ROI Frames: %s</b></p>" % (os.getenv("XRAY_PART"), os.getenv("XRAY_ROI"), os.getenv("XRAY_ROI_FRAMES")), file=f)
|
||||
|
||||
for tilename, tiledata in grid["tiles"].items():
|
||||
grid_x = tiledata["grid_x"]
|
||||
|
|
@ -85,14 +88,14 @@ with open("%s/index.html" % os.getenv("XRAY_DATABASE"), "w") as f:
|
|||
if "segment" in tiledata:
|
||||
title.append("Baseaddr: %s %d" % tuple(segdata["baseaddr"]))
|
||||
|
||||
print("<td bgcolor=\"%s\" title=\"%s\">" % (bgcolor, "\n".join(title)), file=f)
|
||||
print("<td bgcolor=\"%s\" align=\"center\" title=\"%s\"><span style=\"font-size:10px\">" % (bgcolor, "\n".join(title)), file=f)
|
||||
if "segment" in tiledata:
|
||||
segtype = segdata["type"].lower()
|
||||
segtype = re.sub(r"_[lr]$", "", segtype)
|
||||
print("<center><small><a href=\"seg_%s.html\">%s</a></small></center></td>" %
|
||||
print("<a style=\"text-decoration: none; color: black\" href=\"seg_%s.html\">%s</a></span></td>" %
|
||||
(segtype, tilename.replace("_X", "<br/>X")), file=f)
|
||||
else:
|
||||
print("<center><small>%s</small></center></td>" % tilename.replace("_X", "<br/>X"), file=f)
|
||||
print("%s</span></td>" % tilename.replace("_X", "<br/>X"), file=f)
|
||||
|
||||
print("</tr>", file=f)
|
||||
|
||||
|
|
@ -107,17 +110,18 @@ for segtype in segbits.keys():
|
|||
print("Writing %s/seg_%s.html." % (os.getenv("XRAY_DATABASE"), segtype))
|
||||
with open("%s/seg_%s.html" % (os.getenv("XRAY_DATABASE"), segtype), "w") as f:
|
||||
print("<html><title>X-Ray %s Database: %s</title><body>" % (os.getenv("XRAY_DATABASE").upper(), segtype.upper()), file=f)
|
||||
print("<h3>X-Ray %s Database: %s</h3>" % (os.getenv("XRAY_DATABASE").upper(), segtype.upper()), file=f)
|
||||
print("<table border>", file =f)
|
||||
|
||||
print("<tr>", file =f)
|
||||
print("<th width=\"50\"></th>", file =f)
|
||||
print("<th width=\"30\"></th>", file =f)
|
||||
for frameidx in range(segframes[segtype]):
|
||||
print("<th width=\"50\">%d</th>" % frameidx, file =f)
|
||||
print("<th width=\"30\"><span style=\"font-size:10px\">%d</span></th>" % frameidx, file =f)
|
||||
print("</tr>", file =f)
|
||||
|
||||
for bitidx in range(63, -1, -1):
|
||||
print("<tr>", file =f)
|
||||
print("<th align=\"right\">%d</th>" % bitidx, file =f)
|
||||
print("<th align=\"right\"><span style=\"font-size:10px\">%d</span></th>" % bitidx, file =f)
|
||||
for frameidx in range(segframes[segtype]):
|
||||
bit_pos = "%02x_%02x_%02x" % (frameidx, bitidx // 32, bitidx % 32)
|
||||
bit_name = segbits_r[segtype][bit_pos] if bit_pos in segbits_r[segtype] else None
|
||||
|
|
@ -132,12 +136,30 @@ for segtype in segbits.keys():
|
|||
|
||||
if "LUT.INIT" in bit_name:
|
||||
bgcolor = "#ffffaa"
|
||||
m = re.search(r"(.)6LUT.INIT\[(..)\]", bit_name)
|
||||
m = re.search(r"(.)LUT.INIT\[(..)\]", bit_name)
|
||||
label = m.group(1) + m.group(2)
|
||||
|
||||
print("<td bgcolor=\"%s\" title=\"%s\">%s</td>" % (bgcolor, "\n".join(title), label), file=f)
|
||||
print("<td bgcolor=\"%s\" title=\"%s\"><span style=\"font-size:10px\">%s</span></td>" % (bgcolor, "\n".join(title), label), file=f)
|
||||
print("</tr>", file =f)
|
||||
|
||||
|
||||
prefix = ""
|
||||
|
||||
for bit_name, bit_pos in sorted(segbits[segtype].items()):
|
||||
bit_prefix = ".".join(bit_name.split(".")[0:-1])
|
||||
|
||||
if prefix != bit_prefix:
|
||||
trstyle = ""
|
||||
prefix = bit_prefix
|
||||
print("</table>", file =f)
|
||||
print("<p/>", file =f)
|
||||
print("<h4>%s</h4>" % prefix, file =f)
|
||||
print("<table cellspacing=0>", file =f)
|
||||
print("<tr><th width=\"500\" align=\"left\">Bit Name</th><th>Position</th></tr>", file=f)
|
||||
|
||||
trstyle = " bgcolor=\"#dddddd\"" if trstyle == "" else ""
|
||||
print("<tr%s><td>%s</td><td>%s</td></tr>" % (trstyle, bit_name, bit_pos), file=f)
|
||||
|
||||
print("</table>", file =f)
|
||||
print("</body></html>", file=f)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue