cvw/wally-pipelined/src/fpu/fclassify.sv

41 lines
1.0 KiB
Systemverilog
Raw Normal View History

2021-07-02 16:53:05 +00:00
`include "wally-config.vh"
module fclassify (
2021-07-14 21:56:49 +00:00
input logic XSgnE,
input logic XNaNE,
input logic XSNaNE,
input logic XNormE,
input logic XDenormE,
input logic XZeroE,
input logic XInfE,
2021-07-02 16:53:05 +00:00
output logic [63:0] ClassResE
);
2021-07-14 21:56:49 +00:00
logic PInf, PZero, PNorm, PDenorm;
logic NInf, NZero, NNorm, NDenorm;
2021-07-02 16:53:05 +00:00
2021-07-14 21:56:49 +00:00
assign PInf = ~XSgnE&XInfE;
assign NInf = XSgnE&XInfE;
assign PNorm = ~XSgnE&XNormE;
assign NNorm = XSgnE&XNormE;
assign PDenorm = ~XSgnE&XDenormE;
assign NDenorm = XSgnE&XDenormE;
assign PZero = ~XSgnE&XZeroE;
assign NZero = XSgnE&XZeroE;
2021-07-02 16:53:05 +00:00
// determine sub category and combine into the result
// bit 0 - -Inf
// bit 1 - -Norm
// bit 2 - -Denorm
// bit 3 - -Zero
// bit 4 - +Zero
// bit 5 - +Denorm
// bit 6 - +Norm
// bit 7 - +Inf
// bit 8 - signaling NaN
// bit 9 - quiet NaN
2021-07-14 21:56:49 +00:00
assign ClassResE = {{54{1'b0}}, XNaNE&~XSNaNE, XSNaNE, PInf, PNorm, PDenorm, PZero, NZero, NDenorm, NNorm, NInf};
2021-07-02 16:53:05 +00:00
endmodule