LM32: make IP read-only and interrupt lines level-sensitive

This commit is contained in:
Sebastien Bourdeauducq 2012-02-07 00:07:12 +01:00
parent 4aaf48afb0
commit b6b1901bb8
1 changed files with 3 additions and 12 deletions

View File

@ -93,7 +93,7 @@ parameter interrupts = `CFG_INTERRUPTS; // Number of interrupts
input clk_i; // Clock input clk_i; // Clock
input rst_i; // Reset input rst_i; // Reset
input [interrupts-1:0] interrupt; // Interrupt pins, active-low input [interrupts-1:0] interrupt; // Interrupt pins
input stall_x; // Stall X pipeline stage input stall_x; // Stall X pipeline stage
@ -126,8 +126,6 @@ reg [`LM32_WORD_RNG] csr_read_data;
// Internal nets and registers // Internal nets and registers
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
wire [interrupts-1:0] asserted; // Which interrupts are currently being asserted
//pragma attribute asserted preserve_signal true
wire [interrupts-1:0] interrupt_n_exception; wire [interrupts-1:0] interrupt_n_exception;
// Interrupt CSRs // Interrupt CSRs
@ -150,9 +148,6 @@ assign interrupt_n_exception = ip & im;
// Determine if any unmasked interrupts have occured // Determine if any unmasked interrupts have occured
assign interrupt_exception = (|interrupt_n_exception) & ie; assign interrupt_exception = (|interrupt_n_exception) & ie;
// Determine which interrupts are currently being asserted (active-low) or are already pending
assign asserted = ip | interrupt;
assign ie_csr_read_data = {{`LM32_WORD_WIDTH-3{1'b0}}, assign ie_csr_read_data = {{`LM32_WORD_WIDTH-3{1'b0}},
`ifdef CFG_DEBUG_ENABLED `ifdef CFG_DEBUG_ENABLED
bie, bie,
@ -231,7 +226,7 @@ begin
else else
begin begin
// Set IP bit when interrupt line is asserted // Set IP bit when interrupt line is asserted
ip <= asserted; ip <= interrupt;
`ifdef CFG_DEBUG_ENABLED `ifdef CFG_DEBUG_ENABLED
if (non_debug_exception == `TRUE) if (non_debug_exception == `TRUE)
begin begin
@ -276,8 +271,6 @@ begin
end end
if (csr == `LM32_CSR_IM) if (csr == `LM32_CSR_IM)
im <= csr_write_data[interrupts-1:0]; im <= csr_write_data[interrupts-1:0];
if (csr == `LM32_CSR_IP)
ip <= asserted & ~csr_write_data[interrupts-1:0];
end end
end end
end end
@ -300,7 +293,7 @@ begin
else else
begin begin
// Set IP bit when interrupt line is asserted // Set IP bit when interrupt line is asserted
ip <= asserted; ip <= interrupt;
`ifdef CFG_DEBUG_ENABLED `ifdef CFG_DEBUG_ENABLED
if (non_debug_exception == `TRUE) if (non_debug_exception == `TRUE)
begin begin
@ -343,8 +336,6 @@ begin
bie <= csr_write_data[2]; bie <= csr_write_data[2];
`endif `endif
end end
if (csr == `LM32_CSR_IP)
ip <= asserted & ~csr_write_data[interrupts-1:0];
end end
end end
end end