split out memory map defines
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Aug 2018 07:56:44 +0000 (08:56 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Aug 2018 07:56:44 +0000 (08:56 +0100)
src/bsv/bsv_lib/slow_instance_defines_template.bsv [new file with mode: 0644]
src/bsv/bsv_lib/slow_tuple2_template.bsv
src/bsv/pinmux_generator.py

diff --git a/src/bsv/bsv_lib/slow_instance_defines_template.bsv b/src/bsv/bsv_lib/slow_instance_defines_template.bsv
new file mode 100644 (file)
index 0000000..5a86b4d
--- /dev/null
@@ -0,0 +1,4 @@
+/* ==== define the AXI Addresses ==== */
+{0}
+
+
index dbde384b89835149097106b6da691f35a2e4d5c4..f38539e2ed7d67ce38afdd3e538b1fad79035977 100644 (file)
@@ -2,9 +2,7 @@ package slow_memory_map;
        /*===== Project imports =====*/
        import defined_types::*;
        `include "instance_defines.bsv"
-    /* ==== define the AXI Addresses ==== */
-{0}
-
+       `include "slow_instance_defines.bsv"
     /* ==== define the AXI slave numbering ===== */
 {1}
 
@@ -27,7 +25,7 @@ package slow_memory_map;
                 return tuple2(True,fromInteger(valueOf(AxiExp1_slave_num)));
             else
         `endif
-{2}
+{0}
         return tuple2(False,?);
        endfunction
 
index fbe19736ec6e02ccd6081bcf08a801637ac380e0..b351bf287a6146999d21e65f00e53bf2b24630cf 100644 (file)
@@ -87,10 +87,16 @@ def pinmuxgen(pth=None, verify=True):
     idef = os.path.join(bp, 'instance_defines.bsv')
     slow = os.path.join(bp, 'slow_peripherals.bsv')
     slowt = os.path.join(cwd, 'slow_peripherals_template.bsv')
+
     slowmf = os.path.join(bp, 'slow_memory_map.bsv')
     slowmt = os.path.join(cwd, 'slow_tuple2_template.bsv')
+
+    slowid = os.path.join(bp, 'slow_instance_defines.bsv')
+    slowit = os.path.join(cwd, 'slow_instance_defines_template.bsv')
+
     fastmf = os.path.join(bp, 'fast_memory_map.bsv')
     fastmt = os.path.join(cwd, 'fast_tuple2_template.bsv')
+
     soc = os.path.join(bp, 'socgen.bsv')
     soct = os.path.join(cwd, 'soc_template.bsv')
 
@@ -98,11 +104,11 @@ def pinmuxgen(pth=None, verify=True):
     write_bvp(bvp, p, ifaces)
     write_bus(bus, p, ifaces)
     write_instances(idef, p, ifaces)
-    write_slow(slow, slowt, slowmf, slowmt, p, ifaces, iocells)
+    write_slow(slow, slowt, slowmf, slowmt, slowid, slowit, p, ifaces, iocells)
     write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells)
 
 
-def write_slow(slow, slowt, slowmf, slowmt, p, ifaces, iocells):
+def write_slow(slow, slowt, slowmf, slowmt, slowid, slowit, p, ifaces, iocells):
     """ write out the slow_peripherals.bsv file.
         joins all the peripherals together into one AXI Lite interface
     """
@@ -132,10 +138,15 @@ def write_slow(slow, slowt, slowmf, slowmt, p, ifaces, iocells):
                                     numsloirqs, ifacedef,
                                     inst2, clockcon))
 
+    with open(slowid, "w") as bsv_file:
+        with open(slowit) as f:
+            slowit = f.read()
+        bsv_file.write(slowit.format(regdef))
+
     with open(slowmf, "w") as bsv_file:
         with open(slowmt) as f:
             slowmt = f.read()
-        bsv_file.write(slowmt.format(regdef, slavedecl, fnaddrmap))
+        bsv_file.write(slowmt.format(fnaddrmap, slavedecl))
 
 
 def write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells):