sort out JSON function missing and get mapping working
[pinmux.git] / src / pinmux_generator.py
index 3e92bf062353d043b1a5258dc759d54212c0ecaa..febc722132d1b19734993f85a373373e220b84c4 100644 (file)
@@ -21,6 +21,7 @@ import os.path
 import sys
 import json
 from spec import modules, specgen, dummytest
+from spec.ifaceprint import create_sv, temp_create_sv
 
 
 def printhelp():
@@ -89,20 +90,29 @@ if __name__ == '__main__':
         with open(fname, "w") as of:
             with open(pyname, "w") as pyf:
                 ps = module.pinspec()
-                pm, chip = module.pinparse(ps, pinspec)
-                litexmap = ps.pywrite(pyf, pm)
                 pinout, bankspec, pin_spec, fixedpins = ps.write(of)
                 #chip['litex.map'] = litexmap
-                chip = json.dumps(chip)
-                with open("%s/litex_pinpads.json" % pinspec, "w") as f:
-                    f.write(chip)
-
                 if testing:
                     dummytest(ps, output_dir, output_type)
                 else:
                     specgen(of, output_dir, pinout,
                             bankspec, ps.muxwidths, pin_spec, fixedpins,
                             ps.fastbus)
+                if hasattr(module, "pinparse"):
+                    pm, chip = module.pinparse(ps, pinspec)
+                    litexmap = ps.pywrite(pyf, pm)
+                    jchip = json.dumps(chip)
+                    with open("%s/litex_pinpads.json" % pinspec, "w") as f:
+                        f.write(jchip)
+                    # octavius: please keep line-lengths to below 80 chars
+                    # TODO: fix create_sv to allow different packages
+                    # (and die images)
+                    # Test with different package size, once working
+                    # 'create_sv' will be improved
+                    if pinspec == "ngi_router":
+                        temp_create_sv("%s/%s.svg" % (pinspec, pinspec), chip)
+                    else:
+                        create_sv("%s/%s.svg" % (pinspec, pinspec), chip)
     else:
         if output_type == 'bsv':
             from bsv.pinmux_generator import pinmuxgen as gentypes