OpenCores
URL https://opencores.org/ocsvn/xilinx_virtex_fp_library/xilinx_virtex_fp_library/trunk

Subversion Repositories xilinx_virtex_fp_library

[/] [xilinx_virtex_fp_library/] [trunk/] [DualPathFPAdder/] [special_cases.v] - Blame information for rev 18

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 constantin
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3 18 constantin
// Company:     UPT     
4
// Engineer:    Constantina-Elena Gavriliu
5 8 constantin
// 
6
// Create Date:    18:56:11 10/07/2013 
7
// Design Name: 
8 18 constantin
// Module Name:    special_cases
9 8 constantin
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12 18 constantin
// Description: Compute corresponding special cases (exceptions)
13
//                              //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
14
// Dependencies:        SinglePathFPAdder
15 8 constantin
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module special_cases            #(      parameter size_exception_field = 2'd2,
22 18 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
                                                                output reg [size_exception_field - 1 : 0] sp_case_result_o);
29 8 constantin
 
30
        always
31
                @(*)
32
        begin
33
                case ({sp_case_a_number, sp_case_b_number})
34 18 constantin
                        {zero, zero}:                                           sp_case_result_o = zero;
35 8 constantin
                        {zero, normal_number}:                          sp_case_result_o = normal_number;
36
                        {zero, infinity}:                                       sp_case_result_o = infinity;
37 18 constantin
                        {zero, NaN}:                                            sp_case_result_o = NaN;
38 8 constantin
 
39
                        {normal_number,zero}:                           sp_case_result_o = normal_number;
40 18 constantin
                        {normal_number,normal_number}:          sp_case_result_o = normal_number;
41 8 constantin
                        {normal_number,infinity}:                       sp_case_result_o = infinity;
42 18 constantin
                        {normal_number,NaN}:                            sp_case_result_o = NaN;
43 8 constantin
 
44
                        {infinity, zero}:                                       sp_case_result_o = infinity;
45 18 constantin
                        {infinity, normal_number}:                      sp_case_result_o = infinity;
46 8 constantin
                        {infinity, infinity}:                           sp_case_result_o = infinity;
47 18 constantin
                        {infinity, NaN}:                                        sp_case_result_o = NaN;
48 8 constantin
 
49 18 constantin
                        {NaN, zero}:                                            sp_case_result_o = NaN;
50 8 constantin
                        {NaN, normal_number}:                           sp_case_result_o = NaN;
51 18 constantin
                        {NaN, infinity}:                                        sp_case_result_o = NaN;
52
                        {NaN, NaN}:                                             sp_case_result_o = NaN;
53
                        default:                                                        sp_case_result_o = zero;
54 8 constantin
                endcase
55
        end
56
 
57
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.