From: Luke Kenneth Casson Leighton Date: Sun, 22 Jul 2018 04:46:04 +0000 (+0100) Subject: add MK_SLOW_IRQ define X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1a2ba5e8f5b4e70de7fe5f31aebd19182cc425f;p=pinmux.git add MK_SLOW_IRQ define --- diff --git a/src/bsv/bsv_lib/slow_peripherals_template.bsv b/src/bsv/bsv_lib/slow_peripherals_template.bsv index 1eb1b93..fc4230e 100644 --- a/src/bsv/bsv_lib/slow_peripherals_template.bsv +++ b/src/bsv/bsv_lib/slow_peripherals_template.bsv @@ -10,6 +10,8 @@ package slow_peripherals; `include "instance_defines.bsv" /* ==== define the AXI Addresses ==== */ {2} + /* ==== define the number of slow peripheral irqs ==== */ +{11} /*====== AXI4 Lite slave declarations =======*/ {3} diff --git a/src/bsv/peripheral_gen.py b/src/bsv/peripheral_gen.py index 622feb0..11d3b86 100644 --- a/src/bsv/peripheral_gen.py +++ b/src/bsv/peripheral_gen.py @@ -246,8 +246,6 @@ class quart(PBase): def mk_pincon(self, name, count): ret = [PBase.mk_pincon(self, name, count)] - size = len(self.peripheral.pinspecs) - ret.append(eint_pincon_template.format(size)) ret.append(" rule con_%s%d_io_in;" % (name, count)) ret.append(" {0}{1}.coe_rs232.modem_input(".format(name, count)) for idx, pname in enumerate(['rx', 'cts']): @@ -380,11 +378,11 @@ class eint(PBase): eint_pincon_template = '''\ - // TODO: offset i by the number of eints already used + // EINT is offset at end of other peripheral interrupts for(Integer i=0;i<{0};i=i+ 1)begin rule connect_int_to_plic(wr_interrupt[i]==1); - ff_gateway_queue[i].enq(1); - plic.ifc_external_irq[i].irq_frm_gateway(True); + ff_gateway_queue[i+`NUM_SLOW_IRQS].enq(1); + plic.ifc_external_irq[i+`NUM_SLOW_IRQS].irq_frm_gateway(True); endrule end ''' @@ -862,8 +860,12 @@ class PeripheralInterfaces(object): continue (txt, irq_offs) = res ret.append(txt) + self.num_slow_irqs = irq_offs return '\n'.join(list(filter(None, ret))) + def mk_sloirqsdef(self): + return " `define NUM_SLOW_IRQS {0}".format(self.num_slow_irqs) + class PFactory(object): def getcls(self, name): diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index fb07647..0e4b142 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -122,10 +122,12 @@ def write_slow(slow, template, p, ifaces, iocells): pincon = ifaces.mk_pincon() inst = ifaces.slowifinstance() mkplic = ifaces.mk_plic() + numsloirqs = ifaces.mk_sloirqsdef() with open(slow, "w") as bsv_file: bsv_file.write(template.format(imports, ifdecl, regdef, slavedecl, fnaddrmap, mkslow, mkcon, mkcellcon, - pincon, inst, mkplic)) + pincon, inst, mkplic, + numsloirqs)) def write_bus(bus, p, ifaces):