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

Subversion Repositories async_sdm_noc

[/] [async_sdm_noc/] [trunk/] [vc/] [src/] [rtu.v] - Blame information for rev 48

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

Line No. Rev Author Line
1 39 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 routing calculation unit in every input buffer.
13
 p0 -> L -> p1 -> RTC -> p2 -> L -> p3 -> DEMUX -> p[0] -> L -> p[1] -> L -> p[2] -> L -> p[3] -> L -> p[4]
14
 
15
 History:
16
 02/04/2010  Initial version. <wsong83@gmail.com>
17
 02/06/2011  Clean up for opensource. <wsong83@gmail.com>
18 46 wsong0210
 08/06/2011  The selection pin of the demux must be considered in the ack process. <wsong83@gmail.com>
19 39 wsong0210
 
20
*/
21
 
22
module rtu (/*AUTOARG*/
23
   // Outputs
24
   dia, dort,
25
   // Inputs
26 45 wsong0210
   rst_n, di0, di1, di2, di3, dit, divc, addrx, addry, doa
27 39 wsong0210
   );
28
   parameter VCN = 2;
29
   parameter DIR = 0;
30
   parameter SN = 4;
31
   parameter PD = 2;
32
 
33 45 wsong0210
   input            rst_n;
34 39 wsong0210
   input [3:0]      di0, di1, di2, di3;
35
   input [2:0]       dit;
36
   input [VCN-1:0]  divc;
37
   output           dia;
38
 
39
   input [7:0]       addrx, addry;
40
 
41
   output [VCN-1:0][SN-1:0] dort;
42
   input [VCN-1:0]           doa;
43
 
44
   //------------------------------------------
45
   wire             p0an, p0ap, p0den, p0ad, p0avc;
46
   wire [3:0]        p1d0, p1d1, p1d2, p1d3;
47
   wire [VCN-1:0]   p1vc;
48
   wire             p1a, p1ad, p1avc, p1an;
49
   wire [SN-1:0]    p2d;
50
   wire [VCN-1:0]   p2vc;
51
   wire             p2a, p2ad, p2avc, p2an;
52
   wire [SN-1:0]    p3d;
53
   wire [VCN-1:0]   p3vc;
54 46 wsong0210
   wire             p3a, p3an, p3ad;
55 39 wsong0210
   wire [PD*2:0][VCN-1:0][SN-1:0] pd;
56
   wire [PD*2:0][VCN-1:0]           pda, pdan;
57
 
58
   wire [2:0]                      x_cmp [1:0];
59
   wire [2:0]                      y_cmp [1:0];
60
   wire [5:0]                      dec;
61
   wire                           ds, dw, dn, de, dl;
62
 
63
 
64
   genvar                         gvc, gbd, i;
65
 
66
   //------------------------------------------
67
   // p0 -> L -> p1
68
 
69
   c2 CP0DE ( .a0(dit[0]), .a1(p1an), .q(p0den));
70
   c2 CP0A  ( .a0(p0ad), .a1(p0avc), .q(p0ap));
71
   assign p0an = |dit[2:1];
72
   assign dia = p0an | p0ap;
73
 
74
   pipe4 #(.DW(8))
75
   L0D (
76 42 wsong0210
        .ia ( p0ad   ),
77
        .o0 ( p1d0   ),
78
        .o1 ( p1d1   ),
79
        .o2 ( p1d2   ),
80
        .o3 ( p1d3   ),
81
        .i0 ( di0    ),
82
        .i1 ( di1    ),
83
        .i2 ( di2    ),
84
        .i3 ( di3    ),
85
        .oa ( p0den  )
86 39 wsong0210
        );
87
 
88
   pipen #(.DW(VCN))
89
   L0V (
90
        .d_in    ( divc    ),
91
        .d_in_a  ( p0avc   ),
92
        .d_out   ( p1vc    ),
93
        .d_out_a ( p0den   )
94
        );
95
 
96
   // p1 -> RTC -> p2
97
   comp4 X0 ( .a({p1d3[0], p1d2[0], p1d1[0], p1d0[0]}), .b(addrx[3:0]), .q(x_cmp[0]));
98
   comp4 X1 ( .a({p1d3[1], p1d2[1], p1d1[1], p1d0[1]}), .b(addrx[7:4]), .q(x_cmp[1]));
99
   comp4 Y0 ( .a({p1d3[2], p1d2[2], p1d1[2], p1d0[2]}), .b(addry[3:0]), .q(y_cmp[0]));
100
   comp4 Y1 ( .a({p1d3[3], p1d2[3], p1d1[3], p1d0[3]}), .b(addry[7:4]), .q(y_cmp[1]));
101
 
102
   assign dec[0] = x_cmp[1][0] | (x_cmp[1][2]&x_cmp[0][0]);       // frame x > addr x
103
   assign dec[1] = x_cmp[1][1] | (x_cmp[1][2]&x_cmp[0][1]);       // frame x < addr x
104
   assign dec[2] = x_cmp[1][2] & x_cmp[0][2];                     // frame x = addr x
105
   assign dec[3] = y_cmp[1][0] | (y_cmp[1][2]&y_cmp[0][0]);       // frame y > addr y
106
   assign dec[4] = y_cmp[1][1] | (y_cmp[1][2]&y_cmp[0][1]);       // frame y < addr y
107
   assign dec[5] = y_cmp[1][2] & y_cmp[0][2];                     // frame y = addr y
108
 
109
   assign ds = dec[0];
110
   assign dw = dec[2]&dec[4];
111
   assign dn = dec[1];
112
   assign de = dec[2]&dec[3];
113
   assign dl = dec[2]&dec[5];
114
 
115
   assign p2d =
116
                   DIR == 0 ?   {dl, de, dn, dw}  :       // south port
117
                   DIR == 1 ?   {dl, de}          :       // west port
118
                   DIR == 2 ?   {dl, de, dw, ds}  :       // north port
119
                   DIR == 3 ?   {dl, dw}          :       // east port
120
                                {de, dn, dw, ds}  ;       // local port
121
 
122
   assign p2vc = p1vc;
123
   assign p1an = p2an;
124
 
125
   // p2 -> L -> p3
126
 
127
   c2 CP2A  ( .a0(p2ad), .a1(p2avc), .q(p2a));
128 45 wsong0210
   assign p2an = (~p2a) & rst_n;
129 39 wsong0210
 
130
   pipen #(.DW(SN))
131
   L2R (
132
        .d_in    ( p2d     ),
133
        .d_in_a  ( p2ad    ),
134
        .d_out   ( p3d     ),
135
        .d_out_a ( p3an    )
136
        );
137
 
138
   pipen #(.DW(VCN))
139
   L2V (
140
        .d_in    ( p2vc    ),
141
        .d_in_a  ( p2avc   ),
142
        .d_out   ( p3vc    ),
143
        .d_out_a ( p3an    )
144
        );
145
 
146
   // p3 -> DEMUX -> pd[0]
147
   ddmux #(.DW(SN), .VCN(VCN))
148
   RTDM (
149 46 wsong0210
         .d_in_a  ( p3ad  ),
150 39 wsong0210
         .d_out   ( pd[0] ),
151
         .d_in    ( p3d   ),
152
         .d_sel   ( p3vc  ),
153
         .d_out_a ( pda[0])
154
         );
155
 
156 46 wsong0210
   c2 CP3A (.q(p3a), .a0(p3ad), .a1(|p3vc));
157 45 wsong0210
   assign p3an = (~p3a) & rst_n;
158 39 wsong0210
 
159
   // pd pipeline
160
   generate
161
      for(gbd=0; gbd<PD*2; gbd++) begin:RT
162
         for(gvc=0; gvc<VCN; gvc++) begin:V
163
            pipen #(.DW(SN))
164
            P (
165
               .d_in    ( pd[gbd][gvc]     ),
166
               .d_in_a  ( pda[gbd][gvc]    ),
167
               .d_out   ( pd[gbd+1][gvc]   ),
168
               .d_out_a ( pdan[gbd+1][gvc] )
169
               );
170 45 wsong0210
            assign pdan[gbd+1][gvc] = (~pda[gbd+1][gvc])&rst_n;
171 39 wsong0210
         end
172
      end // block: RT
173
   endgenerate
174
 
175
   // output
176
   generate
177
      for(gvc=0; gvc<VCN; gvc++) begin:OV
178
         assign dort[gvc] = pd[PD*2][gvc];
179
         assign pda[PD*2][gvc] = doa[gvc];
180
      end
181
   endgenerate
182
 
183
endmodule // rtu
184
 
185
 
186
 
187 46 wsong0210
 

powered by: WebSVN 2.1.0

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