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

Subversion Repositories async_sdm_noc

[/] [async_sdm_noc/] [branches/] [init/] [vc/] [src/] [inpbuf.v] - Blame information for rev 41

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

Line No. Rev Author Line
1 40 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
 The input buffer for VC routers.
13
 
14
 History:
15
 01/04/2010  Initial version. <wsong83@gmail.com>
16
 12/05/2010  Use MPxP crossbars. <wsong83@gmail.com>
17
 17/04/2010  Remove unnecessary pipeline stages. <wsong83@gmail.com>
18
 02/06/2011  Clean up for opensource. <wsong83@gmail.com>
19
 
20
*/
21
 
22
module inpbuf (/*AUTOARG*/
23
   // Outputs
24
   dia, cor, do0, do1, do2, do3, dot, dortg, vcr, swr,
25
   // Inputs
26
   di0, di1, di2, di3, dit, divc, coa, doa, vcra, swrt, addrx, addry,
27
   rstn
28
   );
29
 
30
   parameter DW = 32;           // data width
31
   parameter VCN = 2;           // VC number
32
   parameter DIR = 0;           // 0-4 south, west, north, east, local
33
   parameter SN = 2;            // maximal output port number
34
   parameter PD = 3;            // the depth of the input buffer pipeline
35
   parameter SCN = DW/2;        // number of 1-of-4 sub-channels
36
   parameter FT = 3;            // flit type, now 3, HOF, BOF, EOF
37
 
38
   // data IP
39
   input [SCN-1:0] di0, di1, di2, di3;
40
   input [FT-1:0]  dit;
41
   input [VCN-1:0] divc;
42
   output          dia;
43
 
44
   // credit flow-control
45
   output [VCN-1:0] cor;
46
   input [VCN-1:0]  coa;
47
 
48
   // data to crossbar
49
   output [VCN-1:0][SCN-1:0] do0,do1,do2,do3;
50
   output [VCN-1:0][FT-1:0]  dot;
51
   output [VCN-1:0][SN-1:0]  dortg;
52
   input  [VCN-1:0]          doa;
53
 
54
   // request to VC allocator
55
   output [VCN-1:0][SN-1:0] vcr;
56
   input [VCN-1:0]           vcra;
57
 
58
   // output to SW allocator
59
   output [VCN-1:0][1:0]    swr;
60
 
61
   // routing guide for SW DEMUX
62
   input [VCN-1:0][SN-1:0]  swrt;
63
 
64
   // local addresses
65
   input [7:0]               addrx, addry;
66
 
67
   input                    rstn;
68
 
69
   //-----------------------------                  
70
   // VC_MUX
71
   wire                     ivma, rua;
72
   wire [SCN-1:0]            di0m, di1m, di2m, di3m;
73
   wire [FT-1:0]             ditm;
74
   wire [VCN-1:0]            divcm;
75
   wire [VCN-1:0]            muxa;
76
 
77
   // VC_BUF
78
   wire [2*PD:0][VCN-1:0][SCN-1:0] vcd0, vcd1, vcd2, vcd3; // VC data
79
   wire [2*PD:0][VCN-1:0][FT-1:0]  vcdt;              // VC flit type
80
   wire [2*PD:0][VCN-1:0][SCN-1:0] vcdad, vcdadn;          // VC ack
81
   wire [2*PD:0][VCN-1:0]            vcdat, vcdatn;          // VC data ack and type ack
82
   wire [1:0][VCN-1:0]               vcda;                   // the comman ack               
83
 
84
   // control path
85
   wire [2*PD:2*PD-2][VCN-1:0][1:0] vcft;            // flit type on control path
86
   wire [2*PD:2*PD-2][VCN-1:0]      vcfta, vcftan;          // flit type ack, on control path
87
   wire [VCN-1:0]                   vcdam;                  // need an extra ack internal signal
88
   wire [VCN-1:0][SN-1:0]            rtg;                    // routing direction guide
89
   wire [VCN-1:0]                   doan;
90
 
91
   // last stage of input buffer
92
   wire [VCN-1:0]                   vcor;
93
   wire [VCN-1:0]                   vcog;
94
   wire [VCN-1:0]                   swa;
95
 
96
   genvar                          gbd, gvc, gsub, i;
97
 
98
   //---------------------------------------------
99
   // the input VCDMUX
100
   vcdmux #(.VCN(VCN), .DW(DW))
101
   IVM (
102
         .dia   ( ivma     ),
103
         .do0   ( vcd0[0]  ),
104
         .do1   ( vcd1[0]  ),
105
         .do2   ( vcd2[0]  ),
106
         .do3   ( vcd3[0]  ),
107
         .dot   ( vcdt[0]  ),
108
         .di0   ( di0m     ),
109
         .di1   ( di1m     ),
110
         .di2   ( di2m     ),
111
         .di3   ( di3m     ),
112
         .dit   ( ditm     ),
113
         .divc  ( divcm    ),
114
         .doa   ( muxa     )
115
         );
116
 
117
   //c2 IVMA (.a0(ivma), .a1(rua), .q(dia)); divc is not checked
118
   ctree #(.DW(3)) ACKT(.ci({ivma, rua, (|divcm)}), .co(dia));
119
 
120
   assign di0m = rstn ? di0 : 0;
121
   assign di1m = rstn ? di1 : 0;
122
   assign di2m = rstn ? di2 : 0;
123
   assign di3m = rstn ? di3 : 0;
124
   assign ditm = rstn ? dit : 0;
125
   assign divcm = rstn ? divc : 0;
126
 
127
   //---------------------------------------------
128
   // the VC buffers
129
   generate
130
      for(gbd=0; gbd<PD*2-2; gbd++) begin:BFN
131
         for(gvc=0; gvc<VCN; gvc++) begin:V
132
            for(gsub=0; gsub<SCN; gsub++) begin:SC
133
               pipe4 #(.DW(2))
134
               DP (
135
                   .dia ( vcdad[gbd][gvc][gsub]  ),
136
                   .do0 ( vcd0[gbd+1][gvc][gsub] ),
137
                   .do1 ( vcd1[gbd+1][gvc][gsub] ),
138
                   .do2 ( vcd2[gbd+1][gvc][gsub] ),
139
                   .do3 ( vcd3[gbd+1][gvc][gsub] ),
140
                   .di0 ( vcd0[gbd][gvc][gsub]   ),
141
                   .di1 ( vcd1[gbd][gvc][gsub]   ),
142
                   .di2 ( vcd2[gbd][gvc][gsub]   ),
143
                   .di3 ( vcd3[gbd][gvc][gsub]   ),
144
                   .doa ( vcdadn[gbd+1][gvc][gsub] )
145
                   );
146
               assign vcdadn[gbd+1][gvc][gsub] = (~vcdad[gbd+1][gvc][gsub])&rstn;
147
            end // block: SC
148
 
149
            pipen #(.DW(FT))
150
            TP (
151
                .d_in    ( vcdt[gbd][gvc]     ),
152
                .d_in_a  ( vcdat[gbd][gvc]    ),
153
                .d_out   ( vcdt[gbd+1][gvc]   ),
154
                .d_out_a ( vcdatn[gbd+1][gvc]  )
155
                );
156
            assign vcdatn[gbd+1][gvc] = (~vcdat[gbd+1][gvc])&rstn;
157
 
158
         end // block: V
159
      end // block: BFN
160
 
161
      for(gvc=0; gvc<VCN; gvc++) begin:BFNV
162
         if(PD>1) begin:ACKG
163
            ctree #(.DW(SCN+1)) ACKT(.ci({vcdat[0],vcdad[0]}), .co(muxa[gvc]));
164
            assign vcdad[PD*2-2][gvc] = {SCN{vcda[0][gvc]}};
165
            assign vcdat[PD*2-2] = vcda[0][gvc];
166
         end else begin
167
            assign muxa[gvc] = vcda[0][gvc];
168
         end
169
      end // block: V
170
 
171
   endgenerate
172
 
173
   // the last two stages of VC buffers, separate flit type and data
174
   generate
175
      for(gbd=PD*2-2; gbd<PD*2; gbd++) begin:BFL2
176
         for(gvc=0; gvc<VCN; gvc++) begin:V
177
            for(gsub=0; gsub<SCN; gsub++) begin:SC
178
               pipe4 #(.DW(2))
179
               DP (
180
                   .dia ( vcdad[gbd][gvc][gsub]    ),
181
                   .do0 ( vcd0[gbd+1][gvc][gsub]   ),
182
                   .do1 ( vcd1[gbd+1][gvc][gsub]   ),
183
                   .do2 ( vcd2[gbd+1][gvc][gsub]   ),
184
                   .do3 ( vcd3[gbd+1][gvc][gsub]   ),
185
                   .di0 ( vcd0[gbd][gvc][gsub]     ),
186
                   .di1 ( vcd1[gbd][gvc][gsub]     ),
187
                   .di2 ( vcd2[gbd][gvc][gsub]     ),
188
                   .di3 ( vcd3[gbd][gvc][gsub]     ),
189
                   .doa ( vcdadn[gbd+1][gvc][gsub] )
190
                   );
191
               assign vcdadn[gbd+1][gvc][gsub] = (~vcdad[gbd+1][gvc][gsub])&rstn;
192
            end // block: SC
193
 
194
            pipen #(.DW(FT))
195
            TP (
196
                .d_in    ( vcdt[gbd][gvc]     ),
197
                .d_in_a  ( vcdat[gbd][gvc]    ),
198
                .d_out   ( vcdt[gbd+1][gvc]   ),
199
                .d_out_a ( vcdatn[gbd+1][gvc]  )
200
                );
201
 
202
            assign vcdatn[gbd+1][gvc] = (~vcdat[gbd+1][gvc])&rstn;
203
 
204
            pipen #(.DW(2))
205
            CTP (
206
                .d_in    ( vcft[gbd][gvc]     ),
207
                .d_in_a  ( vcfta[gbd][gvc]    ),
208
                .d_out   ( vcft[gbd+1][gvc]   ),
209
                .d_out_a ( vcftan[gbd+1][gvc] )
210
                );
211
 
212
            assign vcftan[gbd+1][gvc] = (~vcfta[gbd+1][gvc])&rstn;
213
         end // block: V
214
      end // block: BFL2
215
 
216
      for(gvc=0; gvc<VCN; gvc++) begin:BFL2V
217
         ctree #(.DW(SCN+2)) ACKT(.ci({vcfta[PD*2-2][gvc], vcdat[PD*2-2][gvc], vcdad[PD*2-2][gvc]}), .co(vcda[0][gvc]));
218
         assign vcdat[PD*2][gvc] = vcda[1][gvc];
219
         assign vcdad[PD*2][gvc] = {SCN{vcda[1][gvc]}};
220
         assign vcfta[PD*2][gvc] = swa[gvc];
221
         assign vcft[PD*2-2][gvc] = {vcdt[PD*2-2][gvc][FT-1], |vcdt[PD*2-2][gvc][FT-2:0]};
222
         assign swr[gvc] = vcft[PD*2][gvc];
223
      end
224
 
225
   endgenerate
226
 
227
 
228
   // the routing guide pipeline stage
229
   generate
230
      for(gvc=0; gvc<VCN; gvc++) begin:R
231
         pipen #(.DW(SN))
232
         RP (
233
             .d_in     ( swrt[gvc]          ),
234
             .d_in_a   ( swa[gvc]           ),
235
             .d_out    ( rtg[gvc]           ),
236
             .d_out_a  ( (~vcda[1][gvc])&rstn   )
237
             );
238
      end
239
   endgenerate
240
 
241
   generate
242
      for(gvc=0; gvc<VCN; gvc++) begin:LPS
243
 
244
         // credit control
245
         dc2 FCP (.q(cor[gvc]), .d(|rtg[gvc]), .a((~coa[gvc])&rstn));
246
 
247
         // output name conversation
248
         assign do0[gvc] = vcd0[PD*2][gvc];
249
         assign do1[gvc] = vcd1[PD*2][gvc];
250
         assign do2[gvc] = vcd2[PD*2][gvc];
251
         assign do3[gvc] = vcd3[PD*2][gvc];
252
 
253
         assign dot[gvc] = vcdt[PD*2][gvc];
254
         assign dortg[gvc] = rtg[gvc];
255
 
256
         c2 AC (.q(vcda[1][gvc]), .a0(cor[gvc]), .a1(doa[gvc]));
257
 
258
      end // block: LPS
259
   endgenerate
260
 
261
   // routing unit
262
   rtu #(.VCN(VCN), .DIR(DIR), .SN(SN), .PD(2))
263
   RTC (
264
        .dia   ( rua       ),
265
        .dort  ( vcr       ),
266
        .rstn  ( rstn      ),
267
        .di0   ( di0m[3:0] ),
268
        .di1   ( di1m[3:0] ),
269
        .di2   ( di2m[3:0] ),
270
        .di3   ( di3m[3:0] ),
271
        .dit   ( ditm      ),
272
        .divc  ( divcm     ),
273
        .addrx ( addrx     ),
274
        .addry ( addry     ),
275
        .doa   ( vcra      )
276
   );
277
 
278
endmodule // inpbuf
279
 
280
 
281
 
282
 
283
 
284
 
285
 

powered by: WebSVN 2.1.0

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