summaryrefslogtreecommitdiff
path: root/sv/soc
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-08-03 01:15:06 -0400
committerIan Moffett <ian@osmora.org>2024-08-03 01:35:30 -0400
commitade344b9314ddd1d3dd4a7189822d80b0a163fb3 (patch)
tree6fda2b30530a5f701f624b69740353392e36d01d /sv/soc
parent0b9b18ce30148d447535132deb295e5ce9c608fc (diff)
soc: pimc: Add IRQ table for PIMC
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sv/soc')
-rw-r--r--sv/soc/irq/pimc.sv24
1 files changed, 21 insertions, 3 deletions
diff --git a/sv/soc/irq/pimc.sv b/sv/soc/irq/pimc.sv
index effe7f9..08733d6 100644
--- a/sv/soc/irq/pimc.sv
+++ b/sv/soc/irq/pimc.sv
@@ -34,26 +34,44 @@
module pimc #(
parameter IRQ_PIN_COUNT = 16,
- parameter IRQTAB_ENTSIZE = 8
+ parameter IRQTAB_ENTSIZE = 9,
+
+ /* irqtab indices */
+ parameter IRQTAB_MASK = 1
) (
input wire clk, /* 50 MHz */
input logic [IRQ_PIN_COUNT-1:0] irq_in,
input logic irqack,
output logic notify,
- output logic [7:0] lineno
+ output logic [7:0] lineno,
+ output logic [7:0] processor_id
);
integer i;
+ bit irqmask;
+ bit accept;
+ reg [IRQTAB_ENTSIZE - 1:0] irqtab[IRQ_PIN_COUNT - 1];
+
+ initial begin
+ for (i = 0; i < IRQ_PIN_COUNT; i = i + IRQTAB_ENTSIZE) begin
+ irqtab[i] = 9'b0;
+ end
+ end
always @(posedge clk) begin
if (irqack == 1'b1) begin
lineno <= 8'b0;
notify <= 1'b1;
+ processor_id <= 8'b0;
end else begin
for (i = 0; i < IRQ_PIN_COUNT; i = i + 1) begin
- if (irq_in[i] == 1'b1 && notify == 1'b1) begin
+ /* IRQ should be dropped if masked */
+ irqmask <= irqtab[(i * IRQTAB_ENTSIZE) + IRQTAB_MASK];
+ accept <= (irqmask == 1'b0 && notify == 1'b1);
+ if (irq_in[i] == 1'b1 && accept == 1'b1) begin
lineno <= i;
notify <= 1'b0;
+ processor_id <= irqtab[i * IRQTAB_ENTSIZE];
end
end
end