diff options
author | Sergey <37293587+SergeyDegtyar@users.noreply.github.com> | 2019-10-01 11:04:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-01 11:04:32 +0300 |
commit | e092c4ae6b60cf67efd16efbfbf739895ad501c0 (patch) | |
tree | 939a5b94d14a11df511aa95482458b33a1f6139f /passes/pmgen/pmgen.py | |
parent | 1070f2e90b9ba37856932189ef09a0f2316d9a21 (diff) | |
parent | d963e8c2c6207ad98d48dc528922ad58c030173f (diff) | |
download | yosys-e092c4ae6b60cf67efd16efbfbf739895ad501c0.tar.gz yosys-e092c4ae6b60cf67efd16efbfbf739895ad501c0.tar.bz2 yosys-e092c4ae6b60cf67efd16efbfbf739895ad501c0.zip |
Merge branch 'master' into SergeyDegtyar/efinix
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) |