Line 1... |
Line 1... |
// ============================================================================
|
// ============================================================================
|
// __
|
// __
|
// \\__/ o\ (C) 2020-2021 Robert Finch, Waterloo
|
// \\__/ o\ (C) 2020-2022 Robert Finch, Waterloo
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch@finitron.ca
|
// \/_// robfinch@finitron.ca
|
// ||
|
// ||
|
//
|
//
|
// DFPAddsub.sv
|
// DFPAddsub.sv
|
Line 44... |
Line 44... |
input op;
|
input op;
|
input DFP128 a;
|
input DFP128 a;
|
input DFP128 b;
|
input DFP128 b;
|
output DFP128UD o;
|
output DFP128UD o;
|
localparam N=34; // number of BCD digits
|
localparam N=34; // number of BCD digits
|
|
localparam RIP_STAGES = 3;
|
|
|
parameter TRUE = 1'b1;
|
parameter TRUE = 1'b1;
|
parameter FALSE = 1'b0;
|
parameter FALSE = 1'b0;
|
|
|
DFP128U au;
|
DFP128U au;
|
DFP128U bu;
|
DFP128U bu;
|
wire sa, sb;
|
|
wire sxa, sxb;
|
|
wire adn, bdn;
|
|
wire xainf, xbinf;
|
|
wire ainf, binf;
|
|
wire aNan, bNan;
|
|
wire [13:0] xa, xb;
|
|
wire [N*4-1:0] siga, sigb;
|
|
|
|
DFPUnpack128 u00 (a, au);
|
DFPUnpack128 u00 (a, au);
|
DFPUnpack128 u01 (b, bu);
|
DFPUnpack128 u01 (b, bu);
|
|
|
|
reg [(N+1)*4-1:0] oaa10;
|
|
reg [(N+1)*4-1:0] obb10;
|
wire [(N+1)*4-1:0] oss10;
|
wire [(N+1)*4-1:0] oss10;
|
wire oss10c;
|
wire oss10c;
|
|
|
BCDAddN #(.N(N+1)) ubcdan1
|
BCDAdd8NClk #(.N((N+2)/2)) ubcdadn1
|
(
|
(
|
.ci(1'b0),
|
.clk(clk),
|
.a(oaa10),
|
.a({8'h00,oaa10}),
|
.b(obb10),
|
.b({8'h00,obb10}),
|
.o(oss10),
|
.o(oss10),
|
|
.ci(1'b0),
|
.co(oss10c)
|
.co(oss10c)
|
);
|
);
|
|
|
wire [(N+1)*4-1:0] odd10;
|
wire [(N+1)*4-1:0] odd10;
|
wire odd10c;
|
wire odd10c;
|
|
|
BCDSubN #(.N(N+1)) ubcdsn1
|
BCDSub8NClk #(.N((N+2)/2)) ubcdsdn1
|
(
|
(
|
.ci(1'b0),
|
.clk(clk),
|
.a(oaa10),
|
.a({8'h00,oaa10}),
|
.b(obb10),
|
.b({8'h00,obb10}),
|
.o(odd10),
|
.o(odd10),
|
|
.ci(1'b0),
|
.co(odd10c)
|
.co(odd10c)
|
);
|
);
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #1
|
// Clock #1
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg op1;
|
reg op1;
|
reg az, bz;
|
reg az, bz;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
op1 <= op;
|
op1 <= op;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
az <= au.sig==136'd0 && au.exp==14'd0;
|
az <= au.sig==136'd0 && au.exp==14'd0;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
bz <= bu.sig==136'd0 && bu.exp==14'd0;
|
bz <= bu.sig==136'd0 && bu.exp==14'd0;
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #2
|
// Clock #2
|
//
|
//
|
Line 124... |
Line 121... |
reg sigeq, siga_gt_sigb;
|
reg sigeq, siga_gt_sigb;
|
reg xa_gt_xb2;
|
reg xa_gt_xb2;
|
reg expeq;
|
reg expeq;
|
reg sxo2;
|
reg sxo2;
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) realOp2 = op1 ^ au.sign ^ bu.sign;
|
if (ce) realOp2 = op1 ^ au.sign ^ bu.sign;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) op2 <= op1;
|
if (ce) op2 <= op1;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xa2 <= au.exp;
|
if (ce) xa2 <= au.exp;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xb2 <= bu.exp;
|
if (ce) xb2 <= bu.exp;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) siga2 <= au.sig;
|
if (ce) siga2 <= au.sig;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) sigb2 <= bu.sig;
|
if (ce) sigb2 <= bu.sig;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) az2 <= az;
|
if (ce) az2 <= az;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) bz2 <= bz;
|
if (ce) bz2 <= bz;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce)
|
if (ce)
|
xa_gt_xb2 <= au.exp > bu.exp;
|
xa_gt_xb2 <= au.exp > bu.exp;
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) sigeq <= au.sig==bu.sig;
|
if (ce) sigeq <= au.sig==bu.sig;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) siga_gt_sigb <= au.sig > bu.sig;
|
if (ce) siga_gt_sigb <= au.sig > bu.sig;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) expeq <= au.exp==bu.exp;
|
if (ce) expeq <= au.exp==bu.exp;
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #3
|
// Clock #3
|
//
|
//
|
Line 168... |
Line 165... |
reg op3;
|
reg op3;
|
wire sa3, sb3;
|
wire sa3, sb3;
|
wire [2:0] rm3;
|
wire [2:0] rm3;
|
reg [N*4-1:0] mfs3;
|
reg [N*4-1:0] mfs3;
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) resZero3 <= (realOp2 & expeq & sigeq) || // subtract, same magnitude
|
if (ce) resZero3 <= (realOp2 & expeq & sigeq) || // subtract, same magnitude
|
(az2 & bz2); // both a,b zero
|
(az2 & bz2); // both a,b zero
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xa3 <= xa2;
|
if (ce) xa3 <= xa2;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xb3 <= xb2;
|
if (ce) xb3 <= xb2;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xa_gt_xb3 <= xa_gt_xb2;
|
if (ce) xa_gt_xb3 <= xa_gt_xb2;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) a_gt_b3 <= xa_gt_xb2 | (expeq & siga_gt_sigb);
|
if (ce) a_gt_b3 <= xa_gt_xb2 | (expeq & siga_gt_sigb);
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) op3 <= op2;
|
if (ce) op3 <= op2;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) mfs3 = xa_gt_xb2 ? sigb2 : siga2;
|
if (ce) mfs3 = xa_gt_xb2 ? sigb2 : siga2;
|
|
|
delay #(.WID(1), .DEP(2)) udly3c (.clk(clk), .ce(ce), .i(au.sign), .o(sa3));
|
ft_delay #(.WID(1), .DEP(2)) udly3c (.clk(clk), .ce(ce), .i(au.sign), .o(sa3));
|
delay #(.WID(1), .DEP(2)) udly3d (.clk(clk), .ce(ce), .i(bu.sign), .o(sb3));
|
ft_delay #(.WID(1), .DEP(2)) udly3d (.clk(clk), .ce(ce), .i(bu.sign), .o(sb3));
|
delay #(.WID(3), .DEP(3)) udly3e (.clk(clk), .ce(ce), .i(rm), .o(rm3));
|
ft_delay #(.WID(3), .DEP(3)) udly3e (.clk(clk), .ce(ce), .i(rm), .o(rm3));
|
delay #(.WID(1), .DEP(2)) udly3f (.clk(clk), .ce(ce), .i(aInf), .o(aInf3));
|
ft_delay #(.WID(1), .DEP(2)) udly3f (.clk(clk), .ce(ce), .i(aInf), .o(aInf3));
|
delay #(.WID(1), .DEP(2)) udly3g (.clk(clk), .ce(ce), .i(bInf), .o(bInf3));
|
ft_delay #(.WID(1), .DEP(2)) udly3g (.clk(clk), .ce(ce), .i(bInf), .o(bInf3));
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #4
|
// Clock #4
|
//
|
//
|
// Compute output exponent
|
// Compute output exponent
|
Line 205... |
Line 202... |
|
|
reg [13:0] xa4, xb4;
|
reg [13:0] xa4, xb4;
|
reg [13:0] xo4;
|
reg [13:0] xo4;
|
reg xa_gt_xb4;
|
reg xa_gt_xb4;
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xa4 <= xa3;
|
if (ce) xa4 <= xa3;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xb4 <= xb3;
|
if (ce) xb4 <= xb3;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xo4 <= resZero3 ? 14'd0 : xa_gt_xb3 ? xa3 : xb3;
|
if (ce) xo4 <= resZero3 ? 14'd0 : xa_gt_xb3 ? xa3 : xb3;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xa_gt_xb4 <= xa_gt_xb3;
|
if (ce) xa_gt_xb4 <= xa_gt_xb3;
|
|
|
// Compute output sign
|
// Compute output sign
|
reg so4;
|
reg so4;
|
always @*
|
always_comb
|
case ({resZero3,sa3,op3,sb3}) // synopsys full_case parallel_case
|
case ({resZero3,sa3,op3,sb3}) // synopsys full_case parallel_case
|
4'b0000: so4 <= 0; // + + + = +
|
4'b0000: so4 <= 0; // + + + = +
|
4'b0001: so4 <= !a_gt_b3; // + + - = sign of larger
|
4'b0001: so4 <= !a_gt_b3; // + + - = sign of larger
|
4'b0010: so4 <= !a_gt_b3; // + - + = sign of larger
|
4'b0010: so4 <= !a_gt_b3; // + - + = sign of larger
|
4'b0011: so4 <= 0; // + - - = +
|
4'b0011: so4 <= 0; // + - - = +
|
Line 242... |
Line 239... |
// Clock #5
|
// Clock #5
|
//
|
//
|
// Compute the difference in exponents, provides shift amount
|
// Compute the difference in exponents, provides shift amount
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg [13:0] xdiff5;
|
reg [13:0] xdiff5;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xdiff5 <= xa_gt_xb4 ? xa4 - xb4 : xb4 - xa4;
|
if (ce) xdiff5 <= xa_gt_xb4 ? xa4 - xb4 : xb4 - xa4;
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #6
|
// Clock #6
|
//
|
//
|
Line 255... |
Line 252... |
// If the difference in the exponent is 24 or greater (assuming 24 nybble dfp or
|
// If the difference in the exponent is 24 or greater (assuming 24 nybble dfp or
|
// less) then all of the bits will be shifted out to zero. There is no need to
|
// less) then all of the bits will be shifted out to zero. There is no need to
|
// keep track of a difference more than 24.
|
// keep track of a difference more than 24.
|
reg [6:0] xdif6;
|
reg [6:0] xdif6;
|
wire [N*4-1:0] mfs6;
|
wire [N*4-1:0] mfs6;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) xdif6 <= xdiff5 > N ? N : xdiff5[6:0];
|
if (ce) xdif6 <= xdiff5 > N ? N : xdiff5[6:0];
|
delay #(.WID(N*4), .DEP(3)) udly6a (.clk(clk), .ce(ce), .i(mfs3), .o(mfs6));
|
ft_delay #(.WID(N*4), .DEP(3)) udly6a (.clk(clk), .ce(ce), .i(mfs3), .o(mfs6));
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #7
|
// Clock #7
|
//
|
//
|
// Determine the sticky bit. The sticky bit is the bitwise or of all the bits
|
// Determine the sticky bit. The sticky bit is the bitwise or of all the bits
|
Line 272... |
Line 269... |
wire sticky7;
|
wire sticky7;
|
wire [7:0] xdif7;
|
wire [7:0] xdif7;
|
wire [N*4-1:0] mfs7;
|
wire [N*4-1:0] mfs7;
|
wire [8:0] xdif6a = {xdif6,2'b00}; // *4
|
wire [8:0] xdif6a = {xdif6,2'b00}; // *4
|
integer n;
|
integer n;
|
always @* begin
|
always @*
|
|
begin
|
sticky6 = 1'b0;
|
sticky6 = 1'b0;
|
for (n = 0; n < N*4; n = n + 4)
|
for (n = 0; n < N*4; n = n + 4)
|
if (n <= xdif6a)
|
if (n <= xdif6a)
|
sticky6 = sticky6| mfs6[n]|mfs6[n+1]|mfs6[n+2]|mfs6[n+3]; // non-zero nybble
|
sticky6 = sticky6| mfs6[n]|mfs6[n+1]|mfs6[n+2]|mfs6[n+3]; // non-zero nybble
|
end
|
end
|
Line 291... |
Line 289... |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg [(N+1)*4-1:0] md8;
|
reg [(N+1)*4-1:0] md8;
|
wire [N*4-1:0] siga8, sigb8;
|
wire [N*4-1:0] siga8, sigb8;
|
wire xa_gt_xb8;
|
wire xa_gt_xb8;
|
wire a_gt_b8;
|
wire a_gt_b8;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) md8 <= ({mfs7,4'b0} >> xdif7)|sticky7; // xdif7 is a multiple of four
|
if (ce) md8 <= ({mfs7,4'b0} >> xdif7)|sticky7; // xdif7 is a multiple of four
|
|
|
// sync control signals
|
// sync control signals
|
delay #(.WID(1), .DEP(4)) udly8a (.clk(clk), .ce(ce), .i(xa_gt_xb4), .o(xa_gt_xb8));
|
ft_delay #(.WID(1), .DEP(4)) udly8a (.clk(clk), .ce(ce), .i(xa_gt_xb4), .o(xa_gt_xb8));
|
delay #(.WID(1), .DEP(5)) udly8b (.clk(clk), .ce(ce), .i(a_gt_b3), .o(a_gt_b8));
|
ft_delay #(.WID(1), .DEP(5)) udly8b (.clk(clk), .ce(ce), .i(a_gt_b3), .o(a_gt_b8));
|
delay #(.WID(N*4), .DEP(6)) udly8d (.clk(clk), .ce(ce), .i(siga2), .o(siga8));
|
ft_delay #(.WID(N*4), .DEP(6)) udly8d (.clk(clk), .ce(ce), .i(siga2), .o(siga8));
|
delay #(.WID(N*4), .DEP(6)) udly8e (.clk(clk), .ce(ce), .i(sigb2), .o(sigb8));
|
ft_delay #(.WID(N*4), .DEP(6)) udly8e (.clk(clk), .ce(ce), .i(sigb2), .o(sigb8));
|
delay #(.WID(1), .DEP(5)) udly8j (.clk(clk), .ce(ce), .i(op3), .o(op8));
|
ft_delay #(.WID(1), .DEP(5)) udly8j (.clk(clk), .ce(ce), .i(op3), .o(op8));
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #9
|
// Clock #9
|
// Sort operands and perform add/subtract
|
// Sort operands and perform add/subtract
|
// addition can generate an extra bit, subtract can't go negative
|
// addition can generate an extra bit, subtract can't go negative
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg [(N+1)*4-1:0] oa9, ob9;
|
reg [(N+1)*4-1:0] oa9, ob9;
|
reg a_gt_b9;
|
reg a_gt_b9;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) oa9 <= xa_gt_xb8 ? {siga8,4'b0} : md8;
|
if (ce) oa9 <= xa_gt_xb8 ? {siga8,4'b0} : md8;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) ob9 <= xa_gt_xb8 ? md8 : {sigb8,4'b0};
|
if (ce) ob9 <= xa_gt_xb8 ? md8 : {sigb8,4'b0};
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) a_gt_b9 <= a_gt_b8;
|
if (ce) a_gt_b9 <= a_gt_b8;
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #10
|
// Clock #10
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg [(N+1)*4-1:0] oaa10;
|
|
reg [(N+1)*4-1:0] obb10;
|
|
wire realOp10;
|
wire realOp10;
|
reg [13:0] xo10;
|
reg [13:0] xo10;
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) oaa10 <= a_gt_b9 ? oa9 : ob9;
|
if (ce) oaa10 <= a_gt_b9 ? oa9 : ob9;
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) obb10 <= a_gt_b9 ? ob9 : oa9;
|
if (ce) obb10 <= a_gt_b9 ? ob9 : oa9;
|
delay #(.WID(1), .DEP(8)) udly10a (.clk(clk), .ce(ce), .i(realOp2), .o(realOp10));
|
ft_delay #(.WID(1), .DEP(8)) udly10a (.clk(clk), .ce(ce), .i(realOp2), .o(realOp10));
|
delay #(.WID(14), .DEP(6)) udly10b (.clk(clk), .ce(ce), .i(xo4), .o(xo10));
|
ft_delay #(.WID(14), .DEP(6)) udly10b (.clk(clk), .ce(ce), .i(xo4), .o(xo10));
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #11
|
// Clock #11
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg [(N+1)*4-1:0] mab11;
|
wire [(N+1)*4-1:0] mab11;
|
reg mab11c;
|
wire mab11c;
|
wire [N*4-1:0] siga11, sigb11;
|
wire [N*4-1:0] siga11, sigb11;
|
wire abInf11;
|
wire abInf11;
|
wire aNan11, bNan11;
|
wire aNan11, bNan11;
|
reg xoinf11;
|
wire xoinf11;
|
wire op11;
|
wire op11;
|
|
|
always @(posedge clk)
|
ft_delay #(.WID(1), .DEP(8+RIP_STAGES)) udly11a (.clk(clk), .ce(ce), .i(aInf3&bInf3), .o(abInf11));
|
if (ce) mab11 <= realOp10 ? odd10 : oss10;
|
ft_delay #(.WID(1), .DEP(10+RIP_STAGES)) udly11c (.clk(clk), .ce(ce), .i(au.nan), .o(aNan11));
|
always @(posedge clk)
|
ft_delay #(.WID(1), .DEP(10+RIP_STAGES)) udly11d (.clk(clk), .ce(ce), .i(bu.nan), .o(bNan11));
|
if (ce) mab11c <= realOp10 ? odd10c : oss10c;
|
ft_delay #(.WID(1), .DEP(3+RIP_STAGES)) udly11e (.clk(clk), .ce(ce), .i(op8), .o(op11));
|
|
ft_delay #(.WID(N*4), .DEP(3+RIP_STAGES)) udly11f (.clk(clk), .ce(ce), .i(siga8), .o(siga11));
|
delay #(.WID(1), .DEP(8)) udly11a (.clk(clk), .ce(ce), .i(aInf3&bInf3), .o(abInf11));
|
ft_delay #(.WID(N*4), .DEP(3+RIP_STAGES)) udly11g (.clk(clk), .ce(ce), .i(sigb8), .o(sigb11));
|
delay #(.WID(1), .DEP(10)) udly11c (.clk(clk), .ce(ce), .i(aNan), .o(aNan11));
|
ft_delay #(.WID(1), .DEP(1+RIP_STAGES)) udly11h (.clk(clk), .ce(ce), .i(xo10==14'h2FFF), .o(xoinf11));
|
delay #(.WID(1), .DEP(10)) udly11d (.clk(clk), .ce(ce), .i(bNan), .o(bNan11));
|
ft_delay #(.WID((N+1)*4+1), .DEP(1+RIP_STAGES)) udly11i (.clk(clk), .ce(ce), .i(realOp10 ? {odd10c,odd10} : {oss10c,oss10}), .o({mab11c,mab11}));
|
delay #(.WID(1), .DEP(3)) udly11e (.clk(clk), .ce(ce), .i(op8), .o(op11));
|
|
delay #(.WID(N*4), .DEP(3)) udly11f (.clk(clk), .ce(ce), .i(siga8), .o(siga11));
|
|
delay #(.WID(N*4), .DEP(3)) udly11g (.clk(clk), .ce(ce), .i(sigb8), .o(sigb11));
|
|
|
|
always @(posedge clk)
|
|
if (ce) xoinf11 <= xo10==14'h2FFF;
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// Clock #12
|
// Clock #12+RIP_STAGES
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
reg [(N+1)*4*2-1:0] mo12; // mantissa output
|
reg [(N+1)*4*2-1:0] mo12; // mantissa output
|
reg nan12;
|
reg nan12;
|
reg qnan12;
|
reg qnan12;
|
reg infinity12;
|
reg infinity12;
|
wire sxo11;
|
wire sxo11;
|
wire so11;
|
wire so11;
|
delay #(.WID(1), .DEP(9)) udly12a (.clk(clk), .ce(ce), .i(sxo2), .o(sxo11));
|
ft_delay #(.WID(1), .DEP(9)) udly12a (.clk(clk), .ce(ce), .i(sxo2), .o(sxo11));
|
delay #(.WID(1), .DEP(7)) udly12b (.clk(clk), .ce(ce), .i(so4), .o(so11));
|
ft_delay #(.WID(1), .DEP(7)) udly12b (.clk(clk), .ce(ce), .i(so4), .o(so11));
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce)
|
if (ce)
|
nan12 <= aNan11|bNan11;
|
nan12 <= aNan11|bNan11;
|
|
|
always @(posedge clk)
|
always_ff @(posedge clk)
|
if (ce) begin
|
if (ce) begin
|
infinity12 <= 1'b0;
|
infinity12 <= 1'b0;
|
qnan12 <= 1'b0;
|
qnan12 <= 1'b0;
|
casez({abInf11,aNan11,bNan11,xoinf11})
|
casez({abInf11,aNan11,bNan11,xoinf11})
|
4'b1???: // inf +/- inf - generate QNaN on subtract, inf on add
|
4'b1???: // inf +/- inf - generate QNaN on subtract, inf on add
|
Line 400... |
Line 390... |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
wire so; // sign output
|
wire so; // sign output
|
wire [15:0] xo; // de normalized exponent output
|
wire [15:0] xo; // de normalized exponent output
|
wire [(N+1)*4*2-1:0] mo; // mantissa output
|
wire [(N+1)*4*2-1:0] mo; // mantissa output
|
|
|
delay #(.WID(1), .DEP(1)) u13c (.clk(clk), .ce(ce), .i(nan12), .o(o.nan) );
|
ft_delay #(.WID(1), .DEP(1)) u13c (.clk(clk), .ce(ce), .i(nan12), .o(o.nan) );
|
delay #(.WID(1), .DEP(1)) u13d (.clk(clk), .ce(ce), .i(qnan12), .o(o.qnan) );
|
ft_delay #(.WID(1), .DEP(1)) u13d (.clk(clk), .ce(ce), .i(qnan12), .o(o.qnan) );
|
delay #(.WID(1), .DEP(1)) u13e (.clk(clk), .ce(ce), .i(infinity12), .o(o.infinity) );
|
ft_delay #(.WID(1), .DEP(1)) u13e (.clk(clk), .ce(ce), .i(infinity12), .o(o.infinity) );
|
delay #(.WID(1), .DEP(9)) udly13a (.clk(clk), .ce(ce), .i(so4), .o(o.sign));
|
ft_delay #(.WID(1), .DEP(9)) udly13a (.clk(clk), .ce(ce), .i(so4), .o(o.sign));
|
delay #(.WID(14), .DEP(3)) udly13b (.clk(clk), .ce(ce), .i(xo10), .o(o.exp));
|
ft_delay #(.WID(14), .DEP(3)) udly13b (.clk(clk), .ce(ce), .i(xo10), .o(o.exp));
|
delay #(.WID((N+1)*4*2), .DEP(1)) u13f (.clk(clk), .ce(ce), .i(mo12), .o(o.sig));
|
ft_delay #(.WID((N+1)*4*2), .DEP(1)) u13f (.clk(clk), .ce(ce), .i(mo12), .o(o.sig));
|
delay #(.WID(1), .DEP(1)) udly13g (.clk(clk), .ce(ce), .i(1'b0), .o(o.snan));
|
ft_delay #(.WID(1), .DEP(1)) udly13g (.clk(clk), .ce(ce), .i(1'b0), .o(o.snan));
|
|
|
endmodule
|
endmodule
|
|
|
|
|
module DFPAddsub128nr(clk, ce, rm, op, a, b, o);
|
module DFPAddsub128nr(clk, ce, rm, op, a, b, o);
|