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/] [GeneralPrecMAFMappedConversions/] [rounding.v] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 constantin
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
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
// Description: A ± B
13
//
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
                                        output[SIZE_MOST_S_MANTISSA - 1 : 0] rounded_mantissa);
27
 
28
        wire g, sticky, round_dec;
29
 
30
        assign g = dummy_bits[SIZE_LEAST_S_MANTISSA - 1];
31
        assign sticky = |(dummy_bits[SIZE_LEAST_S_MANTISSA - 2 : 0]);
32
        assign round_dec = g & (unrounded_mantissa[0] | sticky);
33
        assign rounded_mantissa = unrounded_mantissa + round_dec;
34
 
35
endmodule

powered by: WebSVN 2.1.0

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