diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2020-12-09 11:06:22 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2020-12-09 11:06:22 +0100 |
commit | 82dcf78cd9e90106653bcdd82a8a9cbf391f0afd (patch) | |
tree | b6bf41305d97d9d98f83f243c547c77b79074ff4 | |
parent | c46452221ef1164fc1681e2f21d06e104e376a04 (diff) | |
download | yosys-82dcf78cd9e90106653bcdd82a8a9cbf391f0afd.tar.gz yosys-82dcf78cd9e90106653bcdd82a8a9cbf391f0afd.tar.bz2 yosys-82dcf78cd9e90106653bcdd82a8a9cbf391f0afd.zip |
Return nice error in pmgen generated code, fixes #2482
-rw-r--r-- | passes/pmgen/pmgen.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py index 592a26fa6..db827ee82 100644 --- a/passes/pmgen/pmgen.py +++ b/passes/pmgen/pmgen.py @@ -451,7 +451,9 @@ with open(outfile, "w") as f: current_pattern = None print(" SigSpec port(Cell *cell, IdString portname) {", file=f) - print(" return sigmap(cell->getPort(portname));", file=f) + print(" try {", file=f) + print(" return sigmap(cell->getPort(portname));", file=f) + print(" } catch(std::out_of_range) { log_error(\"Accessing non existing port %s\\n\",portname.c_str()); }", file=f) print(" }", file=f) print("", file=f) print(" SigSpec port(Cell *cell, IdString portname, const SigSpec& defval) {", file=f) @@ -460,7 +462,9 @@ with open(outfile, "w") as f: print("", file=f) print(" Const param(Cell *cell, IdString paramname) {", file=f) - print(" return cell->getParam(paramname);", file=f) + print(" try {", file=f) + print(" return cell->getParam(paramname);", file=f) + print(" } catch(std::out_of_range) { log_error(\"Accessing non existing parameter %s\\n\",paramname.c_str()); }", file=f) print(" }", file=f) print("", file=f) print(" Const param(Cell *cell, IdString paramname, const Const& defval) {", file=f) |