diff options
author | Sergey <37293587+SergeyDegtyar@users.noreply.github.com> | 2019-10-01 10:57:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-01 10:57:09 +0300 |
commit | d99b1e32618f8aa92c01eb0ac5d08486f411cca0 (patch) | |
tree | 5671ffa605b5f6b31b86aacb2dbeaacd018302d7 /passes/pmgen/pmgen.py | |
parent | fc56459746fec7751735749e3328378e1089b914 (diff) | |
parent | d963e8c2c6207ad98d48dc528922ad58c030173f (diff) | |
download | yosys-d99b1e32618f8aa92c01eb0ac5d08486f411cca0.tar.gz yosys-d99b1e32618f8aa92c01eb0ac5d08486f411cca0.tar.bz2 yosys-d99b1e32618f8aa92c01eb0ac5d08486f411cca0.zip |
Merge branch 'master' into SergeyDegtyar/anlogic
Diffstat (limited to 'passes/pmgen/pmgen.py')
-rw-r--r-- | passes/pmgen/pmgen.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py index 573722d68..39a09991d 100644 --- a/passes/pmgen/pmgen.py +++ b/passes/pmgen/pmgen.py @@ -286,7 +286,7 @@ def process_pmgfile(f, filename): block["gencode"].append(rewrite_cpp(l.rstrip())) break - assert False + raise RuntimeError("'%s' statement not recognised on line %d" % (a[0], linenr)) if block["optional"]: assert not block["semioptional"] @@ -305,7 +305,8 @@ def process_pmgfile(f, filename): block["states"] = set() for s in line.split()[1:]: - assert s in state_types[current_pattern] + if s not in state_types[current_pattern]: + raise RuntimeError("'%s' not in state_types" % s) block["states"].add(s) codetype = "code" @@ -327,7 +328,7 @@ def process_pmgfile(f, filename): blocks.append(block) continue - assert False + raise RuntimeError("'%s' command not recognised" % cmd) for fn in pmgfiles: with open(fn, "r") as f: @@ -452,11 +453,19 @@ with open(outfile, "w") as f: print(" return sigmap(cell->getPort(portname));", file=f) print(" }", file=f) print("", file=f) + print(" SigSpec port(Cell *cell, IdString portname, const SigSpec& defval) {", file=f) + print(" return sigmap(cell->connections_.at(portname, defval));", file=f) + print(" }", file=f) + print("", file=f) print(" Const param(Cell *cell, IdString paramname) {", file=f) print(" return cell->getParam(paramname);", file=f) print(" }", file=f) print("", file=f) + print(" Const param(Cell *cell, IdString paramname, const Const& defval) {", file=f) + print(" return cell->parameters.at(paramname, defval);", file=f) + print(" }", file=f) + print("", file=f) print(" int nusers(const SigSpec &sig) {", file=f) print(" pool<Cell*> users;", file=f) |