mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Update unpackinput.sv
Program clean up
This commit is contained in:
parent
c8948dcb29
commit
420ee8dad9
@ -28,24 +28,24 @@
|
|||||||
|
|
||||||
module unpackinput import cvw::*; #(parameter cvw_t P) (
|
module unpackinput import cvw::*; #(parameter cvw_t P) (
|
||||||
input logic [P.FLEN-1:0] In, // inputs from register file
|
input logic [P.FLEN-1:0] In, // inputs from register file
|
||||||
input logic En, // enable the input
|
input logic En, // enable the input
|
||||||
input logic [P.FMTBITS-1:0] Fmt, // format signal 00 - single 01 - double 11 - quad 10 - half
|
input logic [P.FMTBITS-1:0] Fmt, // format signal 00 - single 01 - double 11 - quad 10 - half
|
||||||
output logic Sgn, // sign bits of the number
|
output logic Sgn, // sign bits of the number
|
||||||
output logic [P.NE-1:0] Exp, // exponent of the number (converted to largest supported precision)
|
output logic [P.NE-1:0] Exp, // exponent of the number (converted to largest supported precision)
|
||||||
output logic [P.NF:0] Man, // mantissa of the number (converted to largest supported precision)
|
output logic [P.NF:0] Man, // mantissa of the number (converted to largest supported precision)
|
||||||
output logic NaN, // is the number a NaN
|
output logic NaN, // is the number a NaN
|
||||||
output logic SNaN, // is the number a signaling NaN
|
output logic SNaN, // is the number a signaling NaN
|
||||||
output logic Zero, // is the number zero
|
output logic Zero, // is the number zero
|
||||||
output logic Inf, // is the number infinity
|
output logic Inf, // is the number infinity
|
||||||
output logic ExpNonZero, // is the exponent not zero
|
output logic ExpNonZero, // is the exponent not zero
|
||||||
output logic FracZero, // is the fraction zero
|
output logic FracZero, // is the fraction zero
|
||||||
output logic ExpMax, // does In have the maximum exponent (NaN or Inf)
|
output logic ExpMax, // does In have the maximum exponent (NaN or Inf)
|
||||||
output logic Subnorm, // is the number subnormal
|
output logic Subnorm, // is the number subnormal
|
||||||
output logic [P.FLEN-1:0] PostBox // Number reboxed correctly as a NaN
|
output logic [P.FLEN-1:0] PostBox // Number reboxed correctly as a NaN
|
||||||
);
|
);
|
||||||
|
|
||||||
logic [P.NF-1:0] Frac; // Fraction of XYZ
|
logic [P.NF-1:0] Frac; // Fraction of XYZ
|
||||||
logic BadNaNBox; // incorrectly NaN Boxed
|
logic BadNaNBox; // incorrectly NaN Boxed
|
||||||
|
|
||||||
if (P.FPSIZES == 1) begin // if there is only one floating point format supported
|
if (P.FPSIZES == 1) begin // if there is only one floating point format supported
|
||||||
assign BadNaNBox = 0;
|
assign BadNaNBox = 0;
|
||||||
@ -107,7 +107,6 @@ module unpackinput import cvw::*; #(parameter cvw_t P) (
|
|||||||
// is the exponent all 1's
|
// is the exponent all 1's
|
||||||
assign ExpMax = Fmt ? &In[P.FLEN-2:P.NF] : &In[P.LEN1-2:P.NF1];
|
assign ExpMax = Fmt ? &In[P.FLEN-2:P.NF] : &In[P.LEN1-2:P.NF1];
|
||||||
|
|
||||||
|
|
||||||
end else if (P.FPSIZES == 3) begin // three floating point precsions supported
|
end else if (P.FPSIZES == 3) begin // three floating point precsions supported
|
||||||
|
|
||||||
// largest format | larger format | smallest format
|
// largest format | larger format | smallest format
|
||||||
@ -247,7 +246,6 @@ module unpackinput import cvw::*; #(parameter cvw_t P) (
|
|||||||
2'b10: Sgn = In[P.H_LEN-1];
|
2'b10: Sgn = In[P.H_LEN-1];
|
||||||
endcase
|
endcase
|
||||||
|
|
||||||
|
|
||||||
// extract the fraction
|
// extract the fraction
|
||||||
always_comb
|
always_comb
|
||||||
case (Fmt)
|
case (Fmt)
|
||||||
@ -266,7 +264,6 @@ module unpackinput import cvw::*; #(parameter cvw_t P) (
|
|||||||
2'b10: ExpNonZero = |In[P.H_LEN-2:P.H_NF];
|
2'b10: ExpNonZero = |In[P.H_LEN-2:P.H_NF];
|
||||||
endcase
|
endcase
|
||||||
|
|
||||||
|
|
||||||
// example double to single conversion:
|
// example double to single conversion:
|
||||||
// 1023 = 0011 1111 1111
|
// 1023 = 0011 1111 1111
|
||||||
// 127 = 0000 0111 1111 (subtract this)
|
// 127 = 0000 0111 1111 (subtract this)
|
||||||
@ -285,7 +282,6 @@ module unpackinput import cvw::*; #(parameter cvw_t P) (
|
|||||||
2'b10: Exp = {In[P.H_LEN-2], {P.Q_NE-P.H_NE{~In[P.H_LEN-2]}}, In[P.H_LEN-3:P.H_NF+1], In[P.H_NF]|~ExpNonZero};
|
2'b10: Exp = {In[P.H_LEN-2], {P.Q_NE-P.H_NE{~In[P.H_LEN-2]}}, In[P.H_LEN-3:P.H_NF+1], In[P.H_NF]|~ExpNonZero};
|
||||||
endcase
|
endcase
|
||||||
|
|
||||||
|
|
||||||
// is the exponent all 1's
|
// is the exponent all 1's
|
||||||
always_comb
|
always_comb
|
||||||
case (Fmt)
|
case (Fmt)
|
||||||
|
Loading…
Reference in New Issue
Block a user