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

Subversion Repositories noc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 imori
/*
2
 * =====================================================================================
3
 *
4
 *       Filename:  tile.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 TILE_H
19
#define TILE_H
20
 
21
#include <systemc>
22
#include "fifo.h"
23
#include "core.h"
24
#include "router.h"
25
#include "photonic_sw.h"
26
using namespace sc_core;
27
using namespace sc_dt;
28
using namespace std;
29
 
30
class tile: public sc_module{
31
public:
32
        sc_in<bool>                                     clk;                                    //0.
33
        sc_in<bool>                                     reset_n;                                //1.
34
        //Data.
35
        sc_signal<bool>                         data_fifo_to_router;    //transfer data from fifo to router.
36
        sc_signal<bool>                         data_router_to_fifo;    //transfer data from router to fifo.
37
        sc_signal<bool>                         data_fifo_to_core;              //transfer data from fifo to core.
38
        sc_signal<bool>                         data_core_to_fifo;              //transfer data from core to fifo.
39
        //write_n.
40
        sc_signal<bool>                         core_to_fifo_write_n;           //Output data control pin a.
41
        sc_signal<bool>                         router_to_fifo_write_n;         //Output data control pin a.
42
 
43
        //read_n.
44
        sc_signal<bool>                         core_to_fifo_read_n;            //Input data control pin.
45
        sc_signal<bool>                         router_to_fifo_read_n;          //Input data control pin.
46
 
47
        //select signal.
48
        sc_signal<sc_uint<2> >          wcore_to_fifo_sel;                      //to read data to fifo between core and fifo.
49
        sc_signal<sc_uint<2> >          wfifo_to_core_sel;                      //to write data to fifo between core and fifo.
50
        sc_signal<sc_uint<2> >          wfifo_to_router_sel;            //to read data to fifo between fifo and router.
51
        sc_signal<sc_uint<2> >          wrouter_to_fifo_sel;            //to write data to fifo between fifo and router.
52
 
53
        //empty & full signal.
54
        sc_signal<sc_uint<3> >          core_empty;                                     //State of FIFO is full.
55
        sc_signal<sc_uint<3> >          core_full;                                      //State of FIFO is empty.
56
        sc_signal<sc_uint<3> >          router_empty;                           //State of FIFO is full.
57
        sc_signal<sc_uint<3> >          router_full;                            //State of FIFO is empty.
58
 
59
        //West signal.
60
        sc_out<bool>                            w_data_out;                                     //2
61
        sc_in<bool>                                     w_data_in;                                      //3
62
        sc_out<bool>                            w_out_write_n;                          //4.
63
        sc_in<bool>                                     w_in_write_n;                           //5
64
        sc_out<sc_uint<3> >                     w_out_full;                                     //6.
65
        sc_in<sc_uint<3> >                      w_in_full;                                      //7.
66
        sc_out<sc_uint<2> >                     w_out_sel;                                      //8.
67
        sc_in<sc_uint<2> >                      w_in_sel;                                       //9.
68
 
69
        sc_signal<bool>                         w_fifo_to_router_data;  //west fifo to router data.
70
        sc_signal<sc_uint<2> >                          w_fifo_to_router_sel;   //west select signal.
71
        sc_signal<bool>                         w_read_n;                               //left input data control pin.
72
        sc_signal<sc_uint<3> >          w_empty;                                //State of FIFO is full.
73
        //East signal.
74
        sc_out<bool>                            e_data_out;                                     //10.
75
        sc_in<bool>                                     e_data_in;                                      //11.
76
        sc_out<bool>                            e_out_write_n;                          //12.
77
        sc_in<bool>                                     e_in_write_n;                           //13.
78
        sc_out<sc_uint<3> >                     e_out_full;                                     //14.
79
        sc_in<sc_uint<3> >                      e_in_full;                                      //15.
80
        sc_out<sc_uint<2> >                     e_out_sel;                                      //16.
81
        sc_in<sc_uint<2> >                      e_in_sel;                                       //17.
82
 
83
        sc_signal<bool>                         e_fifo_to_router_data;  //west fifo to router data.
84
        sc_signal<sc_uint<2> >                          e_fifo_to_router_sel;   //west select signal.
85
        sc_signal<bool>                         e_read_n;                               //left input data control pin.
86
        sc_signal<sc_uint<3> >          e_empty;                                //State of FIFO is full.
87
 
88
        //North signal.
89
        sc_out<bool>                            n_data_out;                                     //18.
90
        sc_in<bool>                                     n_data_in;                                      //19.
91
        sc_out<bool>                            n_out_write_n;                          //20.
92
        sc_in<bool>                                     n_in_write_n;                           //21.
93
        sc_out<sc_uint<3> >                     n_out_full;                                     //22.
94
        sc_in<sc_uint<3> >                      n_in_full;                                      //23.
95
        sc_out<sc_uint<2> >                     n_out_sel;                                      //24.
96
        sc_in<sc_uint<2> >                      n_in_sel;                                       //25.
97
 
98
        sc_signal<bool>                         n_fifo_to_router_data;  //west fifo to router data.
99
        sc_signal<sc_uint<2> >          n_fifo_to_router_sel;   //west select signal.
100
        sc_signal<bool>                         n_read_n;                               //left input data control pin.
101
        sc_signal<sc_uint<3> >          n_empty;                                //State of FIFO is full.
102
 
103
        //South signal.
104
        sc_out<bool>                            s_data_out;                                     //26.
105
        sc_in<bool>                                     s_data_in;                                      //27.
106
        sc_out<bool>                            s_out_write_n;                          //28.
107
        sc_in<bool>                                     s_in_write_n;                           //29.
108
        sc_out<sc_uint<3> >                     s_out_full;                                     //30.
109
        sc_in<sc_uint<3> >                      s_in_full;                                      //31.
110
        sc_out<sc_uint<2> >                     s_out_sel;                                      //32.
111
        sc_in<sc_uint<2> >                      s_in_sel;                                       //32.
112
 
113
        sc_signal<bool>                         s_fifo_to_router_data;  //west fifo to router data.
114
        sc_signal<sc_uint<2> >          s_fifo_to_router_sel;   //west select signal.
115
        sc_signal<bool>                         s_read_n;                               //left input data control pin.
116
        sc_signal<sc_uint<3> >          s_empty;                                //State of FIFO is full.
117
 
118
        sc_in<sc_logic>         e_oi_in;                                                        //33.East oi input.
119
        sc_out<sc_logic>        e_oi_out;                                                       //34.East oi output.
120
        sc_in<sc_logic>         w_oi_in;                                                        //35.
121
        sc_out<sc_logic>        w_oi_out;                                                       //36.
122
        sc_in<sc_logic>         s_oi_in;                                                        //37.
123
        sc_out<sc_logic>        s_oi_out;                                                       //38.
124
        sc_in<sc_logic>         n_oi_in;                                                        //39.
125
        sc_out<sc_logic>        n_oi_out;                                                       //41.
126
 
127
        sc_signal<sc_logic>             c_oi_in;
128
        sc_signal<sc_logic>             c_oi_out;
129
        sc_signal<sc_uint<16> > oi_control;
130
 
131
        core *ip_core;
132
        virtual_fifo *core_to_router_fifo;
133
        virtual_fifo *router_to_core_fifo;
134
 
135
        virtual_fifo *north_fifo;
136
        virtual_fifo *south_fifo;
137
        virtual_fifo *east_fifo;
138
        virtual_fifo *west_fifo;
139
 
140
        router *router_fabric;
141
        photonic_sw *ph_sw;
142
 
143
        SC_HAS_PROCESS(router);
144
 
145
        tile(sc_module_name nm, int id, int column_num, int row_num):sc_module(nm){
146
                ip_core = new core("ip_core",id,column_num,row_num);
147
                core_to_router_fifo = new virtual_fifo("core_to_router_fifo");
148
                router_to_core_fifo = new virtual_fifo("router_to_core_fifo");
149
                router_fabric = new router("router_fabric",id,column_num,row_num);
150
 
151
                north_fifo = new virtual_fifo("north_fifo");
152
                south_fifo = new virtual_fifo("south_fifo");
153
                east_fifo = new virtual_fifo("east_fifo");
154
                west_fifo = new virtual_fifo("west_fifo");
155
 
156
                ph_sw = new photonic_sw("ph_sw");
157
 
158
                ip_core->clk(clk);
159
                ip_core->reset_n(reset_n);
160
                router_fabric->clk(clk);
161
                router_fabric->reset_n(reset_n);
162
                ph_sw->clock(clk);
163
                ph_sw->reset_n(reset_n);
164
 
165
                //router optical interconnects.
166
                router_fabric->c_oi_in(c_oi_in);
167
                router_fabric->c_oi_out(c_oi_out);
168
                router_fabric->oi_control(oi_control);
169
                ph_sw->e_oi_in(e_oi_in);
170
                ph_sw->e_oi_out(e_oi_out);
171
                ph_sw->w_oi_in(w_oi_in);
172
                ph_sw->w_oi_out(w_oi_out);
173
                ph_sw->s_oi_in(s_oi_in);
174
                ph_sw->s_oi_out(s_oi_out);
175
                ph_sw->n_oi_in(n_oi_in);
176
                ph_sw->n_oi_out(n_oi_out);
177
                ph_sw->c_oi_in(c_oi_out);
178
                ph_sw->c_oi_out(c_oi_in);
179
                ph_sw->oi_control(oi_control);
180
 
181
 
182
                //core data -> fifo -> router.
183
                ip_core->data_out(data_core_to_fifo);
184
                core_to_router_fifo->data_in(data_core_to_fifo);
185
                core_to_router_fifo->data_out(data_fifo_to_router);
186
                router_fabric->c_data_in(data_fifo_to_router);
187
                //core data <- fifo <- router.
188
                ip_core->data_in(data_fifo_to_core);
189
                router_to_core_fifo->data_out(data_fifo_to_core);
190
                router_to_core_fifo->data_in(data_router_to_fifo);
191
                router_fabric->c_data_out(data_router_to_fifo);
192
                //select signal : core->fifo->router.
193
                ip_core->core_to_fifo_sel(wcore_to_fifo_sel);
194
                core_to_router_fifo->x_to_fifo_sel(wcore_to_fifo_sel);
195
                core_to_router_fifo->fifo_to_x_sel(wfifo_to_router_sel);
196
                router_fabric->c_fifo_to_router_sel(wfifo_to_router_sel);
197
                //select signal : router->fifo->core.
198
                router_fabric->c_router_to_fifo_sel(wrouter_to_fifo_sel);
199
                router_to_core_fifo->x_to_fifo_sel(wrouter_to_fifo_sel);
200
                router_to_core_fifo->fifo_to_x_sel(wfifo_to_core_sel);
201
                ip_core->fifo_to_core_sel(wfifo_to_core_sel);
202
                //core write_n -> fifo write_n | fifo read_n -> router read_n.
203
                ip_core->write_n(core_to_fifo_write_n);
204
                core_to_router_fifo->write_n(core_to_fifo_write_n);
205
                core_to_router_fifo->read_n(router_to_fifo_read_n);
206
                router_fabric->c_read_n(router_to_fifo_read_n);
207
                //router write_n -> fifo write_n | fifo read_n -> core write_n.
208
                router_fabric->c_write_n(router_to_fifo_write_n);
209
                router_to_core_fifo->write_n(router_to_fifo_write_n);
210
                router_to_core_fifo->read_n(core_to_fifo_read_n);
211
                ip_core->read_n(core_to_fifo_read_n);
212
                //core & router full signal.
213
                ip_core->full(core_full);
214
                core_to_router_fifo->full(core_full);
215
                router_fabric->c_full(router_full);
216
                router_to_core_fifo->full(router_full);
217
                //core & router empty signal.
218
                ip_core->empty(core_empty);
219
                router_to_core_fifo->empty(core_empty);
220
                core_to_router_fifo->empty(router_empty);
221
                router_fabric->c_empty(router_empty);
222
 
223
                //West
224
                west_fifo->data_out(w_fifo_to_router_data);                                     //Fifo->router data.
225
                router_fabric->w_data_in(w_fifo_to_router_data);                        //Fifo->router data.
226
                router_fabric->w_fifo_to_router_sel(w_fifo_to_router_sel);  //fifo select signal.
227
                west_fifo->fifo_to_x_sel(w_fifo_to_router_sel);
228
                router_fabric->w_read_n(w_read_n);                                                      //left input data control pin.
229
                west_fifo->read_n(w_read_n);
230
                router_fabric->w_empty(w_empty);                                                        //State of FIFO is full.
231
                west_fifo->empty(w_empty);
232
 
233
                west_fifo->data_in(w_data_in);                                                          //input data.
234
                west_fifo->full(w_out_full);
235
                west_fifo->write_n(w_in_write_n);
236
                west_fifo->x_to_fifo_sel(w_in_sel);
237
 
238
                router_fabric->w_data_out(w_data_out);                                          //Tile data_out.
239
                router_fabric->w_router_to_fifo_sel(w_out_sel);                         //west select signal.
240
                router_fabric->w_write_n(w_out_write_n);                                        //left output data control pin.
241
                router_fabric->w_full(w_in_full);                                                       //State of FIFO is empty.
242
 
243
                //east
244
                east_fifo->data_out(e_fifo_to_router_data);                                     //Fifo->router data.
245
                router_fabric->e_data_in(e_fifo_to_router_data);                        //Fifo->router data.
246
                router_fabric->e_fifo_to_router_sel(e_fifo_to_router_sel);  //fifo select signal.
247
                east_fifo->fifo_to_x_sel(e_fifo_to_router_sel);
248
                router_fabric->e_read_n(e_read_n);                                                      //left input data control pin.
249
                east_fifo->read_n(e_read_n);
250
                router_fabric->e_empty(e_empty);                                                        //State of FIFO is full.
251
                east_fifo->empty(e_empty);
252
 
253
                east_fifo->data_in(e_data_in);                                                          //input data.
254
                east_fifo->full(e_out_full);
255
                east_fifo->write_n(e_in_write_n);
256
                east_fifo->x_to_fifo_sel(e_in_sel);
257
 
258
                router_fabric->e_router_to_fifo_sel(e_out_sel);                         //west select signal.
259
                router_fabric->e_write_n(e_out_write_n);                                        //left output data control pin.
260
                router_fabric->e_data_out(e_data_out);                                          //Tile data_out.
261
                router_fabric->e_full(e_in_full);                                                       //State of FIFO is empty.
262
 
263
                //north
264
                north_fifo->data_out(n_fifo_to_router_data);                                    //Fifo->router data.
265
                router_fabric->n_data_in(n_fifo_to_router_data);                        //Fifo->router data.
266
                router_fabric->n_fifo_to_router_sel(n_fifo_to_router_sel);  //fifo select signal.
267
                north_fifo->fifo_to_x_sel(n_fifo_to_router_sel);
268
                router_fabric->n_read_n(n_read_n);                                                      //left input data control pin.
269
                north_fifo->read_n(n_read_n);
270
                router_fabric->n_empty(n_empty);                                                        //State of FIFO is full.
271
                north_fifo->empty(n_empty);
272
 
273
                north_fifo->data_in(n_data_in);                                                         //input data.
274
                north_fifo->full(n_out_full);
275
                north_fifo->write_n(n_in_write_n);
276
                north_fifo->x_to_fifo_sel(n_in_sel);
277
 
278
                router_fabric->n_router_to_fifo_sel(n_out_sel);                         //west select signal.
279
                router_fabric->n_write_n(n_out_write_n);                                        //left output data control pin.
280
                router_fabric->n_data_out(n_data_out);                                          //Tile data_out.
281
                router_fabric->n_full(n_in_full);                                                       //State of FIFO is empty.
282
 
283
                //south
284
                south_fifo->data_out(s_fifo_to_router_data);                                    //Fifo->router data.
285
                router_fabric->s_data_in(s_fifo_to_router_data);                        //Fifo->router data.
286
                router_fabric->s_fifo_to_router_sel(s_fifo_to_router_sel);  //fifo select signal.
287
                south_fifo->fifo_to_x_sel(s_fifo_to_router_sel);
288
                router_fabric->s_read_n(s_read_n);                                                      //left input data control pin.
289
                south_fifo->read_n(s_read_n);
290
                router_fabric->s_empty(s_empty);                                                        //State of FIFO is full.
291
                south_fifo->empty(s_empty);
292
 
293
                south_fifo->data_in(s_data_in);                                                         //input data.
294
                south_fifo->full(s_out_full);
295
                south_fifo->write_n(s_in_write_n);
296
                south_fifo->x_to_fifo_sel(s_in_sel);
297
 
298
                router_fabric->s_data_out(s_data_out);                                          //Tile data_out.
299
                router_fabric->s_router_to_fifo_sel(s_out_sel);                         //west select signal.
300
                router_fabric->s_write_n(s_out_write_n);                                        //left output data control pin.
301
                router_fabric->s_full(s_in_full);                                                       //State of FIFO is empty.
302
        }
303
};
304
 
305
#endif

powered by: WebSVN 2.1.0

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