mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Fixed checking termination in testfloat testbench
This commit is contained in:
parent
28db4fdc70
commit
e1760dde55
@ -101,7 +101,7 @@
|
|||||||
`define CORRSHIFTSZ ((`DIVRESLEN+`NF) > (3*`NF+8) ? (`DIVRESLEN+`NF) : (3*`NF+6))
|
`define CORRSHIFTSZ ((`DIVRESLEN+`NF) > (3*`NF+8) ? (`DIVRESLEN+`NF) : (3*`NF+6))
|
||||||
|
|
||||||
// division constants
|
// division constants
|
||||||
`define RADIX 32'h2
|
`define RADIX 32'h4
|
||||||
`define DIVCOPIES 32'h2
|
`define DIVCOPIES 32'h2
|
||||||
`define DIVLEN ((`NF < `XLEN) ? (`XLEN) : (`NF + 3))
|
`define DIVLEN ((`NF < `XLEN) ? (`XLEN) : (`NF + 3))
|
||||||
// `define DIVN (`NF < `XLEN ? `XLEN : `NF+1) // length of input
|
// `define DIVN (`NF < `XLEN ? `XLEN : `NF+1) // length of input
|
||||||
|
@ -34,7 +34,7 @@ vlib work
|
|||||||
# $num = the added words after the call
|
# $num = the added words after the call
|
||||||
vlog +incdir+../config/$1 +incdir+../config/shared ../testbench/testbench-fp.sv ../src/fpu/*.sv ../src/generic/*.sv ../src/generic/flop/*.sv -suppress 2583,7063,8607,2697
|
vlog +incdir+../config/$1 +incdir+../config/shared ../testbench/testbench-fp.sv ../src/fpu/*.sv ../src/generic/*.sv ../src/generic/flop/*.sv -suppress 2583,7063,8607,2697
|
||||||
|
|
||||||
vsim -voptargs=+acc work.testbenchfp -G TEST=$2
|
vsim -voptargs=+acc work.testbenchfp -G TEST=$2 -suppress 4014
|
||||||
|
|
||||||
view wave
|
view wave
|
||||||
#-- display input and output signals as hexidecimal values
|
#-- display input and output signals as hexidecimal values
|
||||||
|
@ -103,8 +103,8 @@ module fdivsqrtfsm(
|
|||||||
end
|
end
|
||||||
|
|
||||||
flopr #(1) WZeroReg(clk, reset | DivStart, WZero, WZeroDelayed);
|
flopr #(1) WZeroReg(clk, reset | DivStart, WZero, WZeroDelayed);
|
||||||
assign DivDone = (state == DONE);
|
// assign DivDone = (state == DONE);
|
||||||
// assign DivDone = (state == DONE) | (WZeroDelayed & (state == BUSY));
|
assign DivDone = (state == DONE) | (WZeroDelayed & (state == BUSY));
|
||||||
assign W = WC+WS;
|
assign W = WC+WS;
|
||||||
assign NegSticky = W[`DIVb+3];
|
assign NegSticky = W[`DIVb+3];
|
||||||
assign EarlyTermShiftE = step;
|
assign EarlyTermShiftE = step;
|
||||||
@ -123,8 +123,8 @@ module fdivsqrtfsm(
|
|||||||
if (StallM) state <= #1 DONE;
|
if (StallM) state <= #1 DONE;
|
||||||
else state <= #1 IDLE;
|
else state <= #1 IDLE;
|
||||||
end else if (state == BUSY) begin
|
end else if (state == BUSY) begin
|
||||||
if (step == 1 | WZero ) begin
|
// if (step == 1 | WZero ) begin
|
||||||
// if (step == 1 /* | WZero */) begin
|
if (step == 1 /* | WZero */) begin
|
||||||
state <= #1 DONE;
|
state <= #1 DONE;
|
||||||
end
|
end
|
||||||
step <= step - 1;
|
step <= step - 1;
|
||||||
|
@ -792,8 +792,9 @@ always_comb begin
|
|||||||
`CVTFPUNIT: ResFlg = Flg;
|
`CVTFPUNIT: ResFlg = Flg;
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
// check results on falling edge of clk
|
|
||||||
always @(negedge clk) begin
|
// check results on falling edge of clk
|
||||||
|
always @(negedge clk) begin
|
||||||
|
|
||||||
|
|
||||||
// check if the NaN value is good. IEEE754-2019 sections 6.3 and 6.2.3 specify:
|
// check if the NaN value is good. IEEE754-2019 sections 6.3 and 6.2.3 specify:
|
||||||
@ -860,10 +861,11 @@ end
|
|||||||
|
|
||||||
// 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))&~((DivBusy===1'b1)|DivStart)&(UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT)) begin
|
// if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&~((DivBusy===1'b1)|DivStart)&(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;
|
||||||
$display("There is an error in %s", Tests[TestNum]);
|
$display("Error in %s", Tests[TestNum]);
|
||||||
$display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Ans: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg);
|
$display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Expected: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg);
|
||||||
$stop;
|
$stop;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user