sudp_sc.v
10.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
/*
*************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************
*/
/*
*************************************************************************
* *
* Project Reality *
* *
* module: sudp_sc.v *
* description: Scalar unit data path, standard cell version *
* *
* designer: Phil Gossett *
* date: 4/7/95 *
* *
*************************************************************************
*/
// $Id: sudp_sc.v,v 1.3 2003/01/03 23:53:45 berndt Exp $
module sudp_sc (clk, surf_wen, surf_w, surf_ra, surf_rb,
suwben, suimmlsmux, suimmmux, suvulsoffsetmux, surdbmux,
sudrivels, surdamux, suonesdet_z,
sushbmux, sushamux, suslten, sualuen, sualu_ovr, sualu_cout,
sualu_cin, sualu, sualuamux, sualubmux, inst_data, link_pc_delay_pc,
branch_or_addr, ls_data, su_ls_data, suexbsign, sushvamt,
suexasign, susltlt, sualumsb, shiftamt);
input clk;
input surf_wen; // reg file write enable
input [4:0] surf_w; // reg file write address
input [4:0] surf_ra; // reg file read A port address
input [4:0] surf_rb; // reg file read B port address
input suwben;
input suimmlsmux; // was 2 bit unary
input [1:0] suimmmux; // was 4 bit unary
input [2:0] suvulsoffsetmux; // was 5 bit unary
input [2:0] surdbmux; // was 6 bit unary
// deleted input suloaden (complement of suwben)
input sudrivels;
input [2:0] surdamux; // was 5 bit unary
output suonesdet_z;
// deleted input sushift_s (unused, always 0)
input [1:0] sushbmux; // was 3 bit unary
input [1:0] sushamux; // was 4 bit unary
input suslten;
// deleted input sushen (complement of sualuen and suslten)
input sualuen;
output sualu_ovr;
output sualu_cout;
input sualu_cin;
input [4:0] sualu;
input sualuamux; // was 2 bit unary
input sualubmux; // was 2 bit unary
input [15:0] inst_data;
input [23:0] link_pc_delay_pc;
output [11:0] branch_or_addr;
input [31:0] ls_data;
output [31:0] su_ls_data;
output suexbsign;
output [4:0] sushvamt;
output suexasign;
input susltlt;
output sualumsb;
input [4:0] shiftamt; // was 32 bit unary
wire [31:0] ls_offset;
wire [31:0] ex_b_src; // was b15
wire [31:0] rd_a_src; // was b16
wire [31:0] ex_a_src; // was b17
wire [31:0] imm_data;
// deleted wire b23 (unused???)
wire [31:0] rt;
wire [31:0] ex_data;
wire [31:0] df_data;
wire [31:0] wb_data;
wire [31:0] ex_imm_data;
wire [31:0] rd_imm_data; // was b31
wire [31:0] rd_b_src;
wire [31:0] rs;
wire [31:0] alu_out; // was b38
// deleted wire b40 (now inside sudp_eq)
wire [31:0] sh_b_src;
wire [31:0] sh_a_src;
wire [31:0] shift_out;
wire [31:0] alu_a_src;
wire [31:0] alu_b_src;
wire [31:0] pre_wb_data; // was b54
wire [31:0] alu_shift_out; // new signal
wire [31:0] inst_data_buf; // new signal
assign branch_or_addr[11:0] = alu_out[11:0];
assign suexbsign = ex_b_src[31];
assign sushvamt[4:0] = rd_a_src[4:0];
assign suexasign = ex_a_src[31];
assign sualumsb = alu_out[31];
sudp_rf surfilei(
.clk(clk),
.d(wb_data[31:0]),
.a(rs[31:0]),
.b(rt[31:0]),
.wen(surf_wen),
.w(surf_w[4:0]),
.ra(surf_ra[4:0]),
.rb(surf_rb[4:0]));
sudp_reg suedffi(
.d(ex_data[31:0]),
.q(df_data[31:0]),
.clk(clk));
sudp_reg sudwffi(
.d(df_data[31:0]),
.q(pre_wb_data[31:0]),
.clk(clk));
sudp_mx21 suimmlsmuxi(
.z(rd_imm_data[31:0]),
.i1(ls_offset[31:0]),
.i0(imm_data[31:0]),
.s(suimmlsmux));
sudp_reg sureinstffi(
.d(rd_imm_data[31:0]),
.q(ex_imm_data[31:0]),
.clk(clk));
sudp_buf sudpbufi(
.i({{4{inst_data[15]}}, {12{inst_data[6]}}, inst_data}),
.z(inst_data_buf)); // note the msb's are copied bufs
sudp_mx41 suimmmuxi(
.z(imm_data[31:0]),
.i0({16'd0, inst_data_buf[15:0]}),
.i1({inst_data_buf[28],
inst_data_buf[28], inst_data_buf[28], inst_data_buf[28],
inst_data_buf[28], inst_data_buf[28], inst_data_buf[28],
inst_data_buf[28], inst_data_buf[29], inst_data_buf[29],
inst_data_buf[29], inst_data_buf[29], inst_data_buf[29],
inst_data_buf[29], inst_data_buf[29], inst_data_buf[29],
inst_data_buf[30], inst_data_buf[14:0]}),
.i2({inst_data_buf[15:0], 16'd0}),
.i3({inst_data_buf[30],
inst_data_buf[30], inst_data_buf[30], inst_data_buf[30],
inst_data_buf[30], inst_data_buf[30], inst_data_buf[30],
inst_data_buf[31], inst_data_buf[31], inst_data_buf[31],
inst_data_buf[31], inst_data_buf[31], inst_data_buf[31],
inst_data_buf[31], inst_data_buf[31],
inst_data_buf[14:0], 2'd0}),
.s(suimmmux[1:0]));
sudp_mx81 suvulsoffsetmuxi(
.z(ls_offset[31:0]),
.i0({inst_data_buf[16], inst_data_buf[16],
inst_data_buf[16], inst_data_buf[16], inst_data_buf[16],
inst_data_buf[16], inst_data_buf[16], inst_data_buf[16],
inst_data_buf[16], inst_data_buf[17], inst_data_buf[17],
inst_data_buf[17], inst_data_buf[17], inst_data_buf[17],
inst_data_buf[17], inst_data_buf[17], inst_data_buf[17],
inst_data_buf[17], inst_data_buf[17], inst_data_buf[18],
inst_data_buf[18], inst_data_buf[18], inst_data_buf[18],
inst_data_buf[18], inst_data_buf[18], inst_data_buf[18],
inst_data_buf[5:0]}),
.i1({inst_data_buf[18], inst_data_buf[18],
inst_data_buf[18], inst_data_buf[19], inst_data_buf[19],
inst_data_buf[19], inst_data_buf[19], inst_data_buf[19],
inst_data_buf[19], inst_data_buf[19], inst_data_buf[19],
inst_data_buf[19], inst_data_buf[19], inst_data_buf[20],
inst_data_buf[20], inst_data_buf[20], inst_data_buf[20],
inst_data_buf[20], inst_data_buf[20], inst_data_buf[20],
inst_data_buf[20], inst_data_buf[20], inst_data_buf[20],
inst_data_buf[21], inst_data_buf[21],
inst_data_buf[5:0], 1'b0}),
.i2({inst_data_buf[21], inst_data_buf[21],
inst_data_buf[21], inst_data_buf[21], inst_data_buf[21],
inst_data_buf[21], inst_data_buf[21], inst_data_buf[21],
inst_data_buf[22], inst_data_buf[22], inst_data_buf[22],
inst_data_buf[22], inst_data_buf[22], inst_data_buf[22],
inst_data_buf[22], inst_data_buf[22], inst_data_buf[22],
inst_data_buf[22], inst_data_buf[23], inst_data_buf[23],
inst_data_buf[23], inst_data_buf[23], inst_data_buf[23],
inst_data_buf[23],
inst_data_buf[5:0], 2'd0}),
.i3({inst_data_buf[23], inst_data_buf[23],
inst_data_buf[23], inst_data_buf[23], inst_data_buf[23],
inst_data_buf[24], inst_data_buf[24], inst_data_buf[24],
inst_data_buf[24], inst_data_buf[24], inst_data_buf[24],
inst_data_buf[24], inst_data_buf[24], inst_data_buf[24],
inst_data_buf[24], inst_data_buf[25], inst_data_buf[25],
inst_data_buf[25], inst_data_buf[25], inst_data_buf[25],
inst_data_buf[25], inst_data_buf[25], inst_data_buf[25],
inst_data_buf[5:0], 3'd0}),
.i4({inst_data_buf[25], inst_data_buf[25],
inst_data_buf[26], inst_data_buf[26], inst_data_buf[26],
inst_data_buf[26], inst_data_buf[26], inst_data_buf[26],
inst_data_buf[26], inst_data_buf[26], inst_data_buf[26],
inst_data_buf[26], inst_data_buf[27], inst_data_buf[27],
inst_data_buf[27], inst_data_buf[27], inst_data_buf[27],
inst_data_buf[27], inst_data_buf[27], inst_data_buf[27],
inst_data_buf[27], inst_data_buf[27],
inst_data_buf[5:0], 4'd0}),
.i5(32'd0),
.i6(32'd0),
.i7(32'd0),
.s(suvulsoffsetmux[2:0]));
sudp_mx81 surdbmuxi(
.z(rd_b_src[31:0]),
.i0(rt[31:0]),
.i1(ex_data[31:0]),
.i2(df_data[31:0]),
.i3(wb_data[31:0]),
.i4(imm_data[31:0]),
.i5(32'd0),
.i6(32'd0),
.i7(32'd0),
.s(surdbmux[2:0]));
sudp_reg surebffi(
.d(rd_b_src[31:0]),
.q(ex_b_src[31:0]),
.clk(clk));
sudp_mx21 suwbenmuxi(
.z(wb_data[31:0]),
.i0(ls_data[31:0]),
.i1(pre_wb_data[31:0]),
.s(suwben));
//sudp_tri sudrivelsi(
// .i(ex_b_src[31:0]),
// .z(ls_data_out[31:0]),
// .en(sudrivels));
wire [31:0] su_ls_data = sudrivels ? ex_b_src : 32'b0;
sudp_mx81 surdamuxi(
.z(rd_a_src[31:0]),
.i0(rs[31:0]),
.i1(ex_data[31:0]),
.i2(df_data[31:0]),
.i3(wb_data[31:0]),
.i4(32'd0),
.i5(32'd0),
.i6(32'd0),
.i7(32'd0),
.s(surdamux[2:0]));
sudp_reg sureaffi(
.d(rd_a_src[31:0]),
.q(ex_a_src[31:0]),
.clk(clk));
sudp_shift sushifti(
.a(sh_a_src[31:0]),
.b(sh_b_src[31:0]),
.z(shift_out[31:0]),
.s(shiftamt[4:0]));
sudp_mx41 sushbmuxi(
.z(sh_b_src[31:0]),
.i0({1'b0, ex_b_src[31:1]}),
.i1(32'd0),
.i2({32{1'b1}}),
.i3(32'd0),
.s(sushbmux[1:0]));
sudp_eq sueqi(
.a(ex_a_src[31:0]),
.b(ex_b_src[31:0]),
.z(suonesdet_z));
sudp_mx41 sushamuxi(
.z(sh_a_src[31:0]),
.i0(ex_a_src[31:0]),
.i1({ex_b_src[0], 31'd0}),
.i2(ex_b_src[31:0]),
.i3({8'd0, link_pc_delay_pc[23:0]}),
.s(sushamux[1:0]));
sudp_mx21 sualumuxi(
.i0(shift_out[31:0]),
.i1(alu_out[31:0]),
.z(alu_shift_out[31:0]),
.s(sualuen));
sudp_mx21 susltmuxi(
.i0(alu_shift_out[31:0]),
.i1({31'd0, susltlt}),
.z(ex_data[31:0]),
.s(suslten));
sudp_alu sualui(
.a(alu_a_src[31:0]),
.b(alu_b_src[31:0]),
.s(alu_out[31:0]),
.co30(sualu_ovr),
.co(sualu_cout),
.ci(sualu_cin),
.m(sualu[4:0]));
sudp_mx21 sualuamuxi(
.z(alu_a_src[31:0]),
.i1({8'd0, link_pc_delay_pc[23:0]}),
.i0(ex_a_src[31:0]),
.s(sualuamux));
sudp_mx21 sualubmuxi(
.z(alu_b_src[31:0]),
.i1(ex_imm_data[31:0]),
.i0(ex_b_src[31:0]),
.s(sualubmux));
endmodule // sudp_sc