mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
continued cleanup
This commit is contained in:
parent
33c0f64457
commit
86107e6136
@ -58,7 +58,7 @@ module fdivsqrtpreproc (
|
|||||||
logic [`DIVBLEN:0] mE, nE, ell; // Leading zeros of inputs
|
logic [`DIVBLEN:0] mE, nE, ell; // Leading zeros of inputs
|
||||||
logic NumerZeroE; // Numerator is zero (X or A)
|
logic NumerZeroE; // Numerator is zero (X or A)
|
||||||
logic AZeroE, BZeroE; // A or B is Zero for integer division
|
logic AZeroE, BZeroE; // A or B is Zero for integer division
|
||||||
logic signedDiv; // signed division
|
logic SignedDivE; // signed division
|
||||||
logic NegQuotE; // Integer quotient is negative
|
logic NegQuotE; // Integer quotient is negative
|
||||||
logic AsE, BsE; // Signs of integer inputs
|
logic AsE, BsE; // Signs of integer inputs
|
||||||
logic [`XLEN-1:0] AE; // input A after W64 adjustment
|
logic [`XLEN-1:0] AE; // input A after W64 adjustment
|
||||||
@ -72,20 +72,20 @@ module fdivsqrtpreproc (
|
|||||||
logic [`XLEN-1:0] BE, PosA, PosB;
|
logic [`XLEN-1:0] BE, PosA, PosB;
|
||||||
|
|
||||||
// Extract inputs, signs, zero, depending on W64 mode if applicable
|
// Extract inputs, signs, zero, depending on W64 mode if applicable
|
||||||
assign signedDiv = ~Funct3E[0];
|
assign SignedDivE = ~Funct3E[0];
|
||||||
|
|
||||||
// Source handling
|
// Source handling
|
||||||
if (`XLEN==64) begin // 64-bit, supports W64
|
if (`XLEN==64) begin // 64-bit, supports W64
|
||||||
mux2 #(64) amux(ForwardedSrcAE, {{32{ForwardedSrcAE[31] & signedDiv}}, ForwardedSrcAE[31:0]}, W64E, AE);
|
mux2 #(64) amux(ForwardedSrcAE, {{32{ForwardedSrcAE[31] & SignedDivE}}, ForwardedSrcAE[31:0]}, W64E, AE);
|
||||||
mux2 #(64) bmux(ForwardedSrcBE, {{32{ForwardedSrcBE[31] & signedDiv}}, ForwardedSrcBE[31:0]}, W64E, BE);
|
mux2 #(64) bmux(ForwardedSrcBE, {{32{ForwardedSrcBE[31] & SignedDivE}}, ForwardedSrcBE[31:0]}, W64E, BE);
|
||||||
end else begin // 32 bits only
|
end else begin // 32 bits only
|
||||||
assign AE = ForwardedSrcAE;
|
assign AE = ForwardedSrcAE;
|
||||||
assign BE = ForwardedSrcBE;
|
assign BE = ForwardedSrcBE;
|
||||||
end
|
end
|
||||||
assign AZeroE = ~(|AE);
|
assign AZeroE = ~(|AE);
|
||||||
assign BZeroE = ~(|BE);
|
assign BZeroE = ~(|BE);
|
||||||
assign AsE = AE[`XLEN-1] & signedDiv;
|
assign AsE = AE[`XLEN-1] & SignedDivE;
|
||||||
assign BsE = BE[`XLEN-1] & signedDiv;
|
assign BsE = BE[`XLEN-1] & SignedDivE;
|
||||||
assign NegQuotE = AsE ^ BsE; // Integer Quotient is negative
|
assign NegQuotE = AsE ^ BsE; // Integer Quotient is negative
|
||||||
|
|
||||||
// Force integer inputs to be postiive
|
// Force integer inputs to be postiive
|
||||||
@ -162,10 +162,10 @@ module fdivsqrtpreproc (
|
|||||||
// Denormalized numbers have Xe = 0 and an unbiased exponent of 1-BIAS. They are shifted right if the number of leading zeros is odd.
|
// Denormalized numbers have Xe = 0 and an unbiased exponent of 1-BIAS. They are shifted right if the number of leading zeros is odd.
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
|
|
||||||
mux2 #(`DIVb+1) sqrtxmux({~XZeroE, XPreproc}, {1'b0, ~XZeroE, XPreproc[`DIVb-1:1]}, (Xe[0] ^ ell[0]), PreSqrtX);
|
|
||||||
assign DivX = {3'b000, ~NumerZeroE, XPreproc};
|
assign DivX = {3'b000, ~NumerZeroE, XPreproc};
|
||||||
|
|
||||||
// Sqrt is initialized on step one as R(X-1), so depends on Radix
|
// Sqrt is initialized on step one as R(X-1), so depends on Radix
|
||||||
|
mux2 #(`DIVb+1) sqrtxmux({~XZeroE, XPreproc}, {1'b0, ~XZeroE, XPreproc[`DIVb-1:1]}, (Xe[0] ^ ell[0]), PreSqrtX);
|
||||||
if (`RADIX == 2) assign SqrtX = {3'b111, PreSqrtX};
|
if (`RADIX == 2) assign SqrtX = {3'b111, PreSqrtX};
|
||||||
else assign SqrtX = {2'b11, PreSqrtX, 1'b0};
|
else assign SqrtX = {2'b11, PreSqrtX, 1'b0};
|
||||||
mux2 #(`DIVb+4) prexmux(DivX, SqrtX, SqrtE, PreShiftX);
|
mux2 #(`DIVb+4) prexmux(DivX, SqrtX, SqrtE, PreShiftX);
|
||||||
|
Loading…
Reference in New Issue
Block a user