From: Luke Kenneth Casson Leighton Date: Fri, 3 Aug 2018 08:00:27 +0000 (+0100) Subject: write out fast instance defines separately X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eec1d18dac53e3f0f4188e96272abb011d6dbf92;p=pinmux.git write out fast instance defines separately --- 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 index 0000000..6ad613b --- /dev/null +++ b/src/bsv/bsv_lib/fast_instance_defines_template.bsv @@ -0,0 +1,2 @@ +/*====== Fast peripherals Memory Map ======= */ +{0} diff --git a/src/bsv/bsv_lib/fast_tuple2_template.bsv b/src/bsv/bsv_lib/fast_tuple2_template.bsv index b7bc9eb..baa225e 100644 --- a/src/bsv/bsv_lib/fast_tuple2_template.bsv +++ b/src/bsv/bsv_lib/fast_tuple2_template.bsv @@ -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 diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index b351bf2..5ccaa34 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -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):