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

Subversion Repositories noc

[/] [noc/] [src/] [top.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 imori
/*
2
 * =====================================================================================
3
 *
4
 *       Filename:  fifo_tb.h
5
 *
6
 *    Description:  fifo test bench header file
7
 *
8
 *        Version:  1.0
9
 *        Created:  03/25/2009 11:26:55 AM
10
 *       Revision:  none
11
 *       Compiler:  gcc
12
 *
13
 *         Author:  Soontea Kwon (), Kwonst@skku.edu
14
 *        Company:  Mobile Electronics Lab
15
 *
16
 * =====================================================================================
17
 */
18
#ifndef TOP_H
19
#define TOP_H
20
 
21
#include <systemc>
22
#include "define.h"
23
#include "tile.h"
24
#include "reset_cont.h"
25
 
26
using namespace sc_core;
27
using namespace sc_dt;
28
using namespace std;
29
 
30
#define ENABLE          24
31
#define DISABLE         16
32
#define ROW                     4
33
#define COLUMN          4
34
 
35
class top: public sc_module{
36
public:
37
        sc_in<bool>                                     clk;
38
 
39
        sc_signal<bool>                         reset_n;
40
 
41
        sc_signal<bool>                         data_in[ENABLE];
42
        sc_signal<bool>                         data_out[ENABLE];
43
        sc_signal<sc_logic>                     oi_in[ENABLE];
44
        sc_signal<sc_logic>                     oi_out[ENABLE];
45
        sc_signal<sc_uint<3> >          in_full[ENABLE];
46
        sc_signal<sc_uint<3> >          out_full[ENABLE];
47
        sc_signal<sc_uint<2> >          in_sel[ENABLE];
48
        sc_signal<sc_uint<2> >          out_sel[ENABLE];
49
        sc_signal<bool>                         in_write_n[ENABLE];
50
        sc_signal<bool>                         out_write_n[ENABLE];
51
 
52
        sc_signal<bool>                         t_data_in[DISABLE];
53
        sc_signal<bool>                         t_data_out[DISABLE];
54
        sc_signal<sc_logic>                     t_oi_in[DISABLE];
55
        sc_signal<sc_logic>                     t_oi_out[DISABLE];
56
        sc_signal<sc_uint<3> >          t_in_full[DISABLE];
57
        sc_signal<sc_uint<3> >          t_out_full[DISABLE];
58
        sc_signal<sc_uint<2> >          t_in_sel[DISABLE];
59
        sc_signal<sc_uint<2> >          t_out_sel[DISABLE];
60
        sc_signal<bool>                         t_in_write_n[DISABLE];
61
        sc_signal<bool>                         t_out_write_n[DISABLE];
62
 
63
        tile *tile0;
64
        tile *tile1;
65
        tile *tile2;
66
        tile *tile3;
67
        tile *tile4;
68
        tile *tile5;
69
        tile *tile6;
70
        tile *tile7;
71
        tile *tile8;
72
        tile *tile9;
73
        tile *tile10;
74
        tile *tile11;
75
        tile *tile12;
76
        tile *tile13;
77
        tile *tile14;
78
        tile *tile15;
79
 
80
        reset *reset_sig;
81
 
82
        top(sc_module_name nm):sc_module(nm){
83
                reset_sig = new reset("reset_sig");
84
                reset_sig->clk(clk);
85
                reset_sig->reset_n(reset_n);
86
 
87
                tile0 = new tile("tile0",  0, COLUMN, ROW);
88
                tile1 = new tile("tile1",  1, COLUMN, ROW);
89
                tile2 = new tile("tile2",  2, COLUMN, ROW);
90
                tile3 = new tile("tile3",  3, COLUMN, ROW);
91
                tile4 = new tile("tile4",  4, COLUMN, ROW);
92
                tile5 = new tile("tile5",  5, COLUMN, ROW);
93
                tile6 = new tile("tile6",  6, COLUMN, ROW);
94
                tile7 = new tile("tile7",  7, COLUMN, ROW);
95
                tile8 = new tile("tile8",  8, COLUMN, ROW);
96
                tile9 = new tile("tile9",  9, COLUMN, ROW);
97
                tile10 = new tile("tile10",10, COLUMN, ROW);
98
                tile11 = new tile("tile11",11, COLUMN, ROW);
99
                tile12 = new tile("tile12",12, COLUMN, ROW);
100
                tile13 = new tile("tile13",13, COLUMN, ROW);
101
                tile14 = new tile("tile14",14, COLUMN, ROW);
102
                tile15 = new tile("tile15",15, COLUMN, ROW);
103
 
104
                tile0->clk(clk);
105
                tile1->clk(clk);
106
                tile2->clk(clk);
107
                tile3->clk(clk);
108
                tile4->clk(clk);
109
                tile5->clk(clk);
110
                tile6->clk(clk);
111
                tile7->clk(clk);
112
                tile8->clk(clk);
113
                tile9->clk(clk);
114
                tile10->clk(clk);
115
                tile11->clk(clk);
116
                tile12->clk(clk);
117
                tile13->clk(clk);
118
                tile14->clk(clk);
119
                tile15->clk(clk);
120
 
121
                tile0->reset_n(reset_n);
122
                tile1->reset_n(reset_n);
123
                tile2->reset_n(reset_n);
124
                tile3->reset_n(reset_n);
125
                tile4->reset_n(reset_n);
126
                tile5->reset_n(reset_n);
127
                tile6->reset_n(reset_n);
128
                tile7->reset_n(reset_n);
129
                tile8->reset_n(reset_n);
130
                tile9->reset_n(reset_n);
131
                tile10->reset_n(reset_n);
132
                tile11->reset_n(reset_n);
133
                tile12->reset_n(reset_n);
134
                tile13->reset_n(reset_n);
135
                tile14->reset_n(reset_n);
136
                tile15->reset_n(reset_n);
137
 
138
                rl_conn(tile0, tile1, &data_out[0], &data_in[0], &oi_in[0], &oi_out[0], &in_write_n[0],
139
                                &out_write_n[0], &out_full[0], &in_full[0], &out_sel[0], &in_sel[0]);
140
                rl_conn(tile1, tile2, &data_out[1], &data_in[1], &oi_in[1], &oi_out[1], &in_write_n[1],
141
                                &out_write_n[1], &out_full[1], &in_full[1], &out_sel[1], &in_sel[1]);
142
                rl_conn(tile2, tile3, &data_out[2], &data_in[2], &oi_in[2], &oi_out[2], &in_write_n[2],
143
                                &out_write_n[2], &out_full[2], &in_full[2], &out_sel[2], &in_sel[2]);
144
                rl_conn(tile4, tile5, &data_out[3], &data_in[3], &oi_in[3], &oi_out[3], &in_write_n[3],
145
                                &out_write_n[3], &out_full[3], &in_full[3], &out_sel[3], &in_sel[3]);
146
                rl_conn(tile5, tile6, &data_out[4], &data_in[4], &oi_in[4], &oi_out[4], &in_write_n[4],
147
                                &out_write_n[4], &out_full[4], &in_full[4], &out_sel[4], &in_sel[4]);
148
                rl_conn(tile6, tile7, &data_out[5], &data_in[5], &oi_in[5], &oi_out[5], &in_write_n[5],
149
                                &out_write_n[5], &out_full[5], &in_full[5], &out_sel[5], &in_sel[5]);
150
                rl_conn(tile8, tile9, &data_out[6], &data_in[6], &oi_in[6], &oi_out[6], &in_write_n[6],
151
                                &out_write_n[6], &out_full[6], &in_full[6], &out_sel[6], &in_sel[6]);
152
                rl_conn(tile9, tile10, &data_out[7], &data_in[7], &oi_in[7], &oi_out[7], &in_write_n[7],
153
                                &out_write_n[7], &out_full[7], &in_full[7], &out_sel[7], &in_sel[7]);
154
                rl_conn(tile10, tile11, &data_out[8], &data_in[8], &oi_in[8], &oi_out[8], &in_write_n[8],
155
                                &out_write_n[8], &out_full[8], &in_full[8], &out_sel[8], &in_sel[8]);
156
                rl_conn(tile12, tile13, &data_out[9], &data_in[9], &oi_in[9], &oi_out[9], &in_write_n[9],
157
                                &out_write_n[9], &out_full[9], &in_full[9], &out_sel[9], &in_sel[9]);
158
                rl_conn(tile13,tile14,&data_out[10],&data_in[10],&oi_in[10],&oi_out[10],&in_write_n[10],
159
                                &out_write_n[10], &out_full[10], &in_full[10], &out_sel[10], &in_sel[10]);
160
                rl_conn(tile14,tile15,&data_out[11],&data_in[11],&oi_in[11],&oi_out[11],&in_write_n[11],
161
                                &out_write_n[11], &out_full[11], &in_full[11], &out_sel[11], &in_sel[11]);
162
 
163
                ud_conn(tile0,tile4,&data_out[12],&data_in[12],&oi_in[12],&oi_out[12],&in_write_n[12],
164
                                &out_write_n[12],&out_full[12],&in_full[12],&out_sel[12],&in_sel[12]);
165
                ud_conn(tile4,tile8,&data_out[13],&data_in[13],&oi_in[13],&oi_out[13],&in_write_n[13],
166
                                &out_write_n[13],&out_full[13],&in_full[13],&out_sel[13],&in_sel[13]);
167
                ud_conn(tile8,tile12,&data_out[14],&data_in[14],&oi_in[14],&oi_out[14],&in_write_n[14],
168
                                &out_write_n[14],&out_full[14],&in_full[14],&out_sel[14],&in_sel[14]);
169
                ud_conn(tile1,tile5,&data_out[15],&data_in[15],&oi_in[15],&oi_out[15],&in_write_n[15],
170
                                &out_write_n[15],&out_full[15],&in_full[15],&out_sel[15],&in_sel[15]);
171
                ud_conn(tile5,tile9,&data_out[16],&data_in[16],&oi_in[16],&oi_out[16],&in_write_n[16],
172
                                &out_write_n[16],&out_full[16],&in_full[16],&out_sel[16],&in_sel[16]);
173
                ud_conn(tile9,tile13,&data_out[17],&data_in[17],&oi_in[17],&oi_out[17],&in_write_n[17],
174
                                &out_write_n[17],&out_full[17],&in_full[17],&out_sel[17],&in_sel[17]);
175
                ud_conn(tile2,tile6,&data_out[18],&data_in[18],&oi_in[18],&oi_out[18],&in_write_n[18],
176
                                &out_write_n[18],&out_full[18],&in_full[18],&out_sel[18],&in_sel[18]);
177
                ud_conn(tile6,tile10,&data_out[19],&data_in[19],&oi_in[19],&oi_out[19],&in_write_n[19],
178
                                &out_write_n[19],&out_full[19],&in_full[19],&out_sel[19],&in_sel[19]);
179
                ud_conn(tile10,tile14,&data_out[20],&data_in[20],&oi_in[20],&oi_out[20],&in_write_n[20],
180
                                &out_write_n[20],&out_full[20],&in_full[20],&out_sel[20],&in_sel[20]);
181
                ud_conn(tile3,tile7,&data_out[21],&data_in[21],&oi_in[21],&oi_out[21],&in_write_n[21],
182
                                &out_write_n[21],&out_full[21],&in_full[21],&out_sel[21],&in_sel[21]);
183
                ud_conn(tile7,tile11,&data_out[22],&data_in[22],&oi_in[22],&oi_out[22],&in_write_n[22],
184
                                &out_write_n[22],&out_full[22],&in_full[22],&out_sel[22],&in_sel[22]);
185
                ud_conn(tile11,tile15,&data_out[23],&data_in[23],&oi_in[23],&oi_out[23],&in_write_n[23],
186
                                &out_write_n[23],&out_full[23],&in_full[23],&out_sel[23],&in_sel[23]);
187
 
188
                //Disable ports.
189
                north_disable(tile0, &t_data_out[0], &t_data_in[0], &t_oi_in[0], &t_oi_out[0],
190
                                          &t_in_write_n[0], &t_out_write_n[0], &t_out_full[0], &t_in_full[0],
191
                                          &t_out_sel[0], &t_in_sel[0]);
192
                north_disable(tile1, &t_data_out[1], &t_data_in[1], &t_oi_in[1], &t_oi_out[1],
193
                                          &t_in_write_n[1], &t_out_write_n[1], &t_out_full[1], &t_in_full[1],
194
                                          &t_out_sel[1], &t_in_sel[1]);
195
                north_disable(tile2, &t_data_out[2], &t_data_in[2], &t_oi_in[2], &t_oi_out[2],
196
                                          &t_in_write_n[2], &t_out_write_n[2], &t_out_full[2], &t_in_full[2],
197
                                          &t_out_sel[2], &t_in_sel[2]);
198
                north_disable(tile3, &t_data_out[12], &t_data_in[12], &t_oi_in[12], &t_oi_out[12],
199
                                          &t_in_write_n[12], &t_out_write_n[12], &t_out_full[12], &t_in_full[12],
200
                                          &t_out_sel[12], &t_in_sel[12]);
201
 
202
                east_disable(tile3, &t_data_out[3], &t_data_in[3], &t_oi_in[3], &t_oi_out[3],
203
                                         &t_in_write_n[3], &t_out_write_n[3], &t_out_full[3], &t_in_full[3],
204
                                         &t_out_sel[3], &t_in_sel[3]);
205
                east_disable(tile7, &t_data_out[4], &t_data_in[4], &t_oi_in[4], &t_oi_out[4],
206
                                         &t_in_write_n[4], &t_out_write_n[4], &t_out_full[4], &t_in_full[4],
207
                                         &t_out_sel[4], &t_in_sel[4]);
208
                east_disable(tile11, &t_data_out[5], &t_data_in[5], &t_oi_in[5], &t_oi_out[5],
209
                                         &t_in_write_n[5], &t_out_write_n[5], &t_out_full[5], &t_in_full[5],
210
                                         &t_out_sel[5], &t_in_sel[5]);
211
                east_disable(tile15, &t_data_out[13], &t_data_in[13], &t_oi_in[13], &t_oi_out[13],
212
                                         &t_in_write_n[13], &t_out_write_n[13], &t_out_full[13], &t_in_full[13],
213
                                         &t_out_sel[13], &t_in_sel[13]);
214
 
215
                south_disable(tile12, &t_data_out[6], &t_data_in[6], &t_oi_in[6], &t_oi_out[6],
216
                                          &t_in_write_n[6], &t_out_write_n[6], &t_out_full[6], &t_in_full[6],
217
                                          &t_out_sel[6], &t_in_sel[6]);
218
                south_disable(tile13, &t_data_out[7], &t_data_in[7], &t_oi_in[7], &t_oi_out[7],
219
                                          &t_in_write_n[7], &t_out_write_n[7], &t_out_full[7], &t_in_full[7],
220
                                          &t_out_sel[7], &t_in_sel[7]);
221
                south_disable(tile14, &t_data_out[8], &t_data_in[8], &t_oi_in[8], &t_oi_out[8],
222
                                          &t_in_write_n[8], &t_out_write_n[8], &t_out_full[8], &t_in_full[8],
223
                                          &t_out_sel[8], &t_in_sel[8]);
224
                south_disable(tile15, &t_data_out[14], &t_data_in[14], &t_oi_in[14], &t_oi_out[14],
225
                                          &t_in_write_n[14], &t_out_write_n[14], &t_out_full[14], &t_in_full[14],
226
                                          &t_out_sel[14], &t_in_sel[14]);
227
 
228
                west_disable(tile0, &t_data_out[9], &t_data_in[9], &t_oi_in[9], &t_oi_out[9],
229
                                         &t_in_write_n[9], &t_out_write_n[9], &t_out_full[9], &t_in_full[9],
230
                                         &t_out_sel[9], &t_in_sel[9]);
231
                west_disable(tile4, &t_data_out[10], &t_data_in[10], &t_oi_in[10], &t_oi_out[10],
232
                                         &t_in_write_n[10], &t_out_write_n[10], &t_out_full[10], &t_in_full[10],
233
                                         &t_out_sel[10], &t_in_sel[10]);
234
                west_disable(tile8, &t_data_out[11], &t_data_in[11], &t_oi_in[11], &t_oi_out[11],
235
                                         &t_in_write_n[11], &t_out_write_n[11], &t_out_full[11], &t_in_full[11],
236
                                         &t_out_sel[11], &t_in_sel[11]);
237
                west_disable(tile12, &t_data_out[15], &t_data_in[15], &t_oi_in[15], &t_oi_out[15],
238
                                         &t_in_write_n[15], &t_out_write_n[15], &t_out_full[15], &t_in_full[15],
239
                                         &t_out_sel[15], &t_in_sel[15]);
240
 
241
        }
242
 
243
        void rl_conn(tile *tile_l, tile *tile_r, sc_signal<bool> *fdata_out,
244
                                 sc_signal<bool> *fdata_in, sc_signal<sc_logic> *foi_in,
245
                                 sc_signal<sc_logic> *foi_out, sc_signal<bool> *fin_write_n,
246
                                 sc_signal<bool> *fout_write_n, sc_signal<sc_uint<3> > *fout_full,
247
                                 sc_signal<sc_uint<3> > *fin_full, sc_signal<sc_uint<2> > *fout_sel,
248
                                 sc_signal<sc_uint<2> > *fin_sel);
249
 
250
        void ud_conn(tile *tile_u, tile *tile_d, sc_signal<bool> *fdata_out,
251
                                 sc_signal<bool> *fdata_in, sc_signal<sc_logic> *foi_in,
252
                                 sc_signal<sc_logic> *foi_out, sc_signal<bool> *fin_write_n,
253
                                 sc_signal<bool> *fout_write_n, sc_signal<sc_uint<3> > *fout_full,
254
                                 sc_signal<sc_uint<3> > *fin_full, sc_signal<sc_uint<2> > *fout_sel,
255
                                 sc_signal<sc_uint<2> > *fin_sel);
256
        void north_disable(tile *tile, sc_signal<bool> *fdata_out,
257
                                 sc_signal<bool> *fdata_in, sc_signal<sc_logic> *foi_in,
258
                                 sc_signal<sc_logic> *foi_out, sc_signal<bool> *fin_write_n,
259
                                 sc_signal<bool> *fout_write_n, sc_signal<sc_uint<3> > *fout_full,
260
                                 sc_signal<sc_uint<3> > *fin_full, sc_signal<sc_uint<2> > *fout_sel,
261
                                 sc_signal<sc_uint<2> > *fin_sel);
262
        void south_disable(tile *tile, sc_signal<bool> *fdata_out,
263
                                 sc_signal<bool> *fdata_in, sc_signal<sc_logic> *foi_in,
264
                                 sc_signal<sc_logic> *foi_out, sc_signal<bool> *fin_write_n,
265
                                 sc_signal<bool> *fout_write_n, sc_signal<sc_uint<3> > *fout_full,
266
                                 sc_signal<sc_uint<3> > *fin_full, sc_signal<sc_uint<2> > *fout_sel,
267
                                 sc_signal<sc_uint<2> > *fin_sel);
268
        void east_disable(tile *tile, sc_signal<bool> *fdata_out,
269
                                 sc_signal<bool> *fdata_in, sc_signal<sc_logic> *foi_in,
270
                                 sc_signal<sc_logic> *foi_out, sc_signal<bool> *fin_write_n,
271
                                 sc_signal<bool> *fout_write_n, sc_signal<sc_uint<3> > *fout_full,
272
                                 sc_signal<sc_uint<3> > *fin_full, sc_signal<sc_uint<2> > *fout_sel,
273
                                 sc_signal<sc_uint<2> > *fin_sel);
274
        void west_disable(tile *tile, sc_signal<bool> *fdata_out,
275
                                 sc_signal<bool> *fdata_in, sc_signal<sc_logic> *foi_in,
276
                                 sc_signal<sc_logic> *foi_out, sc_signal<bool> *fin_write_n,
277
                                 sc_signal<bool> *fout_write_n, sc_signal<sc_uint<3> > *fout_full,
278
                                 sc_signal<sc_uint<3> > *fin_full, sc_signal<sc_uint<2> > *fout_sel,
279
                                 sc_signal<sc_uint<2> > *fin_sel);
280
};
281
 
282
#endif

powered by: WebSVN 2.1.0

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