write out fast instance defines separately
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Aug 2018 08:00:27 +0000 (09:00 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Aug 2018 08:00:27 +0000 (09:00 +0100)
src/bsv/bsv_lib/fast_instance_defines_template.bsv [new file with mode: 0644]
src/bsv/bsv_lib/fast_tuple2_template.bsv
src/bsv/pinmux_generator.py

diff --git a/src/bsv/bsv_lib/fast_instance_defines_template.bsv b/src/bsv/bsv_lib/fast_instance_defines_template.bsv
new file mode 100644 (file)
index 0000000..6ad613b
--- /dev/null
@@ -0,0 +1,2 @@
+/*====== Fast peripherals Memory Map ======= */
+{0}
index b7bc9eb0ab75abb2e2a2842c9ec525b9a42243ae..baa225e91f027fb0a412ec4475ab2bddf3b6a959 100644 (file)
@@ -32,15 +32,13 @@ package fast_memory_map;
     /*====== Package imports === */
     `include "instance_defines.bsv"
     `include "core_parameters.bsv"
-
-    /*====== Fast peripherals Memory Map ======= */
-{0}
+    `include "fast_instance_defines.bsv"
 
     /*====== AXI4 slave declarations =======*/
-{1}
+{0}
 
     /*====== AXI4 Master declarations =======*/
-{2}
+{1}
 
 
 function Tuple2 #(Bool, Bit#(TLog#(Num_Fast_Slaves)))
@@ -65,7 +63,7 @@ function Tuple2 #(Bool, Bit#(TLog#(Num_Fast_Slaves)))
             return tuple2(True,fromInteger(valueOf(TCM_slave_num)));
     `endif
         else 
-{3}
+{2}
             return tuple2(False,?);
 endfunction
 
index b351bf287a6146999d21e65f00e53bf2b24630cf..5ccaa34cbdc9ec9715e94273a36daa3d1a1adf9d 100644 (file)
@@ -97,6 +97,9 @@ def pinmuxgen(pth=None, verify=True):
     fastmf = os.path.join(bp, 'fast_memory_map.bsv')
     fastmt = os.path.join(cwd, 'fast_tuple2_template.bsv')
 
+    fastid = os.path.join(bp, 'fast_instance_defines.bsv')
+    fastit = os.path.join(cwd, 'fast_instance_defines_template.bsv')
+
     soc = os.path.join(bp, 'socgen.bsv')
     soct = os.path.join(cwd, 'soc_template.bsv')
 
@@ -105,7 +108,7 @@ def pinmuxgen(pth=None, verify=True):
     write_bus(bus, p, ifaces)
     write_instances(idef, p, ifaces)
     write_slow(slow, slowt, slowmf, slowmt, slowid, slowit, p, ifaces, iocells)
-    write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells)
+    write_soc(soc, soct, fastmf, fastmt, fastid, fastit, p, ifaces, iocells)
 
 
 def write_slow(slow, slowt, slowmf, slowmt, slowid, slowit, p, ifaces, iocells):
@@ -149,7 +152,7 @@ def write_slow(slow, slowt, slowmf, slowmt, slowid, slowit, p, ifaces, iocells):
         bsv_file.write(slowmt.format(fnaddrmap, slavedecl))
 
 
-def write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells):
+def write_soc(soc, soct, fastmf, fastmt, fastid, fastit, p, ifaces, iocells):
     """ write out the soc.bsv file.
         joins all the peripherals together as AXI Masters
     """
@@ -184,10 +187,15 @@ def write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells):
                                    clockcon, mkmstcon,
                                    ))
 
+    with open(fastid, "w") as bsv_file:
+        with open(fastit) as f:
+            fastit = f.read()
+        bsv_file.write(fastit.format(regdef))
+
     with open(fastmf, "w") as bsv_file:
         with open(fastmt) as f:
             fastmt = f.read()
-        bsv_file.write(fastmt.format(regdef, slavedecl, mastdecl, fnaddrmap))
+        bsv_file.write(fastmt.format(slavedecl, mastdecl, fnaddrmap))
 
 
 def write_bus(bus, p, ifaces):