mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge pull request #961 from jordancarlin/testbench_fp_formatting
Fix testbench_fp formatting
This commit is contained in:
commit
52ac1b142d
@ -82,8 +82,7 @@ module testbench_fp;
|
|||||||
logic [P.FLEN-1:0] FpRes, FpCmpRes; // Results from each unit
|
logic [P.FLEN-1:0] FpRes, FpCmpRes; // Results from each unit
|
||||||
logic [P.XLEN-1:0] IntRes, CmpRes; // Results from each unit
|
logic [P.XLEN-1:0] IntRes, CmpRes; // Results from each unit
|
||||||
logic [P.Q_LEN-1:0] FpResExtended; // FpRes extended to same length as Ans/Res
|
logic [P.Q_LEN-1:0] FpResExtended; // FpRes extended to same length as Ans/Res
|
||||||
logic [4:0] FmaFlg, CvtFlg, DivFlg; // Outputed flags
|
logic [4:0] FmaFlg, CvtFlg, DivFlg, CmpFlg; // Outputed flags
|
||||||
logic [4:0] CmpFlg; // Outputed flags
|
|
||||||
logic AnsNaN, ResNaN, NaNGood;
|
logic AnsNaN, ResNaN, NaNGood;
|
||||||
logic Xs, Ys, Zs; // sign of the inputs
|
logic Xs, Ys, Zs; // sign of the inputs
|
||||||
logic [P.NE-1:0] Xe, Ye, Ze; // exponent of the inputs
|
logic [P.NE-1:0] Xe, Ye, Ze; // exponent of the inputs
|
||||||
@ -796,8 +795,7 @@ module testbench_fp;
|
|||||||
// an integer output can't be a NaN
|
// an integer output can't be a NaN
|
||||||
AnsNaN = 1'b0;
|
AnsNaN = 1'b0;
|
||||||
ResNaN = 1'b0;
|
ResNaN = 1'b0;
|
||||||
end
|
end else if (UnitVal === `CVTFPUNIT) begin
|
||||||
else if (UnitVal === `CVTFPUNIT) begin
|
|
||||||
case (OpCtrlVal[1:0])
|
case (OpCtrlVal[1:0])
|
||||||
2'b11: begin // quad
|
2'b11: begin // quad
|
||||||
AnsNaN = &Ans[P.Q_LEN-2:P.NF]&(|Ans[P.Q_NF-1:0]);
|
AnsNaN = &Ans[P.Q_LEN-2:P.NF]&(|Ans[P.Q_NF-1:0]);
|
||||||
@ -816,8 +814,7 @@ module testbench_fp;
|
|||||||
ResNaN = &Res[P.H_LEN-2:P.H_NF]&(|Res[P.H_NF-1:0]);
|
ResNaN = &Res[P.H_LEN-2:P.H_NF]&(|Res[P.H_NF-1:0]);
|
||||||
end
|
end
|
||||||
endcase
|
endcase
|
||||||
end
|
end else begin
|
||||||
else begin
|
|
||||||
case (FmtVal)
|
case (FmtVal)
|
||||||
2'b11: begin // quad
|
2'b11: begin // quad
|
||||||
AnsNaN = &Ans[P.Q_LEN-2:P.Q_NF]&(|Ans[P.Q_NF-1:0]);
|
AnsNaN = &Ans[P.Q_LEN-2:P.Q_NF]&(|Ans[P.Q_NF-1:0]);
|
||||||
@ -890,7 +887,6 @@ module testbench_fp;
|
|||||||
nextstate = S0;
|
nextstate = S0;
|
||||||
end
|
end
|
||||||
endcase // case (state)
|
endcase // case (state)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
// Provide reset for divsqrt to reset state
|
// Provide reset for divsqrt to reset state
|
||||||
@ -908,18 +904,15 @@ module testbench_fp;
|
|||||||
// various cycle counts for different fp/int operations
|
// various cycle counts for different fp/int operations
|
||||||
// Adds vector at start of clock
|
// Adds vector at start of clock
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
|
|
||||||
// state machine element for testing
|
// state machine element for testing
|
||||||
if (reset)
|
if (reset)
|
||||||
state <= S0;
|
state <= S0;
|
||||||
else
|
else
|
||||||
state <= nextstate;
|
state <= nextstate;
|
||||||
|
|
||||||
// Increment the vector when Done with each test
|
// Increment the vector when Done with each test
|
||||||
if (state == Done) begin
|
if (state == Done) begin
|
||||||
VectorNum += 1; // increment the vector
|
VectorNum += 1; // increment the vector
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
// check results on falling edge of clk
|
// check results on falling edge of clk
|
||||||
@ -975,7 +968,6 @@ module testbench_fp;
|
|||||||
endcase
|
endcase
|
||||||
else NaNGood = 1'b0; // integers can't be NaNs
|
else NaNGood = 1'b0; // integers can't be NaNs
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// ||||||| ||| ||| ||||||| ||||||| ||| |||
|
// ||||||| ||| ||| ||||||| ||||||| ||| |||
|
||||||
@ -1093,11 +1085,12 @@ module readvectors import cvw::*; #(parameter cvw_t P) (
|
|||||||
X = TestVector[8+4*(P.Q_LEN)-1:8+3*(P.Q_LEN)];
|
X = TestVector[8+4*(P.Q_LEN)-1:8+3*(P.Q_LEN)];
|
||||||
Y = TestVector[8+3*(P.Q_LEN)-1:8+2*(P.Q_LEN)];
|
Y = TestVector[8+3*(P.Q_LEN)-1:8+2*(P.Q_LEN)];
|
||||||
Z = TestVector[8+2*(P.Q_LEN)-1:8+P.Q_LEN];
|
Z = TestVector[8+2*(P.Q_LEN)-1:8+P.Q_LEN];
|
||||||
end
|
end else begin
|
||||||
else begin
|
|
||||||
X = TestVector[8+3*(P.Q_LEN)-1:8+2*(P.Q_LEN)];
|
X = TestVector[8+3*(P.Q_LEN)-1:8+2*(P.Q_LEN)];
|
||||||
if (OpCtrl === `MUL_OPCTRL) Y = TestVector[8+2*(P.Q_LEN)-1:8+(P.Q_LEN)]; else Y = {2'b0, {P.Q_NE-1{1'b1}}, (P.Q_NF)'(0)};
|
if (OpCtrl === `MUL_OPCTRL) Y = TestVector[8+2*(P.Q_LEN)-1:8+(P.Q_LEN)];
|
||||||
if (OpCtrl === `MUL_OPCTRL) Z = 0; else Z = TestVector[8+2*(P.Q_LEN)-1:8+(P.Q_LEN)];
|
else Y = {2'b0, {P.Q_NE-1{1'b1}}, (P.Q_NF)'(0)};
|
||||||
|
if (OpCtrl === `MUL_OPCTRL) Z = 0;
|
||||||
|
else Z = TestVector[8+2*(P.Q_LEN)-1:8+(P.Q_LEN)];
|
||||||
end
|
end
|
||||||
Ans = TestVector[8+(P.Q_LEN-1):8];
|
Ans = TestVector[8+(P.Q_LEN-1):8];
|
||||||
end
|
end
|
||||||
@ -1106,8 +1099,7 @@ module readvectors import cvw::*; #(parameter cvw_t P) (
|
|||||||
X = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+4*(P.D_LEN)-1:8+3*(P.D_LEN)]};
|
X = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+4*(P.D_LEN)-1:8+3*(P.D_LEN)]};
|
||||||
Y = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+3*(P.D_LEN)-1:8+2*(P.D_LEN)]};
|
Y = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+3*(P.D_LEN)-1:8+2*(P.D_LEN)]};
|
||||||
Z = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+2*(P.D_LEN)-1:8+P.D_LEN]};
|
Z = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+2*(P.D_LEN)-1:8+P.D_LEN]};
|
||||||
end
|
end else begin
|
||||||
else begin
|
|
||||||
X = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+3*(P.D_LEN)-1:8+2*(P.D_LEN)]};
|
X = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+3*(P.D_LEN)-1:8+2*(P.D_LEN)]};
|
||||||
if (OpCtrl === `MUL_OPCTRL) Y = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+2*(P.D_LEN)-1:8+(P.D_LEN)]};
|
if (OpCtrl === `MUL_OPCTRL) Y = {{P.Q_LEN-P.D_LEN{1'b1}}, TestVector[8+2*(P.D_LEN)-1:8+(P.D_LEN)]};
|
||||||
else Y = {{P.Q_LEN-P.D_LEN{1'b1}}, 2'b0, {P.D_NE-1{1'b1}}, (P.D_NF)'(0)};
|
else Y = {{P.Q_LEN-P.D_LEN{1'b1}}, 2'b0, {P.D_NE-1{1'b1}}, (P.D_NF)'(0)};
|
||||||
@ -1121,8 +1113,7 @@ module readvectors import cvw::*; #(parameter cvw_t P) (
|
|||||||
X = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+4*(P.S_LEN)-1:8+3*(P.S_LEN)]};
|
X = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+4*(P.S_LEN)-1:8+3*(P.S_LEN)]};
|
||||||
Y = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+3*(P.S_LEN)-1:8+2*(P.S_LEN)]};
|
Y = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+3*(P.S_LEN)-1:8+2*(P.S_LEN)]};
|
||||||
Z = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+2*(P.S_LEN)-1:8+P.S_LEN]};
|
Z = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+2*(P.S_LEN)-1:8+P.S_LEN]};
|
||||||
end
|
end else begin
|
||||||
else begin
|
|
||||||
X = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+3*(P.S_LEN)-1:8+2*(P.S_LEN)]};
|
X = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+3*(P.S_LEN)-1:8+2*(P.S_LEN)]};
|
||||||
if (OpCtrl === `MUL_OPCTRL) Y = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+2*(P.S_LEN)-1:8+(P.S_LEN)]};
|
if (OpCtrl === `MUL_OPCTRL) Y = {{P.Q_LEN-P.S_LEN{1'b1}}, TestVector[8+2*(P.S_LEN)-1:8+(P.S_LEN)]};
|
||||||
else Y = {{P.Q_LEN-P.S_LEN{1'b1}}, 2'b0, {P.S_NE-1{1'b1}}, (P.S_NF)'(0)};
|
else Y = {{P.Q_LEN-P.S_LEN{1'b1}}, 2'b0, {P.S_NE-1{1'b1}}, (P.S_NF)'(0)};
|
||||||
@ -1136,8 +1127,7 @@ module readvectors import cvw::*; #(parameter cvw_t P) (
|
|||||||
X = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+4*(P.H_LEN)-1:8+3*(P.H_LEN)]};
|
X = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+4*(P.H_LEN)-1:8+3*(P.H_LEN)]};
|
||||||
Y = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+3*(P.H_LEN)-1:8+2*(P.H_LEN)]};
|
Y = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+3*(P.H_LEN)-1:8+2*(P.H_LEN)]};
|
||||||
Z = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+2*(P.H_LEN)-1:8+P.H_LEN]};
|
Z = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+2*(P.H_LEN)-1:8+P.H_LEN]};
|
||||||
end
|
end else begin
|
||||||
else begin
|
|
||||||
X = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+3*(P.H_LEN)-1:8+2*(P.H_LEN)]};
|
X = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+3*(P.H_LEN)-1:8+2*(P.H_LEN)]};
|
||||||
if (OpCtrl === `MUL_OPCTRL) Y = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+2*(P.H_LEN)-1:8+(P.H_LEN)]};
|
if (OpCtrl === `MUL_OPCTRL) Y = {{P.Q_LEN-P.H_LEN{1'b1}}, TestVector[8+2*(P.H_LEN)-1:8+(P.H_LEN)]};
|
||||||
else Y = {{P.Q_LEN-P.H_LEN{1'b1}}, 2'b0, {P.H_NE-1{1'b1}}, (P.H_NF)'(0)};
|
else Y = {{P.Q_LEN-P.H_LEN{1'b1}}, 2'b0, {P.H_NE-1{1'b1}}, (P.H_NF)'(0)};
|
||||||
@ -1415,5 +1405,4 @@ module readvectors import cvw::*; #(parameter cvw_t P) (
|
|||||||
.Xm, .Ym, .Zm, .XNaN, .YNaN, .ZNaN, .XSNaN, .YSNaN, .ZSNaN,
|
.Xm, .Ym, .Zm, .XNaN, .YNaN, .ZNaN, .XSNaN, .YSNaN, .ZSNaN,
|
||||||
.XSubnorm, .XZero, .YZero, .ZZero, .XInf, .YInf, .ZInf,
|
.XSubnorm, .XZero, .YZero, .ZZero, .XInf, .YInf, .ZInf,
|
||||||
.XEn, .YEn, .ZEn, .XExpMax, .XPostBox, .Bias(BiasE), .Nf(NfE));
|
.XEn, .YEn, .ZEn, .XExpMax, .XPostBox, .Bias(BiasE), .Nf(NfE));
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user