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

Subversion Repositories async_sdm_noc

[/] [async_sdm_noc/] [trunk/] [common/] [src/] [dclos.v] - Blame information for rev 49

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

Line No. Rev Author Line
1 12 wsong0210
/*
2
 Asynchronous SDM NoC
3
 (C)2011 Wei Song
4
 Advanced Processor Technologies Group
5
 Computer Science, the Univ. of Manchester, UK
6
 
7
 Authors:
8
 Wei Song     wsong83@gmail.com
9
 
10
 License: LGPL 3.0 or later
11
 
12
 Data Clos network.
13
 *** SystemVerilog is used ***
14
 
15
 History:
16
 17/07/2010  Initial version. <wsong83@gmail.com>
17
 20/09/2010  Supporting channel slicing and SDM using macro difinitions. <wsong83@gmail.com>
18
 23/05/2011  Clean up for opensource. <wsong83@gmail.com>
19
 
20
*/
21
 
22
// the router structure definitions
23
`include "define.v"
24
 
25
module dclos (/*AUTOARG*/
26
   // Outputs
27
   so0, so1, so2, so3, wo0, wo1, wo2, wo3, no0, no1, no2, no3, eo0,
28
   eo1, eo2, eo3, lo0, lo1, lo2, lo3, so4, wo4, no4, eo4, lo4, sia,
29
   wia, nia, eia, lia,
30
   // Inputs
31
   si0, si1, si2, si3, wi0, wi1, wi2, wi3, ni0, ni1, ni2, ni3, ei0,
32
   ei1, ei2, ei3, li0, li1, li2, li3, si4, wi4, ni4, ei4, li4, soa,
33
   woa, noa, eoa, loa, imcfg, scfg, ncfg, wcfg, ecfg, lcfg
34
   );
35
 
36
   parameter MN = 2;            // number of CMs
37
   parameter NN = 2;            // number of ports in an IM or OM, equ. to number of virtual circuits
38
   parameter DW = 8;            // datawidth of a single virtual circuit/port
39
   parameter SCN = DW/2;        // number of 1-of-4 sub-channels in one port
40
 
41
   input [NN-1:0][SCN-1:0]     si0, si1, si2, si3; // south input [0], X+1
42
   input [NN-1:0][SCN-1:0]     wi0, wi1, wi2, wi3; // west input [1], Y-1
43
   input [NN-1:0][SCN-1:0]     ni0, ni1, ni2, ni3; // north input [2], X-1
44
   input [NN-1:0][SCN-1:0]     ei0, ei1, ei2, ei3; // east input [3], Y+1
45
   input [NN-1:0][SCN-1:0]     li0, li1, li2, li3; // local input
46
   output [NN-1:0][SCN-1:0]    so0, so1, so2, so3; // south output
47
   output [NN-1:0][SCN-1:0]    wo0, wo1, wo2, wo3; // west output
48
   output [NN-1:0][SCN-1:0]    no0, no1, no2, no3; // north output
49
   output [NN-1:0][SCN-1:0]    eo0, eo1, eo2, eo3; // east output
50
   output [NN-1:0][SCN-1:0]    lo0, lo1, lo2, lo3; // local output
51
 
52
   // eof bits and ack lines
53
`ifdef ENABLE_CHANNEL_SLICING
54
   input [NN-1:0][SCN-1:0]     si4, wi4, ni4, ei4, li4;
55
   output [NN-1:0][SCN-1:0]    so4, wo4, no4, eo4, lo4;
56
   output [NN-1:0][SCN-1:0]    sia, wia, nia, eia, lia;
57
   input [NN-1:0][SCN-1:0]     soa, woa, noa, eoa, loa;
58
`else
59
   input [NN-1:0]               si4, wi4, ni4, ei4, li4;
60
   output [NN-1:0]              so4, wo4, no4, eo4, lo4;
61
   output [NN-1:0]              sia, wia, nia, eia, lia;
62
   input [NN-1:0]               soa, woa, noa, eoa, loa;
63
`endif // !`ifdef ENABLE_CHANNEL_SLICING
64
 
65
   input [4:0][MN-1:0][NN-1:0] imcfg; // configuration for IMs
66
   // configuration for CMs
67
   input [MN-1:0][1:0]           scfg, ncfg;
68
   input [MN-1:0][3:0]           wcfg, ecfg, lcfg;
69
   // no OMs
70
 
71
   // output of IMs
72
   wire [MN-1:0][SCN-1:0]      imos0, imos1, imos2, imos3;
73
   wire [MN-1:0][SCN-1:0]      imow0, imow1, imow2, imow3;
74
   wire [MN-1:0][SCN-1:0]      imon0, imon1, imon2, imon3;
75
   wire [MN-1:0][SCN-1:0]      imoe0, imoe1, imoe2, imoe3;
76
   wire [MN-1:0][SCN-1:0]      imol0, imol1, imol2, imol3;
77
`ifdef ENABLE_CHANNEL_SLICING
78
   wire [MN-1:0][SCN-1:0]      imos4, imow4, imon4, imoe4, imol4;
79
   wire [MN-1:0][SCN-1:0]      imosa, imowa, imona, imoea, imola;
80
`else
81
   wire [MN-1:0]                imos4, imow4, imon4, imoe4, imol4;
82
   wire [MN-1:0]                imosa, imowa, imona, imoea, imola;
83
`endif
84
 
85
   // input of CMs
86
   wire [MN-1:0][4:0][SCN-1:0] cmi0, cmi1, cmi2, cmi3;
87
`ifdef ENABLE_CHANNEL_SLICING
88
   wire [MN-1:0][4:0][SCN-1:0] cmi4, cmia;
89
`else
90
   wire [MN-1:0][4:0]            cmi4, cmia;
91
`endif
92
 
93
   // output of CMs
94
   wire [MN-1:0][4:0][SCN-1:0] cmo0, cmo1, cmo2, cmo3;
95
`ifdef ENABLE_CHANNEL_SLICING
96
   wire [MN-1:0][4:0][SCN-1:0] cmo4, cmoa;
97
`else
98
   wire [MN-1:0][4:0]            cmo4, cmoa;
99
`endif
100
 
101
   genvar                      i,j,k;
102
 
103
   dcb #(.NN(NN), .MN(MN), .DW(DW))
104
   SIM (
105
       .o0  ( imos0    ),
106
       .o1  ( imos1    ),
107
       .o2  ( imos2    ),
108
       .o3  ( imos3    ),
109
       .o4  ( imos4    ),
110
       .ia  ( sia      ),
111
       .i0  ( si0      ),
112
       .i1  ( si1      ),
113
       .i2  ( si2      ),
114
       .i3  ( si3      ),
115
       .i4  ( si4      ),
116
       .oa  ( imosa    ),
117
       .cfg ( imcfg[0] )
118
       );
119
 
120
   dcb #(.NN(NN), .MN(MN), .DW(DW))
121
   WIM (
122
       .o0  ( imow0    ),
123
       .o1  ( imow1    ),
124
       .o2  ( imow2    ),
125
       .o3  ( imow3    ),
126
       .o4  ( imow4    ),
127
       .ia  ( wia      ),
128
       .i0  ( wi0      ),
129
       .i1  ( wi1      ),
130
       .i2  ( wi2      ),
131
       .i3  ( wi3      ),
132
       .i4  ( wi4      ),
133
       .oa  ( imowa    ),
134
       .cfg ( imcfg[1] )
135
       );
136
 
137
   dcb #(.NN(NN), .MN(MN), .DW(DW))
138
   NIM (
139
       .o0  ( imon0    ),
140
       .o1  ( imon1    ),
141
       .o2  ( imon2    ),
142
       .o3  ( imon3    ),
143
       .o4  ( imon4    ),
144
       .ia  ( nia      ),
145
       .i0  ( ni0      ),
146
       .i1  ( ni1      ),
147
       .i2  ( ni2      ),
148
       .i3  ( ni3      ),
149
       .i4  ( ni4      ),
150
       .oa  ( imona    ),
151
       .cfg ( imcfg[2] )
152
       );
153
 
154
   dcb #(.NN(NN), .MN(MN), .DW(DW))
155
   EIM (
156
       .o0  ( imoe0    ),
157
       .o1  ( imoe1    ),
158
       .o2  ( imoe2    ),
159
       .o3  ( imoe3    ),
160
       .o4  ( imoe4    ),
161
       .ia  ( eia      ),
162
       .i0  ( ei0      ),
163
       .i1  ( ei1      ),
164
       .i2  ( ei2      ),
165
       .i3  ( ei3      ),
166
       .i4  ( ei4      ),
167
       .oa  ( imoea    ),
168
       .cfg ( imcfg[3] )
169
       );
170
 
171
   dcb #(.NN(NN), .MN(MN), .DW(DW))
172
   LIM (
173
       .o0  ( imol0    ),
174
       .o1  ( imol1    ),
175
       .o2  ( imol2    ),
176
       .o3  ( imol3    ),
177
       .o4  ( imol4    ),
178
       .ia  ( lia      ),
179
       .i0  ( li0      ),
180
       .i1  ( li1      ),
181
       .i2  ( li2      ),
182
       .i3  ( li3      ),
183
       .i4  ( li4      ),
184
       .oa  ( imola    ),
185
       .cfg ( imcfg[4] )
186
       );
187
 
188
   generate for(i=0; i<MN; i++) begin: IMSHF
189
      // shuffle the interconnects between IMs and CMs
190
      assign cmi0[i][0] = imos0[i];
191
      assign cmi1[i][0] = imos1[i];
192
      assign cmi2[i][0] = imos2[i];
193
      assign cmi3[i][0] = imos3[i];
194
      assign cmi4[i][0] = imos4[i];
195
      assign imosa[i] = cmia[i][0];
196
 
197
      assign cmi0[i][1] = imow0[i];
198
      assign cmi1[i][1] = imow1[i];
199
      assign cmi2[i][1] = imow2[i];
200
      assign cmi3[i][1] = imow3[i];
201
      assign cmi4[i][1] = imow4[i];
202
      assign imowa[i] = cmia[i][1];
203
 
204
      assign cmi0[i][2] = imon0[i];
205
      assign cmi1[i][2] = imon1[i];
206
      assign cmi2[i][2] = imon2[i];
207
      assign cmi3[i][2] = imon3[i];
208
      assign cmi4[i][2] = imon4[i];
209
      assign imona[i] = cmia[i][2];
210
 
211
      assign cmi0[i][3] = imoe0[i];
212
      assign cmi1[i][3] = imoe1[i];
213
      assign cmi2[i][3] = imoe2[i];
214
      assign cmi3[i][3] = imoe3[i];
215
      assign cmi4[i][3] = imoe4[i];
216
      assign imoea[i] = cmia[i][3];
217
 
218
      assign cmi0[i][4] = imol0[i];
219
      assign cmi1[i][4] = imol1[i];
220
      assign cmi2[i][4] = imol2[i];
221
      assign cmi3[i][4] = imol3[i];
222
      assign cmi4[i][4] = imol4[i];
223
      assign imola[i] = cmia[i][4];
224
 
225
      // CM modules
226
      dcb_xy #(.VCN(1), .VCW(DW))
227
      CM (
228
          .sia   ( cmia[i][0]   ),
229
          .wia   ( cmia[i][1]   ),
230
          .nia   ( cmia[i][2]   ),
231
          .eia   ( cmia[i][3]   ),
232
          .lia   ( cmia[i][4]   ),
233
          .so0   ( cmo0[i][0]   ),
234
          .so1   ( cmo1[i][0]   ),
235
          .so2   ( cmo2[i][0]   ),
236
          .so3   ( cmo3[i][0]   ),
237
          .so4   ( cmo4[i][0]   ),
238
          .wo0   ( cmo0[i][1]   ),
239
          .wo1   ( cmo1[i][1]   ),
240
          .wo2   ( cmo2[i][1]   ),
241
          .wo3   ( cmo3[i][1]   ),
242
          .wo4   ( cmo4[i][1]   ) ,
243
          .no0   ( cmo0[i][2]   ),
244
          .no1   ( cmo1[i][2]   ),
245
          .no2   ( cmo2[i][2]   ),
246
          .no3   ( cmo3[i][2]   ),
247
          .no4   ( cmo4[i][2]   ),
248
          .eo0   ( cmo0[i][3]   ),
249
          .eo1   ( cmo1[i][3]   ),
250
          .eo2   ( cmo2[i][3]   ),
251
          .eo3   ( cmo3[i][3]   ),
252
          .eo4   ( cmo4[i][3]   ),
253
          .lo0   ( cmo0[i][4]   ),
254
          .lo1   ( cmo1[i][4]   ),
255
          .lo2   ( cmo2[i][4]   ),
256
          .lo3   ( cmo3[i][4]   ),
257
          .lo4   ( cmo4[i][4]   ),
258
          .si0   ( cmi0[i][0]   ),
259
          .si1   ( cmi1[i][0]   ),
260
          .si2   ( cmi2[i][0]   ),
261
          .si3   ( cmi3[i][0]   ),
262
          .si4   ( cmi4[i][0]   ),
263
          .wi0   ( cmi0[i][1]   ),
264
          .wi1   ( cmi1[i][1]   ),
265
          .wi2   ( cmi2[i][1]   ),
266
          .wi3   ( cmi3[i][1]   ),
267
          .wi4   ( cmi4[i][1]   ),
268
          .ni0   ( cmi0[i][2]   ),
269
          .ni1   ( cmi1[i][2]   ),
270
          .ni2   ( cmi2[i][2]   ),
271
          .ni3   ( cmi3[i][2]   ),
272
          .ni4   ( cmi4[i][2]   ),
273
          .ei0   ( cmi0[i][3]   ),
274
          .ei1   ( cmi1[i][3]   ),
275
          .ei2   ( cmi2[i][3]   ),
276
          .ei3   ( cmi3[i][3]   ),
277
          .ei4   ( cmi4[i][3]   ),
278
          .li0   ( cmi0[i][4]   ),
279
          .li1   ( cmi1[i][4]   ),
280
          .li2   ( cmi2[i][4]   ),
281
          .li3   ( cmi3[i][4]   ),
282
          .li4   ( cmi4[i][4]   ),
283
          .soa   ( cmoa[i][0]   ),
284
          .woa   ( cmoa[i][1]   ),
285
          .noa   ( cmoa[i][2]   ),
286
          .eoa   ( cmoa[i][3]   ),
287
          .loa   ( cmoa[i][4]   ),
288
          .wcfg  ( wcfg[i]      ),
289
          .ecfg  ( ecfg[i]      ),
290
          .lcfg  ( lcfg[i]      ),
291
          .scfg  ( scfg[i]      ),
292
          .ncfg  ( ncfg[i]      )
293
          );
294
 
295
      // shuffle between CMs and OMs(OPs)
296
      assign so0[i] = cmo0[i][0];
297
      assign so1[i] = cmo1[i][0];
298
      assign so2[i] = cmo2[i][0];
299
      assign so3[i] = cmo3[i][0];
300
      assign so4[i] = cmo4[i][0];
301
      assign cmoa[i][0] = soa[i];
302
 
303
      assign wo0[i] = cmo0[i][1];
304
      assign wo1[i] = cmo1[i][1];
305
      assign wo2[i] = cmo2[i][1];
306
      assign wo3[i] = cmo3[i][1];
307
      assign wo4[i] = cmo4[i][1];
308
      assign cmoa[i][1] = woa[i];
309
 
310
      assign no0[i] = cmo0[i][2];
311
      assign no1[i] = cmo1[i][2];
312
      assign no2[i] = cmo2[i][2];
313
      assign no3[i] = cmo3[i][2];
314
      assign no4[i] = cmo4[i][2];
315
      assign cmoa[i][2] = noa[i];
316
 
317
      assign eo0[i] = cmo0[i][3];
318
      assign eo1[i] = cmo1[i][3];
319
      assign eo2[i] = cmo2[i][3];
320
      assign eo3[i] = cmo3[i][3];
321
      assign eo4[i] = cmo4[i][3];
322
      assign cmoa[i][3] = eoa[i];
323
 
324
      assign lo0[i] = cmo0[i][4];
325
      assign lo1[i] = cmo1[i][4];
326
      assign lo2[i] = cmo2[i][4];
327
      assign lo3[i] = cmo3[i][4];
328
      assign lo4[i] = cmo4[i][4];
329
      assign cmoa[i][4] = loa[i];
330
   end // block: IMSHF
331
 
332
   endgenerate
333
 
334
 
335
endmodule // dclos
336
 
337
 
338
 
339
 
340
 
341
 
342
 
343
 
344
 
345
 

powered by: WebSVN 2.1.0

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