For radix 4 division, fixed initial C and then could remove unexplained shift from divshiftcalc

This commit is contained in:
David Harris 2022-09-21 13:30:35 -07:00
parent fce927810a
commit cfa83fdd98
2 changed files with 4 additions and 10 deletions

View File

@ -92,7 +92,7 @@ module fdivsqrtiter(
logic [1:0] initCSqrt, initCDiv2, initCDiv4, initCUpper;
assign initCSqrt = 2'b11;
assign initCDiv2 = 2'b10;
assign initCDiv4 = 2'b10; // *** not sure why this works; seems like it should be 00 for initializing to -4
assign initCDiv4 = 2'b00; // *** not sure why this works; seems like it should be 00 for initializing to -4
assign initCUpper = SqrtE ? initCSqrt : (`RADIX == 4) ? initCDiv4 : initCDiv2;
assign initC = {initCUpper, {`DIVb{1'b0}}};

View File

@ -42,11 +42,8 @@ module divshiftcalc(
);
logic [`LOGNORMSHIFTSZ-1:0] NormShift, DivDenormShiftAmt;
logic [`NE+1:0] DivDenormShift;
logic [`NORMSHIFTSZ-1:0] PreDivShiftIn;
logic [`DURLEN-1:0] DivEarlyTermShift = 0;
// is the result denromalized
// is the result denormalized
// if the exponent is 1 then the result needs to be normalized then the result is denormalizes
assign DivResDenorm = DivQe[`NE+1]|(~|DivQe[`NE+1:0]);
@ -74,8 +71,5 @@ module divshiftcalc(
assign DivDenormShiftAmt = DivDenormShiftPos ? DivDenormShift[`LOGNORMSHIFTSZ-1:0] : '0;
assign DivShiftAmt = DivResDenorm ? DivDenormShiftAmt : NormShift;
// *** explain why radix 4 division needs a left shift by 1
// *** can this shift be moved into the shiftcorrection logic?
assign PreDivShiftIn = {{`NF{1'b0}}, DivQm, {`NORMSHIFTSZ-`DIVb+1-`NF{1'b0}}};
assign DivShiftIn = PreDivShiftIn << (`RADIX==4 & ~Sqrt);
assign DivShiftIn = {{`NF{1'b0}}, DivQm, {`NORMSHIFTSZ-`DIVb+1-`NF{1'b0}}};
endmodule