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/] [FarPath.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:31:57 11/19/2013 
7
// Design Name: 
8
// Module Name:    FarPath 
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 FarPath  #(      parameter size_in_mantissa                      = 24, //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 [double_size_mantissa:0] unnormalized_mantissa;
39
        wire [7:0] adjust_mantissa;
40
        wire [double_size_mantissa:0] normalized_mantissa;
41
 
42
        wire dummy_bit;
43
 
44
        //compute unnormalized_mantissa
45
        assign unnormalized_mantissa = (eff_op)? ((m_a_number > m_b_number)? (m_a_number - m_b_number) : (m_b_number - m_a_number)) :
46
                                                                                                                        m_a_number + m_b_number;
47
 
48
        assign adjust_mantissa = unnormalized_mantissa[double_size_mantissa]? 8'd0 :
49
                                                                                unnormalized_mantissa[double_size_mantissa-1]? 2'd1 : 8'd2;
50
 
51
        //compute shifting over unnormalized_mantissa
52
        shifter #(      .INPUT_SIZE(double_size_mantissa+1),
53
                                        .SHIFT_SIZE(size_exponent),
54
                                        .OUTPUT_SIZE(double_size_mantissa+2),
55
                                        .DIRECTION(1'b1),
56
                                        .PIPELINE(pipeline),
57
                                        .POSITION(pipeline_pos))
58
                unnormalized_no_shifter_instance(.a(unnormalized_mantissa),
59
                                                                                                        .arith(1'b0),
60
                                                                                                        .shft(adjust_mantissa),
61
                                                                                                        .shifted_a({normalized_mantissa, dummy_bit}));
62
 
63
        //instantiate rounding_component
64
        rounding #(     .SIZE_MOST_S_MANTISSA(size_out_mantissa),
65
                                        .SIZE_LEAST_S_MANTISSA(size_out_mantissa + 2'd1))
66
                rounding_instance(      .unrounded_mantissa(normalized_mantissa[double_size_mantissa : double_size_mantissa - size_out_mantissa + 1]),
67
                                                                        .dummy_bits(normalized_mantissa[double_size_mantissa - size_out_mantissa: 0]),
68
                                                                        .rounded_mantissa(resulted_m_o));
69
 
70
        assign resulted_e_o = (e_a_number > e_b_number)? (e_a_number + 1 - adjust_mantissa):(e_b_number + 1 - adjust_mantissa);
71
 
72
endmodule

powered by: WebSVN 2.1.0

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