Line 1... |
Line 1... |
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
// ============================================================================
|
// ============================================================================
|
// __
|
// __
|
// \\__/ o\ (C) 2006-2018 Robert Finch, Waterloo
|
// \\__/ o\ (C) 2006-2019 Robert Finch, Waterloo
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch<remove>@finitron.ca
|
// \/_// robfinch<remove>@finitron.ca
|
// ||
|
// ||
|
//
|
//
|
// fpAddsub.v
|
// fpAddsub.v
|
Line 206... |
Line 206... |
wire [FMSB+3:0] oa = xa_gt_xb1 ? {fracta1,2'b0} : md1;
|
wire [FMSB+3:0] oa = xa_gt_xb1 ? {fracta1,2'b0} : md1;
|
wire [FMSB+3:0] ob = xa_gt_xb1 ? md1 : {fractb1,2'b0};
|
wire [FMSB+3:0] ob = xa_gt_xb1 ? md1 : {fractb1,2'b0};
|
wire [FMSB+3:0] oaa = a_gt_b1 ? oa : ob;
|
wire [FMSB+3:0] oaa = a_gt_b1 ? oa : ob;
|
wire [FMSB+3:0] obb = a_gt_b1 ? ob : oa;
|
wire [FMSB+3:0] obb = a_gt_b1 ? ob : oa;
|
wire [FMSB+4:0] mab = realOp1 ? oaa - obb : oaa + obb;
|
wire [FMSB+4:0] mab = realOp1 ? oaa - obb : oaa + obb;
|
|
wire xoinf = &xo;
|
|
|
always @*
|
always @*
|
casez({aInf1&bInf1,aNan1,bNan1})
|
casez({aInf1&bInf1,aNan1,bNan1,xoinf})
|
3'b1??: mo1 = {1'b0,op1,{FMSB-1{1'b0}},op1,{FMSB{1'b0}}}; // inf +/- inf - generate QNaN on subtract, inf on add
|
4'b1???: mo1 = {1'b0,op1,{FMSB-1{1'b0}},op1,{FMSB{1'b0}}}; // inf +/- inf - generate QNaN on subtract, inf on add
|
3'b01?: mo1 = {1'b0,fracta1[FMSB+1:0],{FMSB{1'b0}}};
|
4'b01??: mo1 = {1'b0,fracta1[FMSB+1:0],{FMSB{1'b0}}};
|
3'b001: mo1 = {1'b0,fractb1[FMSB+1:0],{FMSB{1'b0}}};
|
4'b001?: mo1 = {1'b0,fractb1[FMSB+1:0],{FMSB{1'b0}}};
|
|
4'b0001: mo1 = 1'd0;
|
default: mo1 = {mab,{FMSB-1{1'b0}}}; // mab has an extra lead bit and two trailing bits
|
default: mo1 = {mab,{FMSB-1{1'b0}}}; // mab has an extra lead bit and two trailing bits
|
endcase
|
endcase
|
|
|
delay1 #(FX+1) d3(.clk(clk), .ce(ce), .i(mo1), .o(mo) );
|
delay1 #(FX+1) d3(.clk(clk), .ce(ce), .i(mo1), .o(mo) );
|
|
|