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
|
// ||
|
// ||
|
//
|
//
|
// positFDPAddsub.v
|
// positFDPAddsub.sv
|
// - posit number adder/subtracter
|
// - posit number adder/subtracter
|
// - parameterized width
|
// - parameterized width
|
//
|
//
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
Line 23... |
Line 23... |
// 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 positFDPAddsub(op, a, b, o, z, i);
|
module positFDPAddsub(op, a, b, o, z, i);
|
`include "positSize.sv"
|
|
localparam rs = $clog2(PSTWID-1)-1;
|
localparam rs = $clog2(PSTWID-1)-1;
|
input op;
|
input op;
|
input [PSTWID+es+(PSTWID-es)*2-1:0] a;
|
input [PSTWID+es+(PSTWID-es)*2-1:0] a;
|
input [PSTWID+es+(PSTWID-es)*2-1:0] b;
|
input [PSTWID+es+(PSTWID-es)*2-1:0] b;
|
output reg [PSTWID-1:0] o;
|
output reg [PSTWID-1:0] o;
|
Line 49... |
Line 48... |
wire infa, infb;
|
wire infa, infb;
|
wire [PSTWID+es+(PSTWID-es)*2-1:0] aa, bb;
|
wire [PSTWID+es+(PSTWID-es)*2-1:0] aa, bb;
|
wire inf = infa|infb;
|
wire inf = infa|infb;
|
wire zero = zera & zerb;
|
wire zero = zera & zerb;
|
|
|
positDecompose #(PSTWID+es+(PSTWID-es)*2,es) u1 (
|
positDecompose #(PSTWID+es+(PSTWID-es)*2) 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+(PSTWID-es)*2,es) u2 (
|
positDecompose #(PSTWID+es+(PSTWID-es)*2) u2 (
|
.i(b),
|
.i(b),
|
.sgn(sb),
|
.sgn(sb),
|
.rgs(rgsb),
|
.rgs(rgsb),
|
.rgm(rgmb),
|
.rgm(rgmb),
|
.exp(expb),
|
.exp(expb),
|