import AXI4_Types::*;
import Semi_FIFOF::*;
import AXI4Lite_AXI4_Bridge::*;
+ import slow_memory_map::*;
`include "instance_defines.bsv"
- /* ==== define the AXI Addresses ==== */
-{2}
/* ==== define the number of slow peripheral irqs ==== */
{11}
- /*====== AXI4 Lite slave declarations =======*/
-
-{3}
/*===========================*/
/*=== package imports ===*/
import Clocks::*;
endinterface
/*================================*/
- function SlowTuple2#(Bool, Bit#(TLog#(Num_Slow_Slaves)))
- fn_address_mapping (Bit#(`ADDR) addr);
- `ifdef CLINT
- if(addr>=`ClintBase && addr<=`ClintEnd)
- return tuple2(True,fromInteger(valueOf(CLINT_slave_num)));
- else
- `endif
- `ifdef PLIC
- if(addr>=`PLICBase && addr<=`PLICEnd)
- return tuple2(True,fromInteger(valueOf(Plic_slave_num)));
- else
- `endif
- `ifdef AXIEXP
- if(addr>=`AxiExp1Base && addr<=`AxiExp1End)
- return tuple2(True,fromInteger(valueOf(AxiExp1_slave_num)));
- else
- `endif
-{4}
- return tuple2(False,?);
- endfunction
-
(*synthesize*)
module mkslow_peripherals#(Clock fast_clock, Reset fast_reset,
Clock uart_clock, Reset uart_reset
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')
soc = os.path.join(bp, 'socgen.bsv')
soct = os.path.join(cwd, 'soc_template.bsv')
write_bvp(bvp, p, ifaces)
write_bus(bus, p, ifaces)
write_instances(idef, p, ifaces)
- write_slow(slow, slowt, p, ifaces, iocells)
+ write_slow(slow, slowt, slowmf, slowmt, p, ifaces, iocells)
write_soc(soc, soct, p, ifaces, iocells)
-def write_slow(slow, slowt, p, ifaces, iocells):
+def write_slow(slow, slowt, slowmf, slowmt, p, ifaces, iocells):
""" write out the slow_peripherals.bsv file.
joins all the peripherals together into one AXI Lite interface
"""
+ with open(slowmt) as bsv_file:
+ slowmt = bsv_file.read()
with open(slowt) as bsv_file:
slowt = bsv_file.read()
imports = ifaces.slowimport()
pincon, inst, mkplic,
numsloirqs, ifacedef,
inst2))
+ with open(slowmf, "w") as bsv_file:
+ bsv_file.write(slowmt.format(regdef, slavedecl, fnaddrmap))
def write_soc(soc, soct, p, ifaces, iocells):