1 |
3 |
constantin |
`timescale 1ns / 1ps
|
2 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
3 |
|
|
// Company:
|
4 |
|
|
// Engineer:
|
5 |
|
|
//
|
6 |
|
|
// Create Date: 18:56:11 10/07/2013
|
7 |
|
|
// Design Name:
|
8 |
|
|
// Module Name: special_cases_mul_acc
|
9 |
|
|
// Project Name:
|
10 |
|
|
// Target Devices:
|
11 |
|
|
// Tool versions:
|
12 |
|
|
// Description:
|
13 |
|
|
//
|
14 |
|
|
// Dependencies:
|
15 |
|
|
//
|
16 |
|
|
// Revision:
|
17 |
|
|
// Revision 0.01 - File Created
|
18 |
|
|
// Additional Comments:
|
19 |
|
|
//
|
20 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
21 |
|
|
module special_cases_mul_acc #( parameter size_exception_field = 2'd2,
|
22 |
5 |
constantin |
parameter [size_exception_field - 1 : 0] zero = 0, //00
|
23 |
|
|
parameter [size_exception_field - 1 : 0] normal_number = 1, //01
|
24 |
|
|
parameter [size_exception_field - 1 : 0] infinity = 2, //10
|
25 |
|
|
parameter [size_exception_field - 1 : 0] NaN = 3) //11
|
26 |
|
|
( input [size_exception_field - 1 : 0] sp_case_a_number,
|
27 |
|
|
input [size_exception_field - 1 : 0] sp_case_b_number,
|
28 |
|
|
input [size_exception_field - 1 : 0] sp_case_c_number,
|
29 |
|
|
output reg [size_exception_field - 1 : 0] sp_case_result_o);
|
30 |
3 |
constantin |
|
31 |
|
|
always
|
32 |
|
|
@(*)
|
33 |
|
|
begin
|
34 |
|
|
case ({sp_case_a_number, sp_case_b_number, sp_case_c_number})
|
35 |
5 |
constantin |
{zero, zero, zero}: sp_case_result_o = zero;
|
36 |
|
|
{zero, zero, normal_number}: sp_case_result_o = normal_number;
|
37 |
|
|
{zero, zero, infinity}: sp_case_result_o = infinity;
|
38 |
|
|
{zero, zero, NaN}: sp_case_result_o = NaN;
|
39 |
|
|
|
40 |
|
|
{zero, normal_number,zero}: sp_case_result_o = zero;
|
41 |
9 |
constantin |
{zero, normal_number,normal_number}: sp_case_result_o = normal_number;
|
42 |
5 |
constantin |
{zero, normal_number,infinity}: sp_case_result_o = infinity;
|
43 |
|
|
{zero, normal_number,NaN}: sp_case_result_o = NaN;
|
44 |
3 |
constantin |
|
45 |
5 |
constantin |
{zero, infinity, zero}: sp_case_result_o = NaN;
|
46 |
|
|
{zero, infinity, normal_number}: sp_case_result_o = NaN;
|
47 |
|
|
{zero, infinity, infinity}: sp_case_result_o = NaN;
|
48 |
|
|
{zero, infinity, NaN}: sp_case_result_o = NaN;
|
49 |
3 |
constantin |
|
50 |
5 |
constantin |
{zero, NaN, zero}: sp_case_result_o = NaN;
|
51 |
|
|
{zero, NaN, normal_number}: sp_case_result_o = NaN;
|
52 |
|
|
{zero, NaN, infinity}: sp_case_result_o = NaN;
|
53 |
|
|
{zero, NaN, NaN}: sp_case_result_o = NaN;
|
54 |
3 |
constantin |
|
55 |
5 |
constantin |
{normal_number, zero, zero}: sp_case_result_o = zero;
|
56 |
|
|
{normal_number, zero, normal_number}: sp_case_result_o = zero;
|
57 |
|
|
{normal_number, zero, infinity}: sp_case_result_o = infinity;
|
58 |
|
|
{normal_number, zero, NaN}: sp_case_result_o = NaN;
|
59 |
3 |
constantin |
|
60 |
9 |
constantin |
{normal_number, normal_number, zero}: sp_case_result_o = normal_number;
|
61 |
|
|
{normal_number, normal_number, normal_number}: sp_case_result_o = normal_number;
|
62 |
3 |
constantin |
{normal_number, normal_number, infinity}: sp_case_result_o = infinity;
|
63 |
|
|
{normal_number, normal_number, NaN}: sp_case_result_o = NaN;
|
64 |
|
|
|
65 |
5 |
constantin |
{normal_number, infinity, zero}: sp_case_result_o = infinity;
|
66 |
|
|
{normal_number, infinity, normal_number}: sp_case_result_o = infinity;
|
67 |
|
|
{normal_number, infinity, infinity}: sp_case_result_o = infinity;
|
68 |
|
|
{normal_number, infinity, NaN}: sp_case_result_o = NaN;
|
69 |
3 |
constantin |
|
70 |
5 |
constantin |
{normal_number, NaN, zero}: sp_case_result_o = NaN;
|
71 |
|
|
{normal_number, NaN, normal_number}: sp_case_result_o = NaN;
|
72 |
|
|
{normal_number, NaN, infinity}: sp_case_result_o = NaN;
|
73 |
|
|
{normal_number, NaN, NaN}: sp_case_result_o = NaN;
|
74 |
3 |
constantin |
|
75 |
5 |
constantin |
{infinity, zero, zero}: sp_case_result_o = NaN;
|
76 |
|
|
{infinity, zero, normal_number}: sp_case_result_o = NaN;
|
77 |
|
|
{infinity, zero, infinity}: sp_case_result_o = NaN;
|
78 |
|
|
{infinity, zero, NaN}: sp_case_result_o = NaN;
|
79 |
3 |
constantin |
|
80 |
5 |
constantin |
{infinity, normal_number, zero}: sp_case_result_o = infinity;
|
81 |
|
|
{infinity, normal_number, normal_number}: sp_case_result_o = infinity;
|
82 |
|
|
{infinity, normal_number, infinity}: sp_case_result_o = infinity;
|
83 |
|
|
{infinity, normal_number, NaN}: sp_case_result_o = NaN;
|
84 |
3 |
constantin |
|
85 |
5 |
constantin |
{infinity, infinity, zero}: sp_case_result_o = infinity;
|
86 |
|
|
{infinity, infinity, normal_number}: sp_case_result_o = infinity;
|
87 |
|
|
{infinity, infinity, infinity}: sp_case_result_o = infinity;
|
88 |
|
|
{infinity, infinity, NaN}: sp_case_result_o = NaN;
|
89 |
3 |
constantin |
|
90 |
5 |
constantin |
{infinity, NaN, zero}: sp_case_result_o = NaN;
|
91 |
|
|
{infinity, NaN, normal_number}: sp_case_result_o = NaN;
|
92 |
|
|
{infinity, NaN, infinity}: sp_case_result_o = NaN;
|
93 |
|
|
{infinity, NaN, NaN}: sp_case_result_o = NaN;
|
94 |
3 |
constantin |
|
95 |
5 |
constantin |
{NaN, zero, zero}: sp_case_result_o = NaN;
|
96 |
|
|
{NaN, zero, normal_number}: sp_case_result_o = NaN;
|
97 |
|
|
{NaN, zero, infinity}: sp_case_result_o = NaN;
|
98 |
|
|
{NaN, zero, NaN}: sp_case_result_o = NaN;
|
99 |
3 |
constantin |
|
100 |
5 |
constantin |
{NaN, normal_number, zero}: sp_case_result_o = NaN;
|
101 |
|
|
{NaN, normal_number, normal_number}: sp_case_result_o = NaN;
|
102 |
|
|
{NaN, normal_number, infinity}: sp_case_result_o = NaN;
|
103 |
|
|
{NaN, normal_number, NaN}: sp_case_result_o = NaN;
|
104 |
3 |
constantin |
|
105 |
5 |
constantin |
{NaN, infinity, zero}: sp_case_result_o = NaN;
|
106 |
|
|
{NaN, infinity, normal_number}: sp_case_result_o = NaN;
|
107 |
|
|
{NaN, infinity, infinity}: sp_case_result_o = NaN;
|
108 |
|
|
{NaN, infinity, NaN}: sp_case_result_o = NaN;
|
109 |
3 |
constantin |
|
110 |
5 |
constantin |
{NaN, NaN, zero}: sp_case_result_o = NaN;
|
111 |
|
|
{NaN, NaN, normal_number}: sp_case_result_o = NaN;
|
112 |
|
|
{NaN, NaN, infinity}: sp_case_result_o = NaN;
|
113 |
|
|
{NaN, NaN, NaN}: sp_case_result_o = NaN;
|
114 |
|
|
default: sp_case_result_o = zero;
|
115 |
3 |
constantin |
endcase
|
116 |
|
|
end
|
117 |
|
|
|
118 |
|
|
endmodule
|
119 |
|
|
|