File: interconnect_html.py

package info (click to toggle)
prjtrellis 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 83,000 kB
  • sloc: cpp: 20,813; python: 16,246; sh: 375; makefile: 262; asm: 80; ansic: 58
file content (47 lines) | stat: -rw-r--r-- 2,238 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys
import json
import timing_dbs
import pip_classes


def make_interconn_timing_html(dbfile, family, grade, htmlfile):
    with open(dbfile, 'r') as f:
        db = json.load(f)
    with open(htmlfile, 'w') as html:
        print("<html>", file=html)
        print("<head>", file=html)
        print("<title>{} Speed Grade -{} Interconnect Timings</title>".format(family, grade), file=html)
        print("</head>", file=html)
        print("<body>", file=html)
        print("<h1>{} Speed Grade -{} Interconnect Timings</h1>".format(family, grade), file=html)
        print("<p>Values in red are fixed to zero by definition.</p>", file=html)
        print("<table width='800'>", file=html)
        print("<tbody>", file=html)
        print("<tr><th rowspan='2'>Pip Class</th>", file=html)
        print("<th colspan='3'>Base Delay (ps)</th><th colspan='3'>Fanout Adder (ps)</th></tr>", file=html)
        print("<tr><th>Min</th><th>Typ</th><th>Max</th><th>Min</th><th>Typ</th><th>Max</th></tr>", file=html)

        trstyle = ""
        for pipclass, pcdata in sorted(db.items()):
            trstyle = " bgcolor=\"#dddddd\"" if trstyle == "" else ""
            print("<tr {}>".format(trstyle), file=html)
            print("<td>{}</td>".format(pipclass), file=html)
            ds = "style='color: red;'" if pip_classes.force_zero_delay_pip(pipclass) else ""
            fs = "style='color: red;'" if pip_classes.force_zero_fanout_pip(pipclass) else ""
            print("<td {}>{:.0f}</td><td {}>{:.0f}</td><td {}>{:.0f}</td>".format(ds, pcdata["delay"][0], ds, pcdata["delay"][1], ds, pcdata["delay"][2]), file=html)
            print("<td {}>{:.0f}</td><td {}>{:.0f}</td><td {}>{:.0f}</td>".format(fs, pcdata["fanout"][0], fs, pcdata["fanout"][1], fs, pcdata["fanout"][2]), file=html)
            print("</tr>", file=html)
        print("</tbody>", file=html)
        print("</table>", file=html)
        print("</body>", file=html)
        print("</html>", file=html)


def main(argv):
    if len(argv) < 3:
        print("./interconnect_html.py grade out.html")
    make_cell_timing_html(timing_dbs.interconnect_db_path("ECP5", argv[1]), "ECP5", argv[1], argv[2])


if __name__ == "__main__":
    sys.exit(main(sys.argv))