rtl: fix sync interrupt return address
Signed-off-by: liangkangnan <liangkangnan@163.com>pull/1/head
parent
b39062a4ea
commit
e23ad11e7e
|
@ -112,7 +112,11 @@ module clint(
|
||||||
S_CSR_IDLE: begin
|
S_CSR_IDLE: begin
|
||||||
if (int_state == S_INT_SYNC_ASSERT) begin
|
if (int_state == S_INT_SYNC_ASSERT) begin
|
||||||
csr_state <= S_CSR_MEPC;
|
csr_state <= S_CSR_MEPC;
|
||||||
|
if (jump_flag_i == `JumpEnable) begin
|
||||||
|
inst_addr <= jump_addr_i - 4'h4;
|
||||||
|
end else begin
|
||||||
inst_addr <= inst_addr_i;
|
inst_addr <= inst_addr_i;
|
||||||
|
end
|
||||||
case (inst_i)
|
case (inst_i)
|
||||||
`INST_ECALL: begin
|
`INST_ECALL: begin
|
||||||
cause <= 32'd11;
|
cause <= 32'd11;
|
||||||
|
@ -204,18 +208,22 @@ module clint(
|
||||||
int_assert_o <= `INT_DEASSERT;
|
int_assert_o <= `INT_DEASSERT;
|
||||||
int_addr_o <= `ZeroWord;
|
int_addr_o <= `ZeroWord;
|
||||||
end else begin
|
end else begin
|
||||||
|
case (csr_state)
|
||||||
// 发出中断进入信号.写完mcause寄存器才能发
|
// 发出中断进入信号.写完mcause寄存器才能发
|
||||||
if (csr_state == S_CSR_MCAUSE) begin
|
S_CSR_MCAUSE: begin
|
||||||
int_assert_o <= `INT_ASSERT;
|
int_assert_o <= `INT_ASSERT;
|
||||||
int_addr_o <= csr_mtvec;
|
int_addr_o <= csr_mtvec;
|
||||||
|
end
|
||||||
// 发出中断返回信号
|
// 发出中断返回信号
|
||||||
end else if (csr_state == S_CSR_MSTATUS_MRET) begin
|
S_CSR_MSTATUS_MRET: begin
|
||||||
int_assert_o <= `INT_ASSERT;
|
int_assert_o <= `INT_ASSERT;
|
||||||
int_addr_o <= csr_mepc;
|
int_addr_o <= csr_mepc;
|
||||||
end else begin
|
end
|
||||||
|
default: begin
|
||||||
int_assert_o <= `INT_DEASSERT;
|
int_assert_o <= `INT_DEASSERT;
|
||||||
int_addr_o <= `ZeroWord;
|
int_addr_o <= `ZeroWord;
|
||||||
end
|
end
|
||||||
|
endcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue