mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
simplified sign handling mux
This commit is contained in:
parent
ba976d66e4
commit
61230c967c
@ -52,9 +52,6 @@ module fdivsqrtpostproc(
|
|||||||
logic [`DIVb:0] PreQmM;
|
logic [`DIVb:0] PreQmM;
|
||||||
logic NegStickyM;
|
logic NegStickyM;
|
||||||
logic weq0E, weq0M, WZeroM;
|
logic weq0E, weq0M, WZeroM;
|
||||||
logic [`DIVBLEN:0] NormShiftM;
|
|
||||||
logic [`DIVb:0] NormQuotM;
|
|
||||||
logic [`DIVb+3:0] IntQuotM, IntRemM, NormRemM;
|
|
||||||
logic signed [`DIVb+3:0] PreResultM, PreFPIntDivResultM;
|
logic signed [`DIVb+3:0] PreResultM, PreFPIntDivResultM;
|
||||||
logic [`XLEN-1:0] SpecialFPIntDivResultM;
|
logic [`XLEN-1:0] SpecialFPIntDivResultM;
|
||||||
|
|
||||||
@ -104,27 +101,17 @@ module fdivsqrtpostproc(
|
|||||||
assign QmM = SqrtM ? (PreQmM << 1) : PreQmM;
|
assign QmM = SqrtM ? (PreQmM << 1) : PreQmM;
|
||||||
|
|
||||||
if (`IDIV_ON_FPU) begin
|
if (`IDIV_ON_FPU) begin
|
||||||
|
logic [`DIVBLEN:0] NormShiftM;
|
||||||
|
logic [`DIVb:0] NormQuotM;
|
||||||
|
logic [`DIVb+3:0] IntQuotM, IntRemM, NormRemM, NormRemDM;
|
||||||
|
|
||||||
assign W = $signed(Sum) >>> `LOGR;
|
assign W = $signed(Sum) >>> `LOGR;
|
||||||
assign DM = {4'b0001, D};
|
assign DM = {4'b0001, D};
|
||||||
|
|
||||||
// Integer division: sign handling for div and rem
|
// Integer division: sign handling for div and rem
|
||||||
always_comb
|
mux2 #(`DIVb+1) normquotmux(FirstU, FirstUM, NegStickyM, NormQuotM);
|
||||||
if (~AsM)
|
mux2 #(`DIVb+4) normremdmux(W, W+DM, NegStickyM, NormRemDM);
|
||||||
if (NegStickyM) begin
|
mux2 #(`DIVb+4) normremsmux(NormRemDM, -NormRemDM, AsM, NormRemM);
|
||||||
NormQuotM = FirstUM;
|
|
||||||
NormRemM = W + DM;
|
|
||||||
end else begin
|
|
||||||
NormQuotM = FirstU;
|
|
||||||
NormRemM = W;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if (NegStickyM) begin
|
|
||||||
NormQuotM = FirstUM;
|
|
||||||
NormRemM = -(W + DM);
|
|
||||||
end else begin
|
|
||||||
NormQuotM = FirstU;
|
|
||||||
NormRemM = -W;
|
|
||||||
end
|
|
||||||
|
|
||||||
// Integer division: Special cases
|
// Integer division: Special cases
|
||||||
always_comb
|
always_comb
|
||||||
|
Loading…
Reference in New Issue
Block a user