Removed duplicate code and improved microcode entry
This commit is contained in:
parent
79d598fc64
commit
d2a98c02ff
@ -198,7 +198,10 @@ always @(negedge reset) begin
|
||||
end
|
||||
always @(posedge reset) begin
|
||||
proc_state <= `PROC_RESET;
|
||||
valid_instruction_ack <= 0; // needs early init
|
||||
/* need early init */
|
||||
valid_instruction_ack <= 0;
|
||||
instant_response <= 0;
|
||||
stalled_response <= 0;
|
||||
end
|
||||
|
||||
/*** Processor stages ***/
|
||||
@ -216,44 +219,19 @@ reg owe_set_init;
|
||||
reg VALID_INSTRUCTION_lc;
|
||||
always @(VALID_INSTRUCTION)begin VALID_INSTRUCTION_lc<=VALID_INSTRUCTION; end
|
||||
|
||||
reg instant_response, stalled_response;
|
||||
reg wait_exec;
|
||||
|
||||
always @(next_exec) begin
|
||||
proc_state<=`PROC_DE_STATE_ENTRY;
|
||||
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<=!valid_exec_data;
|
||||
if ( VALID_INSTRUCTION_lc == 1 && DE_DEPENDS_ON_PREVIOUS == 0 && ucode_seq_addr_entry==`UCODE_NO_INSTRUCTION) begin
|
||||
instant_response <= !instant_response;
|
||||
end else begin
|
||||
wait_exec<=0;
|
||||
end
|
||||
end
|
||||
|
||||
reg wait_exec;
|
||||
|
||||
always @(posedge clock) begin
|
||||
case(proc_state)
|
||||
`PROC_RESET:begin
|
||||
ucode_seq_addr <= `UCODE_NO_INSTRUCTION;
|
||||
DE_OUTPUT_sampled <= 0;
|
||||
SIMPLE_MICRO <= 0;
|
||||
proc_state <= `PROC_DE_STATE_ENTRY;
|
||||
owe_set_init <= 0;
|
||||
set_initial_values<=0;
|
||||
wait_exec<=0;
|
||||
valid_exec_data<=0;
|
||||
end
|
||||
`PROC_DE_STATE_ENTRY:begin
|
||||
if( VALID_INSTRUCTION==1 || SIMPLE_MICRO == 1 ) begin
|
||||
if(wait_exec==0) begin
|
||||
always @(instant_response or stalled_response) begin
|
||||
DE_OUTPUT_sampled <= DE_OUTPUT;
|
||||
|
||||
if(SIMPLE_MICRO==0||owe_set_init==1)begin
|
||||
@ -288,7 +266,23 @@ always @(posedge clock) begin
|
||||
end
|
||||
wait_exec<=1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clock) begin
|
||||
case(proc_state)
|
||||
`PROC_RESET:begin
|
||||
ucode_seq_addr <= `UCODE_NO_INSTRUCTION;
|
||||
DE_OUTPUT_sampled <= 0;
|
||||
SIMPLE_MICRO <= 0;
|
||||
proc_state <= `PROC_DE_STATE_ENTRY;
|
||||
owe_set_init <= 0;
|
||||
set_initial_values<=0;
|
||||
wait_exec<=0;
|
||||
valid_exec_data<=0;
|
||||
end
|
||||
`PROC_DE_STATE_ENTRY:begin
|
||||
if ( ( VALID_INSTRUCTION==1 || SIMPLE_MICRO == 1 ) && wait_exec==0) begin
|
||||
stalled_response <= !stalled_response;
|
||||
end
|
||||
end
|
||||
`PROC_HALT:begin
|
||||
|
Loading…
Reference in New Issue
Block a user