aboutsummaryrefslogtreecommitdiffstats
path: root/passes/pmgen/pmgen.py
diff options
context:
space:
mode:
Diffstat (limited to 'passes/pmgen/pmgen.py')
-rw-r--r--passes/pmgen/pmgen.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py
index 5860c634a..95a0a5f5d 100644
--- a/passes/pmgen/pmgen.py
+++ b/passes/pmgen/pmgen.py
@@ -11,8 +11,9 @@ prefix = None
pmgfiles = list()
outfile = None
debug = False
+genhdr = False
-opts, args = getopt.getopt(sys.argv[1:], "p:o:d")
+opts, args = getopt.getopt(sys.argv[1:], "p:o:dg")
for o, a in opts:
if o == "-p":
@@ -21,6 +22,8 @@ for o, a in opts:
outfile = a
elif o == "-d":
debug = True
+ elif o == "-g":
+ genhdr = True
if outfile is None:
outfile = "/dev/stdout"
@@ -249,12 +252,12 @@ with open(outfile, "w") as f:
print("// Generated by pmgen.py from {}".format(fn), file=f)
print("", file=f)
- print("#include \"kernel/yosys.h\"", file=f)
- print("#include \"kernel/sigtools.h\"", file=f)
- print("", file=f)
-
- print("YOSYS_NAMESPACE_BEGIN", file=f)
- print("", file=f)
+ if genhdr:
+ print("#include \"kernel/yosys.h\"", file=f)
+ print("#include \"kernel/sigtools.h\"", file=f)
+ print("", file=f)
+ print("YOSYS_NAMESPACE_BEGIN", file=f)
+ print("", file=f)
print("struct {}_pm {{".format(prefix), file=f)
print(" Module *module;", file=f)
@@ -564,5 +567,7 @@ with open(outfile, "w") as f:
print("", file=f)
print("};", file=f)
- print("", file=f)
- print("YOSYS_NAMESPACE_END", file=f)
+
+ if genhdr:
+ print("", file=f)
+ print("YOSYS_NAMESPACE_END", file=f)