Skip to content
Snippets Groups Projects
Commit 276d0c14 authored by Michael Schaffner's avatar Michael Schaffner Committed by Florian Zaruba
Browse files

Make interrupt sensitivity configurable in openpiton periphs, add sync stage

parent 5edf3580
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,7 @@ module riscv_peripherals #(
output [NumHarts-1:0] ipi_o, // software interrupt (a.k.a inter-process-interrupt)
// PLIC
input [NumSources-1:0] irq_sources_i,
input [NumSources-1:0] irq_le_i, // 0:level 1:edge
output [NumHarts-1:0][1:0] irq_o // level sensitive IR lines, mip & sip (async)
);
......@@ -744,6 +745,32 @@ module riscv_peripherals #(
assign reg_bus.error = plic_resp.error;
assign reg_bus.ready = plic_resp.ready;
// synchronization regs
logic [2:0][NumSources-1:0] irq_sources_d, irq_sources_q;
assign irq_sources_d = {irq_sources_q[$high(irq_sources_q)-1:0], irq_sources_i};
always_ff @(posedge clk_i or negedge rst_ni) begin : p_synch
if(!rst_ni) begin
irq_sources_q <= '0;
end else begin
irq_sources_q <= irq_sources_d;
end
end
// reshape pulse if needed
logic [NumSources-1:0] irq_sources_sync;
always_comb begin : p_wedge
for (int k=0; k<NumSources; k++) begin
if (irq_le_i[k]) begin
// edge
irq_sources_sync[k] = irq_sources_q[$high(irq_sources_q)-1][k] & ~irq_sources_q[$high(irq_sources_q)][k];
end else begin
// level
irq_sources_sync[k] = irq_sources_q[$high(irq_sources_q)][k];
end
end
end
plic_top #(
.N_SOURCE ( NumSources ),
.N_TARGET ( 2*NumHarts ),
......@@ -753,10 +780,12 @@ module riscv_peripherals #(
.rst_ni,
.req_i ( plic_req ),
.resp_o ( plic_resp ),
.le_i ( '0 ), // 0:level 1:edge
.irq_sources_i ,
.le_i ( irq_le_i ), // 0:level 1:edge
.irq_sources_i ( irq_sources_sync ),
.eip_targets_o ( irq_o )
);
endmodule // riscv_peripherals
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment