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;
|
||||||
inst_addr <= inst_addr_i;
|
if (jump_flag_i == `JumpEnable) begin
|
||||||
|
inst_addr <= jump_addr_i - 4'h4;
|
||||||
|
end else begin
|
||||||
|
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
|
||||||
// 发出中断进入信号.写完mcause寄存器才能发
|
case (csr_state)
|
||||||
if (csr_state == S_CSR_MCAUSE) begin
|
// 发出中断进入信号.写完mcause寄存器才能发
|
||||||
int_assert_o <= `INT_ASSERT;
|
S_CSR_MCAUSE: begin
|
||||||
int_addr_o <= csr_mtvec;
|
int_assert_o <= `INT_ASSERT;
|
||||||
// 发出中断返回信号
|
int_addr_o <= csr_mtvec;
|
||||||
end else if (csr_state == S_CSR_MSTATUS_MRET) begin
|
end
|
||||||
int_assert_o <= `INT_ASSERT;
|
// 发出中断返回信号
|
||||||
int_addr_o <= csr_mepc;
|
S_CSR_MSTATUS_MRET: begin
|
||||||
end else begin
|
int_assert_o <= `INT_ASSERT;
|
||||||
int_assert_o <= `INT_DEASSERT;
|
int_addr_o <= csr_mepc;
|
||||||
int_addr_o <= `ZeroWord;
|
end
|
||||||
end
|
default: begin
|
||||||
|
int_assert_o <= `INT_DEASSERT;
|
||||||
|
int_addr_o <= `ZeroWord;
|
||||||
|
end
|
||||||
|
endcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue