mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Fixed formatting
This commit is contained in:
parent
7e237858a0
commit
acbbe7941a
@ -108,7 +108,6 @@ module round import cvw::*; #(parameter cvw_t P) (
|
|||||||
// 11 - do nothing if a small number was supposed to subtracted (the sticky bit was set by the small number)
|
// 11 - do nothing if a small number was supposed to subtracted (the sticky bit was set by the small number)
|
||||||
// - Plus 1 otherwise
|
// - Plus 1 otherwise
|
||||||
|
|
||||||
|
|
||||||
// determine what format the final result is in: int or fp
|
// determine what format the final result is in: int or fp
|
||||||
assign IntRes = ToInt;
|
assign IntRes = ToInt;
|
||||||
assign FpRes = ~IntRes;
|
assign FpRes = ~IntRes;
|
||||||
@ -179,15 +178,10 @@ module round import cvw::*; #(parameter cvw_t P) (
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// only add the Addend sticky if doing an FMA opperation
|
// only add the Addend sticky if doing an FMA opperation
|
||||||
// - the shifter shifts too far left when there's an underflow (shifting out all possible sticky bits)
|
// - the shifter shifts too far left when there's an underflow (shifting out all possible sticky bits)
|
||||||
assign Sticky = FmaASticky&FmaOp | NormSticky | CvtResUf&CvtOp | FmaMe[P.NE+1]&FmaOp | DivSticky&DivOp;
|
assign Sticky = FmaASticky&FmaOp | NormSticky | CvtResUf&CvtOp | FmaMe[P.NE+1]&FmaOp | DivSticky&DivOp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// determine round and LSB of the rounded value
|
// determine round and LSB of the rounded value
|
||||||
// - underflow round bit is used to determint the underflow flag
|
// - underflow round bit is used to determint the underflow flag
|
||||||
if (P.FPSIZES == 1) begin
|
if (P.FPSIZES == 1) begin
|
||||||
@ -254,7 +248,6 @@ module round import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign LsbRes = ToInt&CvtOp ? Mf[P.CORRSHIFTSZ-P.XLEN] : FpLsbRes;
|
assign LsbRes = ToInt&CvtOp ? Mf[P.CORRSHIFTSZ-P.XLEN] : FpLsbRes;
|
||||||
assign Round = ToInt&CvtOp ? Mf[P.CORRSHIFTSZ-P.XLEN-2] : FpRound;
|
assign Round = ToInt&CvtOp ? Mf[P.CORRSHIFTSZ-P.XLEN-2] : FpRound;
|
||||||
|
|
||||||
|
|
||||||
always_comb begin
|
always_comb begin
|
||||||
// Determine if you add 1
|
// Determine if you add 1
|
||||||
case (Frm)
|
case (Frm)
|
||||||
@ -282,9 +275,6 @@ module round import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign FpPlus1 = Plus1&~(ToInt&CvtOp);
|
assign FpPlus1 = Plus1&~(ToInt&CvtOp);
|
||||||
assign UfPlus1 = UfCalcPlus1 & (Sticky|Round);
|
assign UfPlus1 = UfCalcPlus1 & (Sticky|Round);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// place Plus1 into the proper position for the format
|
// place Plus1 into the proper position for the format
|
||||||
if (P.FPSIZES == 1) begin
|
if (P.FPSIZES == 1) begin
|
||||||
assign RoundAdd = {{P.FLEN{1'b0}}, FpPlus1};
|
assign RoundAdd = {{P.FLEN{1'b0}}, FpPlus1};
|
||||||
@ -302,13 +292,9 @@ module round import cvw::*; #(parameter cvw_t P) (
|
|||||||
end else if (P.FPSIZES == 4)
|
end else if (P.FPSIZES == 4)
|
||||||
assign RoundAdd = {(P.Q_NE+1+P.H_NF)'(0), FpPlus1&(OutFmt==P.H_FMT), (P.S_NF-P.H_NF-1)'(0), FpPlus1&(OutFmt==P.S_FMT), (P.D_NF-P.S_NF-1)'(0), FpPlus1&(OutFmt==P.D_FMT), (P.Q_NF-P.D_NF-1)'(0), FpPlus1&(OutFmt==P.Q_FMT)};
|
assign RoundAdd = {(P.Q_NE+1+P.H_NF)'(0), FpPlus1&(OutFmt==P.H_FMT), (P.S_NF-P.H_NF-1)'(0), FpPlus1&(OutFmt==P.S_FMT), (P.D_NF-P.S_NF-1)'(0), FpPlus1&(OutFmt==P.D_FMT), (P.Q_NF-P.D_NF-1)'(0), FpPlus1&(OutFmt==P.Q_FMT)};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// trim unneeded bits from fraction
|
// trim unneeded bits from fraction
|
||||||
assign RoundFrac = Mf[P.CORRSHIFTSZ-1:P.CORRSHIFTSZ-P.NF];
|
assign RoundFrac = Mf[P.CORRSHIFTSZ-1:P.CORRSHIFTSZ-P.NF];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// select the exponent
|
// select the exponent
|
||||||
always_comb
|
always_comb
|
||||||
case(PostProcSel)
|
case(PostProcSel)
|
||||||
@ -326,5 +312,4 @@ module round import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign {FullRe, Rf} = {Me, RoundFrac} + RoundAdd;
|
assign {FullRe, Rf} = {Me, RoundFrac} + RoundAdd;
|
||||||
assign Re = FullRe[P.NE-1:0];
|
assign Re = FullRe[P.NE-1:0];
|
||||||
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user