various formatting fixes and comments

This commit is contained in:
Cedar Turek 2022-12-30 18:41:40 -08:00
parent 286e43807a
commit fb9a0c797f
12 changed files with 30 additions and 30 deletions

View File

@ -69,8 +69,8 @@ module fdivsqrtexpcalc(
end end
assign SXExp = {2'b0, Xe} - {{(`NE+1-`DIVBLEN){1'b0}}, ell} - (`NE+2)'(`BIAS); assign SXExp = {2'b0, Xe} - {{(`NE+1-`DIVBLEN){1'b0}}, ell} - (`NE+2)'(`BIAS);
assign SExp = {SXExp[`NE+1], SXExp[`NE+1:1]} + {2'b0, Bias}; assign SExp = {SXExp[`NE+1], SXExp[`NE+1:1]} + {2'b0, Bias};
// correct exponent for denormalized input's normalization shifts // correct exponent for denormalized input's normalization shifts
assign DExp = ({2'b0, Xe} - {{(`NE+1-`DIVBLEN){1'b0}}, ell} - {2'b0, Ye} + {{(`NE+1-`DIVBLEN){1'b0}}, m} + {3'b0, Bias}) & {`NE+2{~XZero}}; assign DExp = ({2'b0, Xe} - {{(`NE+1-`DIVBLEN){1'b0}}, ell} - {2'b0, Ye} + {{(`NE+1-`DIVBLEN){1'b0}}, m} + {3'b0, Bias}) & {`NE+2{~XZero}};
assign Qe = Sqrt ? SExp : DExp; assign Qe = Sqrt ? SExp : DExp;
endmodule endmodule

View File

@ -42,10 +42,9 @@ module fdivsqrtfgen4 (
assign F1 = ~(U << 1) & C; assign F1 = ~(U << 1) & C;
assign F0 = '0; assign F0 = '0;
assign FN1 = (UM << 1) | (C & ~(C << 3)); assign FN1 = (UM << 1) | (C & ~(C << 3));
assign FN2 = (UM << 2) | ((C << 2)&~(C << 4)); assign FN2 = (UM << 2) | ((C << 2) & ~(C << 4));
// Choose which adder input will be used // Choose which adder input will be used
always_comb always_comb
if (udigit[3]) F = F2; if (udigit[3]) F = F2;
else if (udigit[2]) F = F1; else if (udigit[2]) F = F1;

View File

@ -96,7 +96,7 @@ module fdivsqrtpostproc(
// Determine if sticky bit is negative // *** look for ways to optimize this. Shift shouldn't be needed. // Determine if sticky bit is negative // *** look for ways to optimize this. Shift shouldn't be needed.
assign Sum = WC + WS; assign Sum = WC + WS;
assign NegStickyM = Sum[`DIVb+3]; assign NegStickyM = Sum[`DIVb+3];
mux2 #(`DIVb+1) preqmmux(FirstU, FirstUM, NegStickyM, PreQmM);// Select U or U-1 depending on negative sticky bit mux2 #(`DIVb+1) preqmmux(FirstU, FirstUM, NegStickyM, PreQmM); // Select U or U-1 depending on negative sticky bit
mux2 #(`DIVb+1) qmmux(PreQmM, (PreQmM << 1), SqrtM, QmM); mux2 #(`DIVb+1) qmmux(PreQmM, (PreQmM << 1), SqrtM, QmM);
if (`IDIV_ON_FPU) begin // Int supported if (`IDIV_ON_FPU) begin // Int supported

View File

@ -68,6 +68,9 @@ module fdivsqrtpreproc (
// 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 signedDiv = ~Funct3E[0];
assign NegQuotE = AsE ^ BsE; // Quotient is negative
// Source handling
if (`XLEN==64) begin // 64-bit, supports W64 if (`XLEN==64) begin // 64-bit, supports W64
mux2 #(1) azeromux(~(|ForwardedSrcAE), ~(|ForwardedSrcAE[31:0]), W64E, AZeroE); mux2 #(1) azeromux(~(|ForwardedSrcAE), ~(|ForwardedSrcAE[31:0]), W64E, AZeroE);
mux2 #(1) bzeromux(~(|ForwardedSrcBE), ~(|ForwardedSrcBE[31:0]), W64E, BZeroE); mux2 #(1) bzeromux(~(|ForwardedSrcBE), ~(|ForwardedSrcBE[31:0]), W64E, BZeroE);
@ -86,9 +89,6 @@ module fdivsqrtpreproc (
assign BZeroE = ~(|ForwardedSrcBE); assign BZeroE = ~(|ForwardedSrcBE);
end end
// Quotient is negative
assign NegQuotE = AsE ^ BsE;
// Force integer inputs to be postiive // Force integer inputs to be postiive
mux2 #(`XLEN) posamux(AE, -AE, AsE, PosA); mux2 #(`XLEN) posamux(AE, -AE, AsE, PosA);
mux2 #(`XLEN) posbmux(BE, -BE, BsE, PosB); mux2 #(`XLEN) posbmux(BE, -BE, BsE, PosB);

View File

@ -1,7 +1,7 @@
/////////////////////////////////////////// ///////////////////////////////////////////
// fdivsqrtstage2.sv // fdivsqrtstage2.sv
// //
// Written: David_Harris@hmc.edu, me@KatherineParry.com, Cedar Turek // Written: David_Harris@hmc.edu, me@KatherineParry.com, cturek@hmc.edu
// Modified:13 January 2022 // Modified:13 January 2022
// //
// Purpose: Combined Divide and Square Root Floating Point and Integer Unit stage // Purpose: Combined Divide and Square Root Floating Point and Integer Unit stage
@ -67,12 +67,13 @@ module fdivsqrtstage2 (
// Divisor multiple // Divisor multiple
always_comb always_comb
if (up) Dsel = DBar; if (up) Dsel = DBar;
else if (uz) Dsel = '0; // qz else if (uz) Dsel = '0;
else Dsel = {3'b000, 1'b1, D}; // un else Dsel = {3'b000, 1'b1, D}; // un
// Partial Product Generation // Partial Product Generation
// WSA, WCA = WS + WC - qD // WSA, WCA = WS + WC - qD
assign AddIn = SqrtE ? F : Dsel; mux2 #(`DIVb+4) addinmux(F, Dsel, SqrtE, AddIn);
//assign AddIn = SqrtE ? F : Dsel;
csa #(`DIVb+4) csa(WS, WC, AddIn, up&~SqrtE, WSA, WCA); csa #(`DIVb+4) csa(WS, WC, AddIn, up&~SqrtE, WSA, WCA);
assign WSNext = WSA << 1; assign WSNext = WSA << 1;
assign WCNext = WCA << 1; assign WCNext = WCA << 1;

View File

@ -1,7 +1,7 @@
/////////////////////////////////////////// ///////////////////////////////////////////
// fdivsqrtstage4.sv // fdivsqrtstage4.sv
// //
// Written: David_Harris@hmc.edu, me@KatherineParry.com, Cedar Turek // Written: David_Harris@hmc.edu, me@KatherineParry.com, cturek@hmc.edu
// Modified:13 January 2022 // Modified:13 January 2022
// //
// Purpose: Combined Divide and Square Root Floating Point and Integer Unit stage // Purpose: Combined Divide and Square Root Floating Point and Integer Unit stage

View File

@ -43,7 +43,7 @@ module fdivsqrtuotfc2(
// bits to the quotient as they come. // bits to the quotient as they come.
logic [`DIVb:0] K; logic [`DIVb:0] K;
assign K = (C[`DIVb:0] & ~(C[`DIVb:0] << 1)); assign K = (C[`DIVb:0] & ~(C[`DIVb:0] << 1)); // Thermometer to one hot encoding
always_comb begin always_comb begin
if (up) begin if (up) begin