Line 3... |
Line 3... |
// \\__/ o\ (C) 2020 Robert Finch, Waterloo
|
// \\__/ o\ (C) 2020 Robert Finch, Waterloo
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch@finitron.ca
|
// \/_// robfinch@finitron.ca
|
// ||
|
// ||
|
//
|
//
|
// positFDPMul.v
|
// positFDPMul.sv
|
// - fused dot product posit number multiplier
|
// - fused dot product posit number multiplier
|
// - parameterized width
|
// - parameterized width
|
// - perform a multiplication but retain all the product bits
|
// - perform a multiplication but retain all the product bits
|
// in the result in preparation for addition.
|
// in the result in preparation for addition.
|
//
|
//
|
Line 25... |
Line 25... |
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see .
|
// along with this program. If not, see .
|
//
|
//
|
// ============================================================================
|
// ============================================================================
|
|
|
`include "positConfig.sv"
|
import posit::*;
|
|
|
module positFDPMul(a, b, o, zero, inf);
|
module positFDPMul(a, b, o, zero, inf);
|
`include "positSize.sv"
|
|
localparam rs = $clog2(PSTWID-1);
|
|
input [PSTWID-1:0] a;
|
input [PSTWID-1:0] a;
|
input [PSTWID-1:0] b;
|
input [PSTWID-1:0] b;
|
output reg [PSTWID+es+(PSTWID-es)*2-1:0] o;
|
output reg [PSTWID+es+(PSTWID-es)*2-1:0] o;
|
output zero;
|
output zero;
|
output inf;
|
output inf;
|
Line 48... |
Line 46... |
wire zera, zerb;
|
wire zera, zerb;
|
wire infa, infb;
|
wire infa, infb;
|
wire inf = infa|infb;
|
wire inf = infa|infb;
|
wire zero = zera|zerb;
|
wire zero = zera|zerb;
|
|
|
positDecompose #(PSTWID,es) u1 (
|
positDecompose #(PSTWID) u1 (
|
.i(a),
|
.i(a),
|
.sgn(sa),
|
.sgn(sa),
|
.rgs(rgsa),
|
.rgs(rgsa),
|
.rgm(rgma),
|
.rgm(rgma),
|
.exp(expa),
|
.exp(expa),
|
.sig(siga),
|
.sig(siga),
|
.zer(zera),
|
.zer(zera),
|
.inf(infa)
|
.inf(infa)
|
);
|
);
|
|
|
positDecompose #(PSTWID,es) u2 (
|
positDecompose #(PSTWID) u2 (
|
.i(b),
|
.i(b),
|
.sgn(sb),
|
.sgn(sb),
|
.rgs(rgsb),
|
.rgs(rgsb),
|
.rgm(rgmb),
|
.rgm(rgmb),
|
.exp(expb),
|
.exp(expb),
|