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] - Diff between revs 13 and 18

Show entire file | Details | Blame | View Log

Rev 13 Rev 18
Line 1... Line 1...
`timescale 1ns / 1ps
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Company:     UPT
// Engineer: 
// Engineer:    Constantina-Elena Gavriliu
// 
// 
// Create Date:    00:32:10 11/19/2013 
// Create Date:    00:32:10 11/19/2013 
// Design Name: 
// Design Name: 
// Module Name:    ClosePath 
// Module Name:    ClosePath 
// Project Name: 
// Project Name: 
// Target Devices: 
// Target Devices: 
// Tool versions: 
// Tool versions: 
// Description: A  B when |Ea-Eb| < 2
// Description: A  B when |Ea-Eb| < 2
//
//
// Dependencies: 
// Dependencies:        leading_zeros.v
 
//                                      shifter.v                       
//
//
// Revision: 
// Revision: 
// Revision 0.01 - File Created
// Revision 0.01 - File Created
// Additional Comments: 
// Additional Comments: 
//
//
Line 39... Line 40...
        wire [1 : 0] adjust_exponent;
        wire [1 : 0] adjust_exponent;
        wire [2 : 0] dummy_bits;
        wire [2 : 0] dummy_bits;
        wire init_shft_bit, shft_bit;
        wire init_shft_bit, shft_bit;
 
 
        wire [size_in_mantissa-1: 0] shifted_m_b;
        wire [size_in_mantissa-1: 0] shifted_m_b;
        wire [size_in_mantissa+1: 0] adder_mantissa;
        wire [size_in_mantissa+2: 0] adder_mantissa;
        wire [size_in_mantissa  : 0] unnormalized_mantissa;
        wire [size_in_mantissa+1: 0] unnormalized_mantissa;
        wire [size_in_mantissa  : 0] rounded_mantissa;
        wire [size_in_mantissa  : 0] rounded_mantissa;
        wire [size_in_mantissa-1: 0] r_mantissa;
        wire [size_in_mantissa-1: 0] r_mantissa;
 
        wire [size_in_mantissa  : 0] aux_r_mantissa;
 
 
        assign {shifted_m_b, init_shft_bit} = (exp_difference)? {1'b0, m_b_number[size_in_mantissa-1:0]} : {m_b_number, 1'b0};
        assign {shifted_m_b, init_shft_bit} = (exp_difference)? {1'b0, m_b_number[size_in_mantissa-1:0]} : {m_b_number, 1'b0};
 
 
        //compute unnormalized_mantissa
        //compute unnormalized_mantissa
        assign adder_mantissa = {1'b0, m_a_number} - {1'b0, shifted_m_b};
        assign adder_mantissa = {1'b0, m_a_number, 1'b0} - {1'b0, shifted_m_b, init_shft_bit};
 
        assign unnormalized_mantissa = adder_mantissa[size_in_mantissa + 1]? ~adder_mantissa : adder_mantissa;
        assign {unnormalized_mantissa, shft_bit} =
 
                                                                (adder_mantissa[size_in_mantissa + 1])? ({~adder_mantissa[size_in_mantissa : 0], ~init_shft_bit}) :
 
                                                                                                                                                ({adder_mantissa[size_in_mantissa       : 0], init_shft_bit});
 
 
 
        //compute leading_zeros over unnormalized mantissa
        //compute leading_zeros over unnormalized mantissa
        leading_zeros #(        .SIZE_INT(size_in_mantissa + 1), .SIZE_COUNTER(size_counter), .PIPELINE(pipeline))
        leading_zeros #(        .SIZE_INT(size_in_mantissa + 2), .SIZE_COUNTER(size_counter), .PIPELINE(pipeline))
                leading_zeros_instance (.a(unnormalized_mantissa[size_in_mantissa : 0]),
                leading_zeros_instance (.a(unnormalized_mantissa[size_in_mantissa+1 : 0]),
                                                                                .ovf(unnormalized_mantissa[size_in_mantissa]),
                                                                                .ovf(unnormalized_mantissa[size_in_mantissa+1]),
                                                                                .lz(lzs));
                                                                                .lz(lzs));
 
 
        //compute shifting over unnormalized_mantissa
        //compute shifting over unnormalized_mantissa
        shifter #(      .INPUT_SIZE(size_in_mantissa + 2),
        shifter #(      .INPUT_SIZE(size_in_mantissa + 2),
                                        .SHIFT_SIZE(size_counter),
                                        .SHIFT_SIZE(size_counter),
                                        .OUTPUT_SIZE(size_in_mantissa + 3),
                                        .OUTPUT_SIZE(size_in_mantissa + 3),
                                        .DIRECTION(1'b1), //0=right, 1=left
                                        .DIRECTION(1'b1), //0=right, 1=left
                                        .PIPELINE(pipeline),
                                        .PIPELINE(pipeline),
                                        .POSITION(pipeline_pos))
                                        .POSITION(pipeline_pos))
                shifter_instance(       .a({unnormalized_mantissa, shft_bit}),//mantissa
                shifter_instance(       .a({unnormalized_mantissa}),//mantissa
                                                                .arith(adder_mantissa[size_in_mantissa + 1]),//logical shift
                                                                .arith(adder_mantissa[size_in_mantissa+2]),//logical shift
                                                                .shft(lzs),
                                                                .shft(lzs),
                                                                .shifted_a({r_mantissa, dummy_bits}));
                                                                .shifted_a({r_mantissa, dummy_bits}));
 
 
        assign rounded_mantissa = (adder_mantissa[size_in_mantissa + 1])? {1'b0, r_mantissa} + 1'b1 : {1'b0, r_mantissa};
 
 
        //assign aux_r_mantissa = {1'b0, r_mantissa} + 1'b1;
 
        assign rounded_mantissa = (r_mantissa[0] & (dummy_bits[2]))? {1'b0, r_mantissa} + 1'b1 : {1'b0, r_mantissa};
        assign resulted_m_o = (rounded_mantissa[size_in_mantissa])? rounded_mantissa[size_in_mantissa : 1] :
        assign resulted_m_o = (rounded_mantissa[size_in_mantissa])? rounded_mantissa[size_in_mantissa : 1] :
                                                                                                                                rounded_mantissa[size_in_mantissa-1:0];
                                                                                                                                rounded_mantissa[size_in_mantissa-1:0];
 
 
        assign adjust_exponent = rounded_mantissa[size_in_mantissa]? 2'd2 : 2'd1;
        assign adjust_exponent = rounded_mantissa[size_in_mantissa]? 2'd2 : 2'd1;
 
 

powered by: WebSVN 2.1.0

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