Cleaned up processor.v a bit
This commit is contained in:
parent
aca3357cda
commit
f914d1ec8f
@ -79,7 +79,7 @@ always @(posedge valid_input) begin
|
||||
end
|
||||
end
|
||||
|
||||
always @(negedge set_initial_values) begin
|
||||
always @( set_initial_values) begin
|
||||
PARAM1 <= PARAM1_INIT;
|
||||
PARAM2 <= PARAM2_INIT;
|
||||
end
|
||||
|
@ -26,7 +26,6 @@
|
||||
`define PROC_STATE_BITS 3
|
||||
`define PROC_RESET 3'b000
|
||||
`define PROC_DE_STATE_ENTRY 3'b001
|
||||
`define PROC_WAIT 3'b010
|
||||
`define PROC_HALT 3'b011
|
||||
|
||||
//HALT: active high
|
||||
@ -215,51 +214,36 @@ always @(posedge clock) begin
|
||||
SIMPLE_MICRO <= 0;
|
||||
proc_state <= `PROC_DE_STATE_ENTRY;
|
||||
owe_set_init <= 0;
|
||||
set_initial_values<=0;
|
||||
end
|
||||
`PROC_DE_STATE_ENTRY:begin
|
||||
if(VALID_INSTRUCTION==1 || SIMPLE_MICRO == 1 ) begin
|
||||
if( VALID_INSTRUCTION==1 || SIMPLE_MICRO == 1 ) begin
|
||||
if(work==0) begin
|
||||
DE_OUTPUT_sampled <= DE_OUTPUT;
|
||||
|
||||
if(SIMPLE_MICRO==0||owe_set_init==1)begin
|
||||
valid_instruction_ack <= !valid_instruction_ack;
|
||||
owe_set_init<=0;
|
||||
set_initial_values<=0;
|
||||
|
||||
/* This runs at the start of the execution of an 8086 instruction */
|
||||
`ifdef DEBUG_PC_ADDRESS
|
||||
$display("Running command at %04x (%08x)",INSTRUCTION_LOCATION,INSTRUCTION);
|
||||
`endif
|
||||
`ifdef CALCULATE_IPC
|
||||
new_instruction <= !new_instruction;
|
||||
`endif
|
||||
valid_instruction_ack <= !valid_instruction_ack;
|
||||
owe_set_init<=0;
|
||||
set_initial_values<= !set_initial_values;
|
||||
ProgCount <= INSTRUCTION_LOCATION+{12'b0,instr_end};
|
||||
INSTRUCTION_BUFFER<=INSTRUCTION[23:0];
|
||||
end
|
||||
|
||||
if ( (ucode_seq_addr==`UCODE_NO_INSTRUCTION) && (ucode_seq_addr_entry!=`UCODE_NO_INSTRUCTION) )begin
|
||||
/*switch to microcode decoding*/
|
||||
/* switch to microcode decoding */
|
||||
ucode_seq_addr <= ucode_seq_addr_entry;
|
||||
SIMPLE_MICRO <= 1;
|
||||
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
||||
end else begin
|
||||
/* This runs at the start of each execution cycle, with microcode this is more than once per 8086 instruction */
|
||||
valid_exec_data <= 1;
|
||||
proc_state <= `PROC_WAIT;
|
||||
end
|
||||
end else begin
|
||||
if( DE_DEPENDS_ON_PREVIOUS == 0)
|
||||
if ( (ucode_seq_addr==`UCODE_NO_INSTRUCTION) && (ucode_seq_addr_entry!=`UCODE_NO_INSTRUCTION) )begin
|
||||
/*switch to microcode decoding*/
|
||||
ucode_seq_addr <= ucode_seq_addr_entry;
|
||||
SIMPLE_MICRO <= 1;
|
||||
owe_set_init <= 1;
|
||||
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
`PROC_WAIT:begin
|
||||
set_initial_values<=1;
|
||||
valid_exec_data<=0;
|
||||
proc_state <= `PROC_DE_STATE_ENTRY;
|
||||
if( SIMPLE_MICRO == 1 ) begin
|
||||
ucode_seq_addr <= ucode_seq_addr_entry; /*Reused for next address*/
|
||||
if( ucode_seq_addr_entry == `UCODE_NO_INSTRUCTION )begin
|
||||
@ -268,6 +252,20 @@ always @(posedge clock) begin
|
||||
end
|
||||
end
|
||||
end
|
||||
end else begin
|
||||
valid_exec_data <= 0;
|
||||
if( DE_DEPENDS_ON_PREVIOUS == 0 )
|
||||
if ( (ucode_seq_addr==`UCODE_NO_INSTRUCTION) && (ucode_seq_addr_entry!=`UCODE_NO_INSTRUCTION) && valid_exec_data==0 )begin
|
||||
/*switch to microcode decoding*/
|
||||
ucode_seq_addr <= ucode_seq_addr_entry;
|
||||
SIMPLE_MICRO <= 1;
|
||||
owe_set_init <= 1;
|
||||
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
||||
end
|
||||
end
|
||||
end else
|
||||
valid_exec_data <= 0;
|
||||
end
|
||||
`PROC_HALT:begin
|
||||
end
|
||||
default:begin
|
||||
|
Loading…
Reference in New Issue
Block a user