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/] [ClosePath.v] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 constantin
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
6
// Create Date:    00:32:10 11/19/2013 
7
// Design Name: 
8
// Module Name:    ClosePath 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: A  B when |Ea-Eb| < 2
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module ClosePath        #(      parameter size_in_mantissa                      = 48, //1.M
22
                                                        parameter size_out_mantissa             = 24,
23
                                                        parameter size_exponent                         = 8,
24
                                                        parameter pipeline                                      = 0,
25
                                                        parameter pipeline_pos                          = 0,     // 8 bits
26
                                                        parameter size_counter                          = 5,    //log2(size_mantissa) + 1 = 5)
27
                                                        parameter double_size_counter           = size_counter + 1,
28
                                                        parameter double_size_mantissa  = size_in_mantissa + size_in_mantissa)
29
 
30
                                                (       input eff_op,
31
                                                        input [size_in_mantissa-1 :0] m_a_number,
32
                                                        input [size_in_mantissa-1 :0] m_b_number,
33
                                                        input [size_exponent - 1 : 0] e_a_number,
34
                                                        input [size_exponent - 1 : 0] e_b_number,
35
                                                        output[size_out_mantissa-1:0] resulted_m_o,
36
                                                        output[size_exponent - 1 : 0] resulted_e_o);
37
 
38
        wire [size_in_mantissa:0] unnormalized_mantissa;
39
        wire [double_size_counter-1: 0] lzs;
40
        wire [size_out_mantissa + 1 : 0] dummy_bits;
41
 
42
        //compute unnormalized_mantissa
43
        assign unnormalized_mantissa = (eff_op)? ((m_a_number > m_b_number)? (m_a_number - m_b_number) : (m_b_number - m_a_number)) :
44
                                                                                                                        m_a_number + m_b_number;
45
 
46
        //compute leading_zeros over unnormalized mantissa
47
        leading_zeros #(        .SIZE_INT(double_size_mantissa + 1'b1), .SIZE_COUNTER(double_size_counter), .PIPELINE(pipeline))
48
                leading_zeros_instance (.a(unnormalized_mantissa),
49
                                                                                .ovf(1'b0),
50
                                                                                .lz(lzs));
51
 
52
        //compute shifting over unnormalized_mantissa
53
        shifter #(      .INPUT_SIZE(size_in_mantissa + 1'b1),
54
                                        .SHIFT_SIZE(double_size_counter),
55
                                        .OUTPUT_SIZE(size_in_mantissa + 2'd2),
56
                                        .DIRECTION(1'b1), //0=right, 1=left
57
                                        .PIPELINE(pipeline),
58
                                        .POSITION(pipeline_pos))
59
                shifter_instance(       .a(unnormalized_mantissa),//mantissa
60
                                                                .arith(1'b0),//logical shift
61
                                                                .shft(lzs),
62
                                                                .shifted_a({resulted_m_o, dummy_bits}));
63
 
64
        assign resulted_e_o = (e_a_number > e_b_number)? (e_a_number - lzs + 1) : (e_b_number - lzs + 1);
65
 
66
endmodule

powered by: WebSVN 2.1.0

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