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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_fpu_intfloat_conv_except.v] - Blame information for rev 797

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 794 julius
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  or1200_fpu_intfloat_conv_except                            ////
4
////                                                             ////
5
////  Author: Rudolf Usselmann                                   ////
6
////          rudi@asics.ws                                      ////
7
////                                                             ////
8
//// Modified by Julius Baxter, July, 2010                       ////
9
////             julius.baxter@orsoc.se                          ////
10
////                                                             ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2000 Rudolf Usselmann                         ////
15
////                    rudi@asics.ws                            ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
`timescale 1ns / 100ps
39
 
40
module or1200_fpu_intfloat_conv_except
41
  (
42
        clk, opa, opb, inf, ind, qnan, snan, opa_nan, opb_nan,
43
        opa_00, opb_00, opa_inf, opb_inf, opa_dn, opb_dn
44
        );
45
   input                clk;
46
   input [31:0]  opa, opb;
47
   output               inf, ind, qnan, snan, opa_nan, opb_nan;
48
   output               opa_00, opb_00;
49
   output               opa_inf, opb_inf;
50
   output               opa_dn;
51
   output               opb_dn;
52
 
53
   ////////////////////////////////////////////////////////////////////////
54
   //
55
   // Local Wires and registers
56
   //
57
 
58
   wire [7:0]            expa, expb;             // alias to opX exponent
59
   wire [22:0]           fracta, fractb;         // alias to opX fraction
60
   reg                  expa_ff, infa_f_r, qnan_r_a, snan_r_a;
61
   reg                  expb_ff, infb_f_r, qnan_r_b, snan_r_b;
62
   reg                  inf, ind, qnan, snan;   // Output registers
63
   reg                  opa_nan, opb_nan;
64
   reg                  expa_00, expb_00, fracta_00, fractb_00;
65
   reg                  opa_00, opb_00;
66
   reg                  opa_inf, opb_inf;
67
   reg                  opa_dn, opb_dn;
68
 
69
   ////////////////////////////////////////////////////////////////////////
70
   //
71
   // Aliases
72
   //
73
 
74
   assign   expa = opa[30:23];
75
   assign   expb = opb[30:23];
76
   assign fracta = opa[22:0];
77
   assign fractb = opb[22:0];
78
 
79
   ////////////////////////////////////////////////////////////////////////
80
   //
81
   // Determine if any of the input operators is a INF or NAN or any other 
82
   // special number
83
   //
84
 
85
   always @(posedge clk)
86
     expa_ff <=  &expa;
87
 
88
   always @(posedge clk)
89
     expb_ff <=  &expb;
90
 
91
   always @(posedge clk)
92
     infa_f_r <=  !(|fracta);
93
 
94
   always @(posedge clk)
95
     infb_f_r <=  !(|fractb);
96
 
97
   always @(posedge clk)
98
     qnan_r_a <=   fracta[22];
99
 
100
   always @(posedge clk)
101
     snan_r_a <=  !fracta[22] & |fracta[21:0];
102
 
103
   always @(posedge clk)
104
     qnan_r_b <=   fractb[22];
105
 
106
   always @(posedge clk)
107
     snan_r_b <=  !fractb[22]; // & |fractb[21:0];
108
 
109
   always @(posedge clk)
110
     ind  <=  (expa_ff & infa_f_r); // & (expb_ff & infb_f_r);
111
 
112
   always @(posedge clk)
113
     inf  <=  (expa_ff & infa_f_r); // | (expb_ff & infb_f_r);
114
 
115
   always @(posedge clk)
116
     qnan <=  (expa_ff & qnan_r_a); // | (expb_ff & qnan_r_b);
117
 
118
   always @(posedge clk)
119
     snan <=  (expa_ff & snan_r_a); // | (expb_ff & snan_r_b);
120
 
121
   always @(posedge clk)
122
     opa_nan <=  &expa & (|fracta[22:0]);
123
 
124
   always @(posedge clk)
125
     opb_nan <=  &expb & (|fractb[22:0]);
126
 
127
   always @(posedge clk)
128
     opa_inf <=  (expa_ff & infa_f_r);
129
 
130
   always @(posedge clk)
131
     opb_inf <=  (expb_ff & infb_f_r);
132
 
133
   always @(posedge clk)
134
     expa_00 <=  !(|expa);
135
 
136
   always @(posedge clk)
137
     expb_00 <=  !(|expb);
138
 
139
   always @(posedge clk)
140
     fracta_00 <=  !(|fracta);
141
 
142
   always @(posedge clk)
143
     fractb_00 <=  !(|fractb);
144
 
145
   always @(posedge clk)
146
     opa_00 <=  expa_00 & fracta_00;
147
 
148
   always @(posedge clk)
149
     opb_00 <=  expb_00 & fractb_00;
150
 
151
   always @(posedge clk)
152
     opa_dn <=  expa_00;
153
 
154
   always @(posedge clk)
155
     opb_dn <=  expb_00;
156
 
157
endmodule // or1200_fpu_intfloat_conv_except

powered by: WebSVN 2.1.0

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