diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-12-13 21:43:25 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-12-16 16:29:10 -0600 |
| commit | 0c63c46e31642d0102542a745af6b445a9d22b3b (patch) | |
| tree | 0e8b6db18829e4a3d6c894af206f2b5257815827 /rtl/intc.sv | |
| parent | d564e3538a3654facc94bb4cd1ee021830dfcf52 (diff) | |
Implement interrupt controller
Diffstat (limited to 'rtl/intc.sv')
| -rw-r--r-- | rtl/intc.sv | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/rtl/intc.sv b/rtl/intc.sv new file mode 100644 index 0000000..af78ef8 --- /dev/null +++ b/rtl/intc.sv @@ -0,0 +1,30 @@ +module intc +( + input logic clk, + rst_n, + + input logic irq_timer, + irq_jtaguart, + + input logic avl_address, + avl_read, + avl_write, + input logic[31:0] avl_writedata, + + output logic avl_irq, + output logic[31:0] avl_readdata +); + + logic[31:0] status, mask; + + assign status = {30'b0, irq_jtaguart, irq_timer} & mask; + assign avl_irq = |status; + assign avl_readdata = avl_address ? mask : status; + + always @(posedge clk or negedge rst_n) + if(!rst_n) + mask <= 0; + else if(avl_write && avl_address) + mask <= avl_writedata; + +endmodule |
