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
|
||||||
end
|
end
|
||||||
|
|
||||||
always @(negedge set_initial_values) begin
|
always @( set_initial_values) begin
|
||||||
PARAM1 <= PARAM1_INIT;
|
PARAM1 <= PARAM1_INIT;
|
||||||
PARAM2 <= PARAM2_INIT;
|
PARAM2 <= PARAM2_INIT;
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
`define PROC_STATE_BITS 3
|
`define PROC_STATE_BITS 3
|
||||||
`define PROC_RESET 3'b000
|
`define PROC_RESET 3'b000
|
||||||
`define PROC_DE_STATE_ENTRY 3'b001
|
`define PROC_DE_STATE_ENTRY 3'b001
|
||||||
`define PROC_WAIT 3'b010
|
|
||||||
`define PROC_HALT 3'b011
|
`define PROC_HALT 3'b011
|
||||||
|
|
||||||
//HALT: active high
|
//HALT: active high
|
||||||
@ -215,38 +214,48 @@ always @(posedge clock) begin
|
|||||||
SIMPLE_MICRO <= 0;
|
SIMPLE_MICRO <= 0;
|
||||||
proc_state <= `PROC_DE_STATE_ENTRY;
|
proc_state <= `PROC_DE_STATE_ENTRY;
|
||||||
owe_set_init <= 0;
|
owe_set_init <= 0;
|
||||||
|
set_initial_values<=0;
|
||||||
end
|
end
|
||||||
`PROC_DE_STATE_ENTRY:begin
|
`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
|
if(work==0) begin
|
||||||
DE_OUTPUT_sampled <= DE_OUTPUT;
|
DE_OUTPUT_sampled <= DE_OUTPUT;
|
||||||
|
|
||||||
if(SIMPLE_MICRO==0||owe_set_init==1)begin
|
if(SIMPLE_MICRO==0||owe_set_init==1)begin
|
||||||
valid_instruction_ack <= !valid_instruction_ack;
|
/* This runs at the start of the execution of an 8086 instruction */
|
||||||
owe_set_init<=0;
|
|
||||||
set_initial_values<=0;
|
|
||||||
|
|
||||||
`ifdef DEBUG_PC_ADDRESS
|
`ifdef DEBUG_PC_ADDRESS
|
||||||
$display("Running command at %04x (%08x)",INSTRUCTION_LOCATION,INSTRUCTION);
|
$display("Running command at %04x (%08x)",INSTRUCTION_LOCATION,INSTRUCTION);
|
||||||
`endif
|
`endif
|
||||||
`ifdef CALCULATE_IPC
|
`ifdef CALCULATE_IPC
|
||||||
new_instruction <= !new_instruction;
|
new_instruction <= !new_instruction;
|
||||||
`endif
|
`endif
|
||||||
|
valid_instruction_ack <= !valid_instruction_ack;
|
||||||
|
owe_set_init<=0;
|
||||||
|
set_initial_values<= !set_initial_values;
|
||||||
ProgCount <= INSTRUCTION_LOCATION+{12'b0,instr_end};
|
ProgCount <= INSTRUCTION_LOCATION+{12'b0,instr_end};
|
||||||
INSTRUCTION_BUFFER<=INSTRUCTION[23:0];
|
INSTRUCTION_BUFFER<=INSTRUCTION[23:0];
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( (ucode_seq_addr==`UCODE_NO_INSTRUCTION) && (ucode_seq_addr_entry!=`UCODE_NO_INSTRUCTION) )begin
|
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;
|
ucode_seq_addr <= ucode_seq_addr_entry;
|
||||||
SIMPLE_MICRO <= 1;
|
SIMPLE_MICRO <= 1;
|
||||||
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
||||||
end else begin
|
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;
|
valid_exec_data <= 1;
|
||||||
proc_state <= `PROC_WAIT;
|
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
|
||||||
|
/*Finished microcode*/
|
||||||
|
SIMPLE_MICRO <= 0;
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
if( DE_DEPENDS_ON_PREVIOUS == 0)
|
valid_exec_data <= 0;
|
||||||
if ( (ucode_seq_addr==`UCODE_NO_INSTRUCTION) && (ucode_seq_addr_entry!=`UCODE_NO_INSTRUCTION) )begin
|
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*/
|
/*switch to microcode decoding*/
|
||||||
ucode_seq_addr <= ucode_seq_addr_entry;
|
ucode_seq_addr <= ucode_seq_addr_entry;
|
||||||
SIMPLE_MICRO <= 1;
|
SIMPLE_MICRO <= 1;
|
||||||
@ -254,19 +263,8 @@ always @(posedge clock) begin
|
|||||||
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
/*keep proc_state the same and rerun decode this time with all the data from the microcode rom*/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end else
|
||||||
end
|
valid_exec_data <= 0;
|
||||||
`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
|
|
||||||
/*Finished microcode*/
|
|
||||||
SIMPLE_MICRO <= 0;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
`PROC_HALT:begin
|
`PROC_HALT:begin
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user