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

Subversion Repositories async_sdm_noc

[/] [async_sdm_noc/] [trunk/] [vc/] [src/] [rcb_vc.v] - Blame information for rev 47

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 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 request crossbar in the VC allocator of VC routers.
13
 
14
 History:
15
 04/04/2010  Initial version. <wsong83@gmail.com>
16
 01/06/2011  Clean up for opensource. <wsong83@gmail.com>
17
 
18
*/
19
 
20
module rcb_vc (/*AUTOARG*/
21
   // Outputs
22
   ro, srt, nrt, lrt, wrt, ert, wctla, ectla, lctla, sctla, nctla,
23
   // Inputs
24
   ri, go, wctl, ectl, lctl, sctl, nctl
25
   );
26
 
27
   parameter VCN = 2;           // the number of VCs per direction
28
 
29
   input [4:0][VCN-1:0][1:0] ri; // the request input from all inputs
30
   output [4:0][VCN-1:0]     ro; // the request output to all output port arbiters
31
   input [4:0][VCN-1:0]      go; // the granted VC info from all output port arbiters
32
   output [VCN-1:0][3:0]     srt, nrt, lrt; // routing guide to all input ports
33
   output [VCN-1:0][1:0]     wrt, ert;
34
   input [VCN*4*VCN-1:0]     wctl, ectl, lctl; // the configuration from VCA
35
   input [VCN*2*VCN-1:0]     sctl, nctl;
36
   output [VCN*4*VCN-1:0]    wctla, ectla, lctla; // the ack to VCA, fire when the frame is sent
37
   output [VCN*2*VCN-1:0]    sctla, nctla;
38
 
39
 
40
   wire [VCN*4*VCN-1:0][1:0] wri, eri, lri;
41
   wire [VCN*4*VCN-1:0]      wgi, wgo, wro, egi, ego, ero, lgi, lgo, lro;
42
   wire [VCN*2*VCN-1:0][1:0] sri, nri;
43
   wire [VCN*2*VCN-1:0]      sgi, sgo, sro, ngi, ngo, nro;
44
   wire [4*VCN*VCN-1:0]      wgis, egis, lgis;
45
   wire [2*VCN*VCN-1:0]      sgis, ngis;
46
 
47
   genvar                 i,j;
48
 
49
   generate
50
      for(i=0; i<VCN; i++) begin:RI
51
         // shuffle the input requests to all output ports
52
         for(j=0; j<VCN; j++) begin: J
53
            assign sri[i*2*VCN+0*VCN+j] = ri[2][j];
54
            assign sri[i*2*VCN+1*VCN+j] = ri[4][j];
55
            assign wri[i*4*VCN+0*VCN+j] = ri[0][j];
56
            assign wri[i*4*VCN+1*VCN+j] = ri[2][j];
57
            assign wri[i*4*VCN+2*VCN+j] = ri[3][j];
58
            assign wri[i*4*VCN+3*VCN+j] = ri[4][j];
59
            assign nri[i*2*VCN+0*VCN+j] = ri[0][j];
60
            assign nri[i*2*VCN+1*VCN+j] = ri[4][j];
61
            assign eri[i*4*VCN+0*VCN+j] = ri[0][j];
62
            assign eri[i*4*VCN+1*VCN+j] = ri[1][j];
63
            assign eri[i*4*VCN+2*VCN+j] = ri[2][j];
64
            assign eri[i*4*VCN+3*VCN+j] = ri[4][j];
65
            assign lri[i*4*VCN+0*VCN+j] = ri[0][j];
66
            assign lri[i*4*VCN+1*VCN+j] = ri[1][j];
67
            assign lri[i*4*VCN+2*VCN+j] = ri[2][j];
68
            assign lri[i*4*VCN+3*VCN+j] = ri[3][j];
69
         end
70
 
71
         // generate the requests to output port arbiters
72
         assign ro[0][i] = |sro[i*2*VCN +: 2*VCN];
73
         assign ro[1][i] = |wro[i*4*VCN +: 4*VCN];
74
         assign ro[2][i] = |nro[i*2*VCN +: 2*VCN];
75
         assign ro[3][i] = |ero[i*4*VCN +: 4*VCN];
76
         assign ro[4][i] = |lro[i*4*VCN +: 4*VCN];
77
 
78
         // demux to duplicate the grant to all input ports
79
         assign sgo[i*2*VCN +: 2*VCN] = {2*VCN{go[0][i]}};
80
         assign wgo[i*4*VCN +: 4*VCN] = {4*VCN{go[1][i]}};
81
         assign ngo[i*2*VCN +: 2*VCN] = {2*VCN{go[2][i]}};
82
         assign ego[i*4*VCN +: 4*VCN] = {4*VCN{go[3][i]}};
83
         assign lgo[i*4*VCN +: 4*VCN] = {4*VCN{go[4][i]}};
84
 
85
         // generate the routing guide from output grants (sgo -- lgo)
86
         assign srt[i] = {|lgis[(0*VCN+i)*VCN +: VCN], |egis[(0*VCN+i)*VCN +: VCN], |ngis[(0*VCN+i)*VCN +: VCN], |wgis[(0*VCN+i)*VCN +: VCN]};
87
         assign wrt[i] = {|lgis[(1*VCN+i)*VCN +: VCN], |egis[(1*VCN+i)*VCN +: VCN]};
88
         assign nrt[i] = {|lgis[(2*VCN+i)*VCN +: VCN], |egis[(2*VCN+i)*VCN +: VCN], |wgis[(1*VCN+i)*VCN +: VCN], |sgis[(0*VCN+i)*VCN +: VCN]};
89
         assign ert[i] = {|lgis[(3*VCN+i)*VCN +: VCN], |wgis[(2*VCN+i)*VCN +: VCN]};
90
         assign lrt[i] = {|egis[(3*VCN+i)*VCN +: VCN], |ngis[(1*VCN+i)*VCN +: VCN], |wgis[(3*VCN+i)*VCN +: VCN], |sgis[(1*VCN+i)*VCN +: VCN]};
91
 
92
         // part of the routing guide process
93
         for(j=0; j<4*VCN; j++) begin:SB
94
            assign wgis[j*VCN+i] = wgi[i*4*VCN+j];
95
            assign egis[j*VCN+i] = egi[i*4*VCN+j];
96
            assign lgis[j*VCN+i] = lgi[i*4*VCN+j];
97
         end
98
 
99
         for(j=0; j<2*VCN; j++) begin:SL
100
            assign sgis[j*VCN+i] = sgi[i*2*VCN+j];
101
            assign ngis[j*VCN+i] = ngi[i*2*VCN+j];
102
         end
103
      end
104
 
105
      // cross points
106
      for(i=0; i<VCN*4*VCN; i++) begin:BB
107
         RCBB W (.ri(wri[i]), .ro(wro[i]), .go(wgo[i]), .gi(wgi[i]), .ctl(wctl[i]), .ctla(wctla[i]));
108
         RCBB E (.ri(eri[i]), .ro(ero[i]), .go(ego[i]), .gi(egi[i]), .ctl(ectl[i]), .ctla(ectla[i]));
109
         RCBB L (.ri(lri[i]), .ro(lro[i]), .go(lgo[i]), .gi(lgi[i]), .ctl(lctl[i]), .ctla(lctla[i]));
110
      end
111
      for(i=0; i<VCN*2*VCN; i++) begin:BL
112
         RCBB S (.ri(sri[i]), .ro(sro[i]), .go(sgo[i]), .gi(sgi[i]), .ctl(sctl[i]), .ctla(sctla[i]));
113
         RCBB N (.ri(nri[i]), .ro(nro[i]), .go(ngo[i]), .gi(ngi[i]), .ctl(nctl[i]), .ctla(nctla[i]));
114
      end
115
   endgenerate
116
 
117
endmodule // rcb_vc
118
 
119
// Request CrossBar cross point Block
120
module RCBB (ri, ro, go, gi, ctl, ctla);
121
   input [1:0] ri;               // requests from input ports (0: data and head, 1: eof)
122
   output      ro;              // requests to output ports
123
   input       go;              // grant from output ports
124
   output      gi;              // grant to input ports, later translated into routing guide
125
   input       ctl;             // configuration from VCA
126
   output      ctla;            // configuration ack to VCA, fire after ri[1] fires
127
 
128
   wire [1:0]  m;
129
 
130
 
131
   c2  I0 (.a0(ri[1]), .a1(ctl), .q(m[1]));
132
   and I1 ( m[0], ri[0], ctl);
133
   or  I2 ( ro, m[0], m[1]);
134
   c2  I3 ( .a0(ro), .a1(go), .q(gi));
135
   c2  IA ( .a0(m[1]), .a1(go), .q(ctla));
136
 
137
endmodule // RCBB
138
 
139
 

powered by: WebSVN 2.1.0

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