add support for ebreak inst

Signed-off-by: liangkangnan <liangkangnan@163.com>
pull/1/head
liangkangnan 2020-06-13 14:56:44 +08:00
parent 5f64a5f8ae
commit e28381dbcf
2 changed files with 13 additions and 3 deletions

View File

@ -85,7 +85,7 @@ module clint(
if (rst == `RstEnable) begin
int_state = S_INT_IDLE;
end else begin
if (inst_i == `INST_ECALL) begin
if (inst_i == `INST_ECALL || inst_i == `INST_EBREAK) begin
int_state = S_INT_SYNC_ASSERT;
end else if (int_flag_i != `INT_NONE && global_int_en_i == `True) begin
int_state = S_INT_ASYNC_ASSERT;
@ -107,10 +107,19 @@ module clint(
case (csr_state)
S_CSR_IDLE: begin
if (int_state == S_INT_SYNC_ASSERT) begin
// ecallÒì³£
cause <= 32'd11;
csr_state <= S_CSR_MEPC;
inst_addr <= inst_addr_i;
case (inst_i)
`INST_ECALL: begin
cause <= 32'd11;
end
`INST_EBREAK: begin
cause <= 32'd3;
end
default: begin
cause <= 32'd10;
end
endcase
end else if (int_state == S_INT_ASYNC_ASSERT) begin
// ¨Ê±Æ÷ÖÐÏ
cause <= 32'h80000004;

View File

@ -116,6 +116,7 @@
`define INST_FENCE 7'b0001111
`define INST_ECALL 32'h73
`define INST_EBREAK 32'h00100073
// J type inst
`define INST_TYPE_B 7'b1100011