source: XOpenSparcT1/trunk/T1-common/common/swrvr_dlib.v @ 6

Revision 6, 6.5 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: swrvr_dlib.v
4// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21// DP library
22
23// 2:1 MUX WITH ENCODED SELECT
24module dp_mux2es (dout, in0, in1, sel) ;
25// synopsys template
26
27parameter SIZE = 1;
28
29output  [SIZE-1:0]      dout;
30input   [SIZE-1:0]      in0;
31input   [SIZE-1:0]      in1;
32input                   sel;
33
34reg     [SIZE-1:0]      dout ;
35
36always @ (sel or in0 or in1)
37
38 begin
39           case (sel)
40             1'b1: dout = in1 ; 
41             1'b0: dout = in0;
42             default: 
43         begin
44            if (in0 == in1) begin
45               dout = in0;
46            end
47            else
48              dout = {SIZE{1'bx}};
49         end
50           endcase // case(sel)
51 end
52
53endmodule // dp_mux2es
54
55// ----------------------------------------------------------------------
56
57
58// 4:1 MUX WITH DECODED SELECTS
59module dp_mux4ds (dout, in0, in1, in2, in3, 
60                     sel0_l, sel1_l, sel2_l, sel3_l) ;
61// synopsys template
62
63parameter SIZE = 1;
64
65output  [SIZE-1:0]      dout;
66input   [SIZE-1:0]      in0;
67input   [SIZE-1:0]      in1;
68input   [SIZE-1:0]      in2;
69input   [SIZE-1:0]      in3;
70input                   sel0_l;
71input                   sel1_l;
72input                   sel2_l;
73input                   sel3_l;
74
75// reg declaration does not imply state being maintained
76// across cycles. Used to construct case statement and
77// always updated by inputs every cycle.
78reg     [SIZE-1:0]      dout ;
79
80`ifdef VERPLEX
81   $constraint dl_1c_chk4 ($one_cold ({sel3_l,sel2_l,sel1_l,sel0_l}));
82`endif
83
84wire [3:0] sel = {sel3_l,sel2_l,sel1_l,sel0_l}; // 0in one_cold
85   
86always @ (sel0_l or sel1_l or sel2_l or sel3_l or in0 or in1 or in2 or in3)
87
88        case ({sel3_l,sel2_l,sel1_l,sel0_l})
89                4'b1110 : dout = in0 ;
90                4'b1101 : dout = in1 ;
91                4'b1011 : dout = in2 ;
92                4'b0111 : dout = in3 ;
93                4'b1111 : dout = {SIZE{1'bx}} ;
94                default : dout = {SIZE{1'bx}} ;
95        endcase
96
97endmodule // dp_mux4ds
98
99// ----------------------------------------------------------------------
100
101
102// 5:1 MUX WITH DECODED SELECTS
103module dp_mux5ds (dout, in0, in1, in2, in3,  in4,
104                     sel0_l, sel1_l, sel2_l, sel3_l, sel4_l) ;
105// synopsys template
106
107parameter SIZE = 1;
108
109output  [SIZE-1:0]      dout;
110input   [SIZE-1:0]      in0;
111input   [SIZE-1:0]      in1;
112input   [SIZE-1:0]      in2;
113input   [SIZE-1:0]      in3;
114input   [SIZE-1:0]      in4;
115input                   sel0_l;
116input                   sel1_l;
117input                   sel2_l;
118input                   sel3_l;
119input                   sel4_l;
120
121// reg declaration does not imply state being maintained
122// across cycles. Used to construct case statement and
123// always updated by inputs every cycle.
124reg     [SIZE-1:0]      dout ;
125
126`ifdef VERPLEX
127   $constraint dl_1c_chk5 ($one_cold ({sel4_l,sel3_l,sel2_l,sel1_l,sel0_l}));
128`endif
129   
130wire [4:0] sel = {sel4_l,sel3_l,sel2_l,sel1_l,sel0_l}; // 0in one_cold
131
132always @ (sel0_l or sel1_l or sel2_l or sel3_l or sel4_l or
133                in0 or in1 or in2 or in3 or in4)
134
135        case ({sel4_l,sel3_l,sel2_l,sel1_l,sel0_l})
136                5'b11110 : dout = in0 ;
137                5'b11101 : dout = in1 ;
138                5'b11011 : dout = in2 ;
139                5'b10111 : dout = in3 ;
140                5'b01111 : dout = in4 ;
141                5'b11111 : dout = {SIZE{1'bx}} ;
142                default : dout = {SIZE{1'bx}} ;
143        endcase
144
145endmodule // dp_mux5ds
146
147// --------------------------------------------------------------------
148
149// 8:1 MUX WITH DECODED SELECTS
150module dp_mux8ds (dout, in0, in1, in2, in3, 
151                        in4, in5, in6, in7,
152                     sel0_l, sel1_l, sel2_l, sel3_l,
153                     sel4_l, sel5_l, sel6_l, sel7_l) ;
154// synopsys template
155
156parameter SIZE = 1;
157
158output  [SIZE-1:0]      dout;
159input   [SIZE-1:0]      in0;
160input   [SIZE-1:0]      in1;
161input   [SIZE-1:0]      in2;
162input   [SIZE-1:0]      in3;
163input   [SIZE-1:0]      in4;
164input   [SIZE-1:0]      in5;
165input   [SIZE-1:0]      in6;
166input   [SIZE-1:0]      in7;
167input                   sel0_l;
168input                   sel1_l;
169input                   sel2_l;
170input                   sel3_l;
171input                   sel4_l;
172input                   sel5_l;
173input                   sel6_l;
174input                   sel7_l;
175
176// reg declaration does not imply state being maintained
177// across cycles. Used to construct case statement and
178// always updated by inputs every cycle.
179reg     [SIZE-1:0]      dout ;
180
181`ifdef VERPLEX
182   $constraint dl_1c_chk8 ($one_cold ({sel7_l,sel6_l,sel5_l,sel4_l,
183                                       sel3_l,sel2_l,sel1_l,sel0_l}));
184`endif
185
186wire [7:0] sel = {sel7_l,sel6_l,sel5_l,sel4_l,
187                  sel3_l,sel2_l,sel1_l,sel0_l}; // 0in one_cold
188
189always @ (sel0_l or sel1_l or sel2_l or sel3_l or in0 or in1 or in2 or in3 or
190          sel4_l or sel5_l or sel6_l or sel7_l or in4 or in5 or in6 or in7)
191
192        case ({sel7_l,sel6_l,sel5_l,sel4_l,sel3_l,sel2_l,sel1_l,sel0_l})
193                8'b11111110 : dout = in0 ;
194                8'b11111101 : dout = in1 ;
195                8'b11111011 : dout = in2 ;
196                8'b11110111 : dout = in3 ;
197                8'b11101111 : dout = in4 ;
198                8'b11011111 : dout = in5 ;
199                8'b10111111 : dout = in6 ;
200                8'b01111111 : dout = in7 ;
201                8'b11111111 : dout = {SIZE{1'bx}} ;
202                default : dout = {SIZE{1'bx}} ;
203        endcase
204
205endmodule // dp_mux8ds
206
207
208// ----------------------------------------------------------------------
209
210
211// 3:1 MUX WITH DECODED SELECTS
212module dp_mux3ds (dout, in0, in1, in2, 
213                     sel0_l, sel1_l, sel2_l);
214// synopsys template
215
216parameter SIZE = 1;
217
218output  [SIZE-1:0]      dout;
219input   [SIZE-1:0]      in0;
220input   [SIZE-1:0]      in1;
221input   [SIZE-1:0]      in2;
222input                   sel0_l;
223input                   sel1_l;
224input                   sel2_l;
225
226// reg declaration does not imply state being maintained
227// across cycles. Used to construct case statement and
228// always updated by inputs every cycle.
229reg     [SIZE-1:0]      dout ;
230
231`ifdef VERPLEX
232   $constraint dl_1c_chk3 ($one_cold ({sel2_l,sel1_l,sel0_l}));
233`endif
234
235wire [2:0] sel = {sel2_l,sel1_l,sel0_l}; // 0in one_cold
236   
237always @ (sel0_l or sel1_l or sel2_l or in0 or in1 or in2)
238
239        case ({sel2_l,sel1_l,sel0_l})
240                3'b110 : dout = in0 ;
241                3'b101 : dout = in1 ;
242                3'b011 : dout = in2 ;
243                default : dout = {SIZE{1'bx}} ;
244        endcase
245
246endmodule // dp_mux3ds
247
248// ----------------------------------------------------------------------
249
250
251module dp_buffer(dout, in);
252// synopsys template
253
254parameter SIZE = 1;
255
256output  [SIZE-1:0]      dout;
257input   [SIZE-1:0]      in;
258
259assign dout = in;
260
261endmodule // dp_buffer
262
263
264
265
266
267
268
269
270
Note: See TracBrowser for help on using the repository browser.