Fix potential problem with core_busy_o, it is now also set when an

instruction request is in flight and not only when we are decoding
This commit is contained in:
Andreas Traber 2015-08-31 10:24:39 +02:00
parent 88b91c20c5
commit b84dde00b8
2 changed files with 21 additions and 5 deletions

View file

@ -78,7 +78,10 @@ module if_stage
// pipeline stall
input logic stall_if_i,
input logic stall_id_i
input logic stall_id_i,
// misc signals
output logic if_busy_o // is the IF stage busy fetching instructions?
);
// offset FSM
@ -413,6 +416,13 @@ module if_stage
end
end
assign if_busy_o = ~(offset_fsm_cs == IDLE ||
offset_fsm_cs == VALID_JUMPED_ALIGNED ||
offset_fsm_cs == VALID_JUMPED_UNALIGNED ||
offset_fsm_cs == VALID_ALIGNED ||
offset_fsm_cs == VALID_UNALIGNED_32 ||
offset_fsm_cs == UNALIGNED_16) || instr_req_o;
// IF-ID pipeline registers, frozen when the ID stage is stalled
always_ff @(posedge clk, negedge rst_n)

View file

@ -110,6 +110,9 @@ module riscv_core
logic stall_ex; // Stall EX Stage
logic stall_wb; // Stall write back stage
logic core_busy;
logic if_busy;
// Register Data
logic [31:0] regfile_rb_data_ex; // from id stage to load/store unit and ex stage
@ -167,10 +170,8 @@ module riscv_core
logic data_ack_int;
// Signals between instruction core interface and pipe (if and id stages)
logic [31:0] instr_rdata_int; // read instruction from the instruction core interface to if_stage
logic instr_req_int; // Id stage asserts a req to instruction core interface
logic instr_ack_int; // instr core interface acks the request now (read data is available)
logic [31:0] instr_addr_int; // adress sent to the inst core interface from if_Stage
// Interrupts
logic irq_enable;
@ -240,6 +241,9 @@ module riscv_core
assign core_busy_o = if_busy || core_busy;
//////////////////////////////////////////////////
// ___ _____ ____ _____ _ ____ _____ //
// |_ _| ___| / ___|_ _|/ \ / ___| ____| //
@ -293,7 +297,9 @@ module riscv_core
// pipeline stalls
.stall_if_i ( stall_if ),
.stall_id_i ( stall_id )
.stall_id_i ( stall_id ),
.if_busy_o ( if_busy )
);
@ -319,7 +325,7 @@ module riscv_core
.jump_target_o ( jump_target_id ),
.core_busy_o ( core_busy_o ),
.core_busy_o ( core_busy ),
// Interface to instruction memory
.instr_rdata_i ( instr_rdata_id ),