From d5db6205c773f5afbc145524c7000b520e53ba57 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 22 Jul 2018 05:57:26 +0100 Subject: [PATCH] add qspi interface --- src/bsv/bsv_lib/slow_peripherals_template.bsv | 2 +- src/bsv/peripheral_gen.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bsv/bsv_lib/slow_peripherals_template.bsv b/src/bsv/bsv_lib/slow_peripherals_template.bsv index fc4230e..67217ec 100644 --- a/src/bsv/bsv_lib/slow_peripherals_template.bsv +++ b/src/bsv/bsv_lib/slow_peripherals_template.bsv @@ -139,7 +139,7 @@ package slow_peripherals; `ifdef verbose $display("Dequeing the FIFO -- PLIC Interrupt Serviced id: %d",id); `endif endrule - for(Integer i=0; i <`NUM_INTERRUPTS; i=i+1) begin + for(Integer i=0; i <`INTERRUPT_PINS; i=i+1) begin rule deq_gateway_queue; if(interrupt_id==fromInteger(i)) begin ff_gateway_queue[i].deq; diff --git a/src/bsv/peripheral_gen.py b/src/bsv/peripheral_gen.py index 11d3b86..aabfd8f 100644 --- a/src/bsv/peripheral_gen.py +++ b/src/bsv/peripheral_gen.py @@ -171,7 +171,7 @@ class PBase(object): name = "{0}{1}".format(self.name, self.mksuffix(self.name, inum)) plic_obj = self.plic_object(name, idx) print "plic_obj", name, idx, plic_obj - plic = mkplic_rule.format(self.name, plic_obj, irq_offs) + plic = mkplic_rule.format(name, plic_obj, irq_offs) res.append(plic) irq_offs += 1 # increment to next irq return ('\n'.join(res), irq_offs) @@ -298,9 +298,6 @@ class twi(PBase): return " interface I2C_out twi{0}_out;\n" + \ " method Bit#(1) twi{0}_isint;" - def num_irqs(self): - return 3 - def num_axi_regs32(self): return 8 @@ -327,6 +324,9 @@ class twi(PBase): return "pack({0})".format(txt) return txt + def num_irqs(self): + return 3 + def plic_object(self, pname, idx): return ["{0}.isint()", "{0}.timerint()", @@ -563,6 +563,12 @@ class qspi(PBase): ret.append(" endrule") return '\n'.join(ret) + def num_irqs(self): + return 6 + + def plic_object(self, pname, idx): + return "{0}.interrupts()[{1}]".format(pname, idx) + class pwm(PBase): -- 2.30.2