From 90f63b525d445c7a368dbaa19e6044936c02733c Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Wed, 17 May 2023 20:07:45 +0100 Subject: [PATCH] Made the decode unit able to continuously decode (simple) instructions if BIU allows it --- system/processor.v | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/system/processor.v b/system/processor.v index 202b677..bd5c6a9 100644 --- a/system/processor.v +++ b/system/processor.v @@ -206,10 +206,32 @@ reg [23:0] INSTRUCTION_BUFFER; reg owe_set_init; +//TODO: Why do we need to make a local copy on a register for the code inside the always @(next_state) to read it? +// For some reason the raw VALID_INSTRUCTION signal reads always 1 and it has something to do with the block +// being triggered by next_exec +reg VALID_INSTRUCTION_lc; +always @(VALID_INSTRUCTION)begin VALID_INSTRUCTION_lc<=VALID_INSTRUCTION; end + always @(next_exec) begin - valid_exec_data<=0; proc_state<=`PROC_DE_STATE_ENTRY; - wait_exec<=0; + if ( VALID_INSTRUCTION_lc == 1 && SIMPLE_MICRO == 0 && DE_DEPENDS_ON_PREVIOUS == 0 && ucode_seq_addr_entry==`UCODE_NO_INSTRUCTION) begin + `ifdef DEBUG_PC_ADDRESS + $display("Running command at %04x (%08x)",INSTRUCTION_LOCATION,INSTRUCTION); + `endif + `ifdef CALCULATE_IPC + new_instruction <= !new_instruction; + `endif + DE_OUTPUT_sampled <= DE_OUTPUT; + set_initial_values<= !set_initial_values; + valid_instruction_ack <= !valid_instruction_ack; + ProgCount <= INSTRUCTION_LOCATION+{12'b0,instr_end}; + INSTRUCTION_BUFFER<=INSTRUCTION[23:0]; + wait_exec<=1; + valid_exec_data<=1; + end else begin + wait_exec<=0; + valid_exec_data<=0; + end end reg wait_exec;