Speed up ALU path
Move calculation of V and Z flags into next pipeline stage
This commit is contained in:
13
ALU.v
13
ALU.v
@@ -35,11 +35,13 @@ module ALU( clk, op, right, AI, BI, CI, CO, BCD, OUT, V, Z, N, HC, RDY );
|
|||||||
|
|
||||||
reg [7:0] OUT;
|
reg [7:0] OUT;
|
||||||
reg CO;
|
reg CO;
|
||||||
reg V;
|
wire V;
|
||||||
reg Z;
|
wire Z;
|
||||||
reg N;
|
reg N;
|
||||||
reg HC;
|
reg HC;
|
||||||
|
|
||||||
|
reg AI7;
|
||||||
|
reg BI7;
|
||||||
reg [8:0] logic;
|
reg [8:0] logic;
|
||||||
reg [7:0] temp_BI;
|
reg [7:0] temp_BI;
|
||||||
reg [4:0] temp_l;
|
reg [4:0] temp_l;
|
||||||
@@ -92,12 +94,15 @@ end
|
|||||||
// calculate the flags
|
// calculate the flags
|
||||||
always @(posedge clk)
|
always @(posedge clk)
|
||||||
if( RDY ) begin
|
if( RDY ) begin
|
||||||
|
AI7 <= AI[7];
|
||||||
|
BI7 <= temp_BI[7];
|
||||||
OUT <= temp[7:0];
|
OUT <= temp[7:0];
|
||||||
CO <= temp[8] | CO9;
|
CO <= temp[8] | CO9;
|
||||||
Z <= ~|temp[7:0];
|
|
||||||
N <= temp[7];
|
N <= temp[7];
|
||||||
V <= AI[7] ^ temp_BI[7] ^ temp[7] ^ temp[8];
|
|
||||||
HC <= temp_HC;
|
HC <= temp_HC;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assign V = AI7 ^ BI7 ^ CO ^ N;
|
||||||
|
assign Z = ~|OUT;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|||||||
Reference in New Issue
Block a user