OpenCores
URL https://opencores.org/ocsvn/raptor64/raptor64/trunk

Subversion Repositories raptor64

[/] [raptor64/] [trunk/] [rtl/] [verilog/] [fp/] [fpLOOUnit.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 robfinch
/* ===============================================================
2
        (C) 2006  Robert Finch
3
        All rights reserved.
4
        rob@birdcomputer.ca
5
 
6
        fpLOOUnit.v
7
                - 'latency of one' floating point unit
8
                - instructions can execute using a single cycle
9
                - issue rate is one per clock cycle
10
                - latency is one clock cycle
11
                - parameterized width
12
                - IEEE 754 representation
13
 
14
        This source code is free for use and modification for
15
        non-commercial or evaluation purposes, provided this
16
        copyright statement and disclaimer remains present in
17
        the file.
18
 
19
        If the code is modified, please state the origin and
20
        note that the code has been modified.
21
 
22
        NO WARRANTY.
23
        THIS Work, IS PROVIDEDED "AS IS" WITH NO WARRANTIES OF
24
        ANY KIND, WHETHER EXPRESS OR IMPLIED. The user must assume
25
        the entire risk of using the Work.
26
 
27
        IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
28
        ANY INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES
29
        WHATSOEVER RELATING TO THE USE OF THIS WORK, OR YOUR
30
        RELATIONSHIP WITH THE AUTHOR.
31
 
32
        IN ADDITION, IN NO EVENT DOES THE AUTHOR AUTHORIZE YOU
33
        TO USE THE WORK IN APPLICATIONS OR SYSTEMS WHERE THE
34
        WORK'S FAILURE TO PERFORM CAN REASONABLY BE EXPECTED
35
        TO RESULT IN A SIGNIFICANT PHYSICAL INJURY, OR IN LOSS
36
        OF LIFE. ANY SUCH USE BY YOU IS ENTIRELY AT YOUR OWN RISK,
37
        AND YOU AGREE TO HOLD THE AUTHOR AND CONTRIBUTORS HARMLESS
38
        FROM ANY CLAIMS OR LOSSES RELATING TO SUCH UNAUTHORIZED
39
        USE.
40
 
41
 
42
        i2f - convert integer to floating point
43
        f2i - convert floating point to integer
44
 
45
        Ref: Webpack 8.1i  Spartan3-4 xc3s1000 4ft256
46
        61 LUTS / 34 slices / 16 ns
47
=============================================================== */
48
 
49
module fpLOOUnit
50
#(parameter WID=32)
51
(
52
        input clk,
53
        input ce,
54
        input [1:0] rm,
55
        input [5:0] op,
56
        input [WID:1] a,
57
        output reg [WID:1] o,
58
        output done
59
);
60
localparam MSB = WID-1;
61
localparam EMSB = WID==80 ? 14 :
62
                  WID==64 ? 10 :
63
                                  WID==52 ? 10 :
64
                                  WID==48 ? 10 :
65
                                  WID==44 ? 10 :
66
                                  WID==42 ? 10 :
67
                                  WID==40 ?  9 :
68
                                  WID==32 ?  7 :
69
                                  WID==24 ?  6 : 4;
70
localparam FMSB = WID==80 ? 63 :
71
                  WID==64 ? 51 :
72
                                  WID==52 ? 39 :
73
                                  WID==48 ? 35 :
74
                                  WID==44 ? 31 :
75
                                  WID==42 ? 29 :
76
                                  WID==40 ? 28 :
77
                                  WID==32 ? 22 :
78
                                  WID==24 ? 15 : 9;
79
 
80
wire [WID:1] i2f_o;
81
wire [WID:1] f2i_o;
82
 
83
delay1 u1 (.clk(clk), .ce(ce), .i(op==6'd13||op==6'd14), .o(done) );
84
i2f  i2f0 (.clk(clk), .ce(ce), .rm(rm), .i(a), .o(i2f_o) );
85
f2i  f2i0 (.clk(clk), .ce(ce), .i(a), .o(f2i_o) );
86
 
87
always @(op,a,i2f_o,f2i_o)
88
        case (op)
89
        6'd13:  o <= i2f_o;
90
        6'd14:  o <= f2i_o;
91
        default:        o <= 0;
92
        endcase
93
 
94
endmodule

powered by: WebSVN 2.1.0

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