OpenCores
URL https://opencores.org/ocsvn/m1_core/m1_core/trunk

Subversion Repositories m1_core

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 60 to Rev 61
    Reverse comparison

Rev 60 → Rev 61

/m1_core/trunk/hdl/rtl/m1_core/m1_cpu.v
224,6 → 224,10
assign mem_stall = wb_stall || ( (dmem_read_o||dmem_write_o) && !dmem_done_i);
assign wb_stall = 0;
 
// Branch taken
wire branch_taken;
assign branch_taken = ( ex_mem_branch==1 && (ex_mem_aluout==32'h00000001) );
// Name the System Configuration registers
wire[31:0] BadVAddr = SysCon[`SYSCON_BADVADDR];
wire[31:0] Status = SysCon[`SYSCON_STATUS];
332,23 → 336,24
* DESCRIPTION:
* This stage usually reads the next instruction from the PC address in memory and
* then updates the PC value by incrementing it by 4.
* When a hazard is detected this stage is idle.
*/
 
// A RAW hazard will stall the CPU
// Handle hazards (if_stall = id_stall || !imem_done_i)
if(if_stall) begin
 
// IF stall backward propagated from ID
if(id_stall) begin
$display("INFO: CPU(%m)-IF: Fetching stalled and latch kept for following stalled pipeline stage");
$display("INFO: CPU(%m)-IF: Fetching stalled like ID, latch keeps old value");
// IMEM is not ready
end else begin
$display("INFO: CPU(%m)-IF: Fetching stalled and bubble inserted for following running pipeline stage");
$display("INFO: CPU(%m)-IF: Fetching stalled due to IMEM, latch filled with bubble");
if_id_opcode <= `BUBBLE;
end
 
end else begin
 
// If branch taken update the Program Counter
if(ex_mem_branch==1 && ex_mem_aluout==32'h00000001) begin
// If branch taken update the Program Counter (branch_taken = ex_mem_branch==1 && ex_mem_aluout==32'h00000001)
if(branch_taken) begin
 
$display("INFO: CPU(%m)-IF: Bubble inserted due branch taken in EX/MEM instruction @ADDR=%X w/OPCODE=%X having ALUout=%X", ex_mem_addr, ex_mem_opcode, ex_mem_aluout);
if_id_opcode <= `BUBBLE;
392,12 → 397,34
* This stage decodes the instruction and puts the values for the ALU inputs
*/
 
if(id_stall) begin
if(branch_taken) begin
$display("INFO: CPU(%m)-ID: Branch taken and bubble inserted");
id_ex_opcode <=`BUBBLE;
id_ex_alu_a <= 0;
id_ex_alu_b <= 0;
id_ex_alu_func <= `ALU_OP_ADD;
id_ex_alu_signed <= 0;
id_ex_addr <= if_id_addr;
id_ex_addrnext <= 0;
id_ex_addrjump <= 0;
id_ex_addrbranch <= 0;
id_ex_branch <= 0;
id_ex_jump <= 0;
id_ex_jr <= 0;
id_ex_linked <= 0;
id_ex_mult <= 0;
id_ex_div <= 0;
id_ex_load <= 0;
id_ex_store <= 0;
id_ex_destreg <= 0;
id_ex_desthi <= 0;
id_ex_destlo <= 0;
end else if(id_stall) begin
if(ex_stall) begin
$display("INFO: CPU(%m)-ID: Decoding stalled and latch kept for following stalled pipeline stage");
$display("INFO: CPU(%m)-ID: Decoding stalled and latch kept");
end else begin
$display("INFO: CPU(%m)-ID: Decoding stalled and bubble inserted for following running pipeline stage");
$display("INFO: CPU(%m)-ID: Decoding stalled and bubble inserted");
id_ex_opcode <=`BUBBLE;
id_ex_alu_a <= 0;
id_ex_alu_b <= 0;
1735,9 → 1762,9
if(ex_stall) begin
if(mem_stall) begin
$display("INFO: CPU(%m)-EX: Execution stalled and latch kept for following stalled pipeline stage");
$display("INFO: CPU(%m)-EX: Execution stalled and latch kept");
end else begin
$display("INFO: CPU(%m)-EX: Execution stalled and bubble inserted for following running pipeline stage");
$display("INFO: CPU(%m)-EX: Execution stalled and bubble inserted");
ex_mem_opcode <= `BUBBLE;
ex_mem_addr <= id_ex_addr;
ex_mem_addrnext <= 0;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.