Add an overload for port/param with default value
authorEddie Hung <eddie@fpgeh.com>
Fri, 20 Sep 2019 16:59:42 +0000 (09:59 -0700)
committerEddie Hung <eddie@fpgeh.com>
Fri, 20 Sep 2019 16:59:42 +0000 (09:59 -0700)
passes/pmgen/pmgen.py

index 335d26f169b7ac820061d04ac3a6e3cf65de254e..d5e667911d9abdc37dc877848437558abe90896c 100644 (file)
@@ -453,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)