`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
// Company:
|
// Company: UPT
|
// Engineer:
|
// Engineer: Constantina-Elena Gavriliu
|
//
|
//
|
// Create Date: 18:56:11 10/07/2013
|
// Create Date: 18:56:11 10/07/2013
|
// Design Name:
|
// Design Name:
|
// Module Name: special_cases_mul_acc
|
// Module Name: special_cases
|
// Project Name:
|
// Project Name:
|
// Target Devices:
|
// Target Devices:
|
// Tool versions:
|
// Tool versions:
|
// Description:
|
// Description: Compute corresponding special cases (exceptions)
|
//
|
// //do not take into consideration cases for which the operation generates a NaN or Infinity exception (with corresponding sign) when initial "special cases" are not such exceptions
|
// Dependencies:
|
// Dependencies: SinglePathFPAdder
|
//
|
//
|
// Revision:
|
// Revision:
|
// Revision 0.01 - File Created
|
// Revision 0.01 - File Created
|
// Additional Comments:
|
// Additional Comments:
|
//
|
//
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
module special_cases #( parameter size_exception_field = 2'd2,
|
module special_cases #( parameter size_exception_field = 2'd2,
|
parameter [size_exception_field - 1 : 0] zero = 0, //00
|
parameter [size_exception_field - 1 : 0] zero = 0, //00
|
parameter [size_exception_field - 1 : 0] normal_number= 1, //01
|
parameter [size_exception_field - 1 : 0] normal_number = 1, //01
|
parameter [size_exception_field - 1 : 0] infinity = 2, //10
|
parameter [size_exception_field - 1 : 0] infinity = 2, //10
|
parameter [size_exception_field - 1 : 0] NaN = 3) //11
|
parameter [size_exception_field - 1 : 0] NaN = 3) //11
|
( input [size_exception_field - 1 : 0] sp_case_a_number,
|
( input [size_exception_field - 1 : 0] sp_case_a_number,
|
input [size_exception_field - 1 : 0] sp_case_b_number,
|
input [size_exception_field - 1 : 0] sp_case_b_number,
|
output reg [size_exception_field - 1 : 0] sp_case_result_o);
|
output reg [size_exception_field - 1 : 0] sp_case_result_o);
|
|
|
always
|
always
|
@(*)
|
@(*)
|
begin
|
begin
|
case ({sp_case_a_number, sp_case_b_number})
|
case ({sp_case_a_number, sp_case_b_number})
|
{zero, zero}: sp_case_result_o = zero;
|
{zero, zero}: sp_case_result_o = zero;
|
{zero, normal_number}: sp_case_result_o = normal_number;
|
{zero, normal_number}: sp_case_result_o = normal_number;
|
{zero, infinity}: sp_case_result_o = infinity;
|
{zero, infinity}: sp_case_result_o = infinity;
|
{zero, NaN}: sp_case_result_o = NaN;
|
{zero, NaN}: sp_case_result_o = NaN;
|
|
|
{normal_number,zero}: sp_case_result_o = normal_number;
|
{normal_number,zero}: sp_case_result_o = normal_number;
|
{normal_number,normal_number}: sp_case_result_o = normal_number;
|
{normal_number,normal_number}: sp_case_result_o = normal_number;
|
{normal_number,infinity}: sp_case_result_o = infinity;
|
{normal_number,infinity}: sp_case_result_o = infinity;
|
{normal_number,NaN}: sp_case_result_o = NaN;
|
{normal_number,NaN}: sp_case_result_o = NaN;
|
|
|
{infinity, zero}: sp_case_result_o = infinity;
|
{infinity, zero}: sp_case_result_o = infinity;
|
{infinity, normal_number}: sp_case_result_o = infinity;
|
{infinity, normal_number}: sp_case_result_o = infinity;
|
{infinity, infinity}: sp_case_result_o = infinity;
|
{infinity, infinity}: sp_case_result_o = infinity;
|
{infinity, NaN}: sp_case_result_o = NaN;
|
{infinity, NaN}: sp_case_result_o = NaN;
|
|
|
{NaN, zero}: sp_case_result_o = NaN;
|
{NaN, zero}: sp_case_result_o = NaN;
|
{NaN, normal_number}: sp_case_result_o = NaN;
|
{NaN, normal_number}: sp_case_result_o = NaN;
|
{NaN, infinity}: sp_case_result_o = NaN;
|
{NaN, infinity}: sp_case_result_o = NaN;
|
{NaN, NaN}: sp_case_result_o = NaN;
|
{NaN, NaN}: sp_case_result_o = NaN;
|
default: sp_case_result_o = zero;
|
default: sp_case_result_o = zero;
|
endcase
|
endcase
|
end
|
end
|
|
|
endmodule
|
endmodule
|
|
|