|
@@ -471,27 +471,10 @@ module max80
|
|
|
// Edge-triggered IRQs. picorv32 latches interrupts
|
|
|
// but doesn't edge detect for a slow signal, so do it
|
|
|
// here instead and use level triggered signalling to the
|
|
|
- // CPU. This also allows using an explicit EOI instead of
|
|
|
- // using EOI-on-INTACK.
|
|
|
- //
|
|
|
-
|
|
|
- // sys_irq defined in iodevs.vh
|
|
|
- reg [31:0] sys_irq_q;
|
|
|
+ // CPU.
|
|
|
reg [31:0] cpu_irq;
|
|
|
-
|
|
|
- wire [31:0] cpu_eoi = {32{sysreg[4]}}
|
|
|
- & {{8{cpu_mem_wstrb[3]}}, {8{cpu_mem_wstrb[2]}},
|
|
|
- {8{cpu_mem_wstrb[1]}}, {8{cpu_mem_wstrb[0]}}}
|
|
|
- & cpu_mem_wdata;
|
|
|
-
|
|
|
- // Reading the register shows the current set of pending interrupts.
|
|
|
- assign sysreg_rdata[4] = cpu_irq;
|
|
|
-
|
|
|
- // CPU permanently hung?
|
|
|
- wire cpu_trap;
|
|
|
-
|
|
|
- // Request to halt the CPU on the next instruction boundary
|
|
|
- wire cpu_halt;
|
|
|
+ reg [31:0] sys_irq_q;
|
|
|
+ wire [31:0] cpu_eoi;
|
|
|
|
|
|
always @(negedge rst_n or posedge sys_clk)
|
|
|
if (~rst_n)
|
|
@@ -502,11 +485,16 @@ module max80
|
|
|
else
|
|
|
begin
|
|
|
sys_irq_q <= sys_irq & irq_edge_mask;
|
|
|
-
|
|
|
- cpu_irq <= (sys_irq & ~sys_irq_q) |
|
|
|
- (cpu_irq & irq_edge_mask & ~cpu_eoi);
|
|
|
+ cpu_irq <= (sys_irq & ~sys_irq_q) |
|
|
|
+ (cpu_irq & irq_edge_mask & ~cpu_eoi);
|
|
|
end
|
|
|
|
|
|
+ // CPU permanently hung?
|
|
|
+ wire cpu_trap;
|
|
|
+
|
|
|
+ // Request to halt the CPU on the next instruction boundary
|
|
|
+ wire cpu_halt;
|
|
|
+
|
|
|
picorv32 #(
|
|
|
.ENABLE_COUNTERS ( 1 ),
|
|
|
.ENABLE_COUNTERS64 ( 1 ),
|
|
@@ -553,7 +541,7 @@ module max80
|
|
|
.mem_la_wstrb ( cpu_la_wstrb ),
|
|
|
|
|
|
.irq ( cpu_irq ),
|
|
|
- .eoi ( )
|
|
|
+ .eoi ( cpu_eoi )
|
|
|
);
|
|
|
|
|
|
// Add a mandatory wait state to iodevs to reduce the size
|