issuer_verilog.py update to use commandline args using argparse, fix
authorCole Poirier <colepoirier@gmail.com>
Wed, 14 Oct 2020 00:04:43 +0000 (17:04 -0700)
committerCole Poirier <colepoirier@gmail.com>
Wed, 14 Oct 2020 00:04:43 +0000 (17:04 -0700)
formatting

src/soc/simple/issuer_verilog.py

index 95eb748d1573c3d37c7f07c6003f222a263380b7..2b61ff471251159cca996e69128a26a6d6bb7d26 100644 (file)
@@ -1,7 +1,7 @@
 """simple core issuer verilog generator
 """
 
-import sys
+import argparse
 from nmigen.cli import verilog
 
 from soc.config.test.test_loadstore import TestMemPspec
@@ -9,14 +9,29 @@ from soc.simple.issuer import TestIssuer
 
 
 if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description="Simple core issuer " \
+                                     "verilog generator")
+    parser.add_argument("output_filename")
+    parser.add_argument("--disable-xics", action="store_true",
+                        help="Disable interrupts")
+    parser.add_argument("--use-pll", action="store_true", help="Enable pll")
+    parser.add_argument("--disable-gpio", action="store_true",
+                        help="Disable gpio pins")
+    parser.add_argument("--debug", default="jtag", help="Select debug " \
+                        "interface [jtag | dmi] [default jtag]")
+
+    args = parser.parse_args()
+
+    print(args)
+
     units = {'alu': 1,
              'cr': 1, 'branch': 1, 'trap': 1,
-            'logical': 1,
+             'logical': 1,
              'spr': 1,
              'div': 1,
              'mul': 1,
              'shiftrot': 1
-                }
+            }
     pspec = TestMemPspec(ldst_ifacetype='bare_wb',
                          imem_ifacetype='bare_wb',
                          addr_wid=48,
@@ -27,15 +42,19 @@ if __name__ == '__main__':
                          imem_reg_wid=64,
                          # set to 32 to make data wishbone bus 32-bit
                          #wb_data_wid=32,
-                         xics=True,
-                         #nocore=True, # to help test coriolis2 ioring
-                         use_pll=False, # bypass PLL
-                         gpio=True, # for test purposes
-                         debug="jtag", # set to jtag or dmi
+                         xics=False if args.disable_xics else True,
+                         # to help test coriolis2 ioring
+                         #nocore=True,
+                         # bypass PLL
+                         use_pll=True if args.use_pll else False,
+                         # for test purposes
+                         gpio=False if args.disable_gpio else True,
+                         # set to jtag or dmi
+                         debug=args.debug,
                          units=units)
 
     dut = TestIssuer(pspec)
 
     vl = verilog.convert(dut, ports=dut.external_ports(), name="test_issuer")
-    with open(sys.argv[1], "w") as f:
+    with open(args.output_filename, "w") as f:
         f.write(vl)