mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 10:15:19 +00:00
commit
8c3a372925
60
sim/FPbuild.txt
Normal file
60
sim/FPbuild.txt
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
Procedure for Runnning SoftFloat/TestFloat with Wally
|
||||||
|
|
||||||
|
1.) First, compile SoftFloat and TestFloat by going to the addins
|
||||||
|
directory and finding the specific build directory (e.g.,
|
||||||
|
Linux_x86_64-GCC. Currently, we are using v3e of
|
||||||
|
SoftFloat/TestFloat. I am not sure of the order, but I always compile
|
||||||
|
SoftFloat first as I believe TestFloat uses the static library
|
||||||
|
SoftFloat creates.
|
||||||
|
|
||||||
|
2.) Once compiled both, go to the tests/fp directory and run the
|
||||||
|
create_vectors.sh Linux script. In the past, we have automated this,
|
||||||
|
but I believe this has fallen into more of a manual state lately.
|
||||||
|
|
||||||
|
3.) Then, run remove_spaces.sh which will remove spaces from the
|
||||||
|
output and put underscores between vectors (this helps differentiate
|
||||||
|
the vectors that are generated). Again, this can be combined with
|
||||||
|
Step 2.
|
||||||
|
|
||||||
|
4.) TestFloat is run from wally/cvw/sim and sim-testfloat-batch with
|
||||||
|
its respective test. The format is ./sim-testfloat-add add. All of
|
||||||
|
the tests are listed below. This can be augmented or added to for
|
||||||
|
other FP tests given by the great SoftFloat/TestFloat output.
|
||||||
|
|
||||||
|
cvtint - test integer conversion unit (fcvtint)
|
||||||
|
cvtfp - test floating-point conversion unit (fcvtfp)
|
||||||
|
cmp - test comparison unit's LT, LE, EQ opperations (fcmp)
|
||||||
|
add - test addition
|
||||||
|
fma - test fma
|
||||||
|
mul - test mult with fma
|
||||||
|
sub - test subtraction
|
||||||
|
div - test division
|
||||||
|
sqrt - test square root
|
||||||
|
all - test everything
|
||||||
|
|
||||||
|
4a.) Each test will test all its vectors - if you want to test a
|
||||||
|
subset of the vectors (e.g., only binary16), you should modify the
|
||||||
|
cvw/testbench/tests-fp.h and comment out the tests you do not want to
|
||||||
|
test. The best way to do this is to comment out each item out with
|
||||||
|
the // comment option in SV. For example,
|
||||||
|
|
||||||
|
string f128div[] = '{
|
||||||
|
// "f128_div_rne.tv",
|
||||||
|
// "f128_div_rz.tv",
|
||||||
|
// "f128_div_ru.tv",
|
||||||
|
// "f128_div_rd.tv",
|
||||||
|
// "f128_div_rnm.tv"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -113,8 +113,6 @@ module testbenchfp;
|
|||||||
|
|
||||||
`include "parameter-defs.vh"
|
`include "parameter-defs.vh"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// ||||||||| |||||||| ||||||| ||||||||| ||||||| |||||||| |||
|
// ||||||||| |||||||| ||||||| ||||||||| ||||||| |||||||| |||
|
||||||
@ -699,13 +697,13 @@ module testbenchfp;
|
|||||||
.PostProcFlg(Flg), .PostProcRes(FpRes), .FCvtIntRes(IntRes));
|
.PostProcFlg(Flg), .PostProcRes(FpRes), .FCvtIntRes(IntRes));
|
||||||
|
|
||||||
if (TEST === "cvtfp" | TEST === "cvtint" | TEST === "all") begin : fcvt
|
if (TEST === "cvtfp" | TEST === "cvtint" | TEST === "all") begin : fcvt
|
||||||
fcvt #(P) fcvt (.Xs(Xs), .Xe(Xe), .Xm(Xm), .Int(SrcA), .ToInt(WriteIntVal),
|
fcvt fcvt (.Xs(Xs), .Xe(Xe), .Xm(Xm), .Int(SrcA), .ToInt(WriteIntVal),
|
||||||
.XZero(XZero), .OpCtrl(OpCtrlVal), .IntZero,
|
.XZero(XZero), .OpCtrl(OpCtrlVal), .IntZero,
|
||||||
.Fmt(ModFmt), .Ce(CvtCalcExpE), .ShiftAmt(CvtShiftAmtE), .ResSubnormUf(CvtResSubnormUfE), .Cs(CvtResSgnE), .LzcIn(CvtLzcInE));
|
.Fmt(ModFmt), .Ce(CvtCalcExpE), .ShiftAmt(CvtShiftAmtE), .ResSubnormUf(CvtResSubnormUfE), .Cs(CvtResSgnE), .LzcIn(CvtLzcInE));
|
||||||
end
|
end
|
||||||
|
|
||||||
if (TEST === "cmp" | TEST === "all") begin: fcmp
|
if (TEST === "cmp" | TEST === "all") begin: fcmp
|
||||||
fcmp #(P) fcmp (.Fmt(ModFmt), .OpCtrl(OpCtrlVal), .Xs, .Ys, .Xe, .Ye,
|
fcmp fcmp (.Fmt(ModFmt), .OpCtrl(OpCtrlVal), .Xs, .Ys, .Xe, .Ye,
|
||||||
.Xm, .Ym, .XZero, .YZero, .CmpIntRes(CmpRes),
|
.Xm, .Ym, .XZero, .YZero, .CmpIntRes(CmpRes),
|
||||||
.XNaN, .YNaN, .XSNaN, .YSNaN, .X, .Y, .CmpNV(CmpFlg[4]), .CmpFpRes(FpCmpRes));
|
.XNaN, .YNaN, .XSNaN, .YSNaN, .X, .Y, .CmpNV(CmpFlg[4]), .CmpFpRes(FpCmpRes));
|
||||||
end
|
end
|
||||||
@ -892,13 +890,13 @@ always @(negedge clk) begin
|
|||||||
// check if result is correct
|
// check if result is correct
|
||||||
// - wait till the division result is done or one extra cylcle for early termination (to simulate the EM pipline stage)
|
// - wait till the division result is done or one extra cylcle for early termination (to simulate the EM pipline stage)
|
||||||
// if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&~((FDivBusyE===1'b1)|DivStart)&(UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT)) begin
|
// if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&~((FDivBusyE===1'b1)|DivStart)&(UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT)) begin
|
||||||
ResMatch = (Res === Ans | NaNGood | NaNGood === 1'bx);
|
assign ResMatch = (Res === Ans | NaNGood | NaNGood === 1'bx);
|
||||||
FlagMatch = (ResFlg === AnsFlg | AnsFlg === 5'bx);
|
assign FlagMatch = (ResFlg === AnsFlg | AnsFlg === 5'bx);
|
||||||
divsqrtop = OpCtrlVal == `SQRT_OPCTRL | OpCtrlVal == `DIV_OPCTRL;
|
assign divsqrtop = OpCtrlVal == `SQRT_OPCTRL | OpCtrlVal == `DIV_OPCTRL;
|
||||||
assign DivDone = OldFDivBusyE & ~FDivBusyE;
|
assign DivDone = OldFDivBusyE & ~FDivBusyE;
|
||||||
|
|
||||||
//assign divsqrtop = OpCtrl[TestNum] == `SQRT_OPCTRL | OpCtrl[TestNum] == `DIV_OPCTRL;
|
//assign divsqrtop = OpCtrl[TestNum] == `SQRT_OPCTRL | OpCtrl[TestNum] == `DIV_OPCTRL;
|
||||||
CheckNow = (DivDone | ~divsqrtop) & (UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT);
|
assign CheckNow = (DivDone | ~divsqrtop) & (UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT);
|
||||||
if(~(ResMatch & FlagMatch) & CheckNow) begin
|
if(~(ResMatch & FlagMatch) & CheckNow) begin
|
||||||
// if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&(DivDone | (TEST != "sqrt" & TEST != "div"))&(UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT)) begin
|
// if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&(DivDone | (TEST != "sqrt" & TEST != "div"))&(UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT)) begin
|
||||||
errors += 1;
|
errors += 1;
|
||||||
@ -986,6 +984,7 @@ module readvectors (
|
|||||||
output logic DivStart,
|
output logic DivStart,
|
||||||
output logic [`FLEN-1:0] X, Y, Z, XPostBox
|
output logic [`FLEN-1:0] X, Y, Z, XPostBox
|
||||||
);
|
);
|
||||||
|
|
||||||
logic XEn, YEn, ZEn;
|
logic XEn, YEn, ZEn;
|
||||||
|
|
||||||
`include "parameter-defs.vh"
|
`include "parameter-defs.vh"
|
||||||
@ -1346,7 +1345,6 @@ module readvectors (
|
|||||||
assign YEn = ~((Unit == `CVTINTUNIT)|(Unit == `CVTFPUNIT)|((Unit == `DIVUNIT)&OpCtrl[0]));
|
assign YEn = ~((Unit == `CVTINTUNIT)|(Unit == `CVTFPUNIT)|((Unit == `DIVUNIT)&OpCtrl[0]));
|
||||||
assign ZEn = (Unit == `FMAUNIT);
|
assign ZEn = (Unit == `FMAUNIT);
|
||||||
|
|
||||||
|
|
||||||
unpack #(P) unpack(.X, .Y, .Z, .Fmt(ModFmt), .Xs, .Ys, .Zs, .Xe, .Ye, .Ze,
|
unpack #(P) unpack(.X, .Y, .Z, .Fmt(ModFmt), .Xs, .Ys, .Zs, .Xe, .Ye, .Ze,
|
||||||
.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,
|
||||||
|
Loading…
Reference in New Issue
Block a user