From 5f400c61e7a635beee642e5082ed807df0b4b409 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 3 Aug 2018 08:56:44 +0100 Subject: [PATCH] split out memory map defines --- .../bsv_lib/slow_instance_defines_template.bsv | 4 ++++ src/bsv/bsv_lib/slow_tuple2_template.bsv | 6 ++---- src/bsv/pinmux_generator.py | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 src/bsv/bsv_lib/slow_instance_defines_template.bsv 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 index 0000000..5a86b4d --- /dev/null +++ b/src/bsv/bsv_lib/slow_instance_defines_template.bsv @@ -0,0 +1,4 @@ +/* ==== define the AXI Addresses ==== */ +{0} + + diff --git a/src/bsv/bsv_lib/slow_tuple2_template.bsv b/src/bsv/bsv_lib/slow_tuple2_template.bsv index dbde384..f38539e 100644 --- a/src/bsv/bsv_lib/slow_tuple2_template.bsv +++ b/src/bsv/bsv_lib/slow_tuple2_template.bsv @@ -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 diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index fbe1973..b351bf2 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -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): -- 2.30.2