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/] [SinglePathFPAdder/] [rounding.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:    16:09:49 11/04/2013 
7
// Design Name: 
8
// Module Name:    rounding 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12 18 constantin
// Description: A ± B rounding
13 8 constantin
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
 
22
module rounding #(      parameter SIZE_MOST_S_MANTISSA = 24,
23
                                        parameter SIZE_LEAST_S_MANTISSA= 25)
24
                                (       input [SIZE_MOST_S_MANTISSA - 1 : 0] unrounded_mantissa,
25
                                        input [SIZE_LEAST_S_MANTISSA- 1 : 0] dummy_bits,
26 18 constantin
                                        input correction,
27
                                        input eff_op,
28 8 constantin
                                        output[SIZE_MOST_S_MANTISSA - 1 : 0] rounded_mantissa);
29 18 constantin
 
30
        wire g,r, sticky, round_dec;
31
 
32
        assign g                = dummy_bits[SIZE_LEAST_S_MANTISSA - 1];
33
        assign sticky   = (|(dummy_bits[SIZE_LEAST_S_MANTISSA - 3 : 0]));
34
        assign round    = dummy_bits[SIZE_LEAST_S_MANTISSA - 2];
35
 
36
        assign round_dec                = (g & (unrounded_mantissa[0] | sticky | round));
37
        assign rounded_mantissa = (correction? (round_dec? unrounded_mantissa : unrounded_mantissa - 1'b1) : (round_dec? unrounded_mantissa + 1 : unrounded_mantissa));
38 8 constantin
 
39
endmodule

powered by: WebSVN 2.1.0

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