1 | |
---|
2 | #include <stdint.h> |
---|
3 | #include <systemc> |
---|
4 | #include <sys/time.h> |
---|
5 | #include <iostream> |
---|
6 | #include <cstdlib> |
---|
7 | #include <cstdarg> |
---|
8 | |
---|
9 | #include "arithmetics.h" |
---|
10 | #include "mapping_table.h" |
---|
11 | #include "alloc_elems.h" |
---|
12 | #include "vci_synthetic_target.h" |
---|
13 | #include "vci_local_ring_fast.h" |
---|
14 | #include "virtual_dspin_router.h" |
---|
15 | #include "vci_synthetic_initiator.h" |
---|
16 | |
---|
17 | // MESH SIZE |
---|
18 | #define X_MAX 2 |
---|
19 | #define Y_MAX 2 |
---|
20 | #define N_CLUSTERS X_MAX*Y_MAX |
---|
21 | // FLIT_WIDTH |
---|
22 | #define WIDTH_CMD 40 |
---|
23 | #define WIDTH_RSP 33 |
---|
24 | // Face of each DSPIN Router |
---|
25 | #define NORTH 0 |
---|
26 | #define SOUTH 1 |
---|
27 | #define EAST 2 |
---|
28 | #define WEST 3 |
---|
29 | #define LOCAL 4 |
---|
30 | // VCI parameters |
---|
31 | #define cell_width 4 |
---|
32 | #define plen_width 8 |
---|
33 | #define address_width 32 |
---|
34 | #define error_width 1 |
---|
35 | #define clen_width 1 |
---|
36 | #define rflag_width 1 |
---|
37 | #define srcid_width 11 |
---|
38 | #define pktid_width 4 |
---|
39 | #define trdid_width 4 |
---|
40 | #define wrplen_width 1 |
---|
41 | // Adress of targets |
---|
42 | #define TARGET_ADDR 0x00000000 |
---|
43 | #define TARGET_SIZE 0x400 |
---|
44 | // FIFO depth in the gateways |
---|
45 | #define DEPTH 4 |
---|
46 | // LENGTH of packets |
---|
47 | #define PACKET_LENGTH 2 |
---|
48 | // FIFO depth in the routers |
---|
49 | #define DSPIN_FIFO 4 |
---|
50 | // DEBUG MODE : 0 OFF, 1 only the initiators and the targets, 2 only network |
---|
51 | #define DEBUG 0 |
---|
52 | // LOAD wanted |
---|
53 | #define LOAD 450 |
---|
54 | |
---|
55 | #define STAGE 0 |
---|
56 | |
---|
57 | int _main(int argc, char *argv[]) |
---|
58 | { |
---|
59 | using namespace sc_core; |
---|
60 | // Avoid repeating these everywhere |
---|
61 | using soclib::common::IntTab; |
---|
62 | using soclib::common::Segment; |
---|
63 | |
---|
64 | using soclib::common::uint32_log2; |
---|
65 | |
---|
66 | int ncycles; |
---|
67 | uint32_t rho_a; |
---|
68 | uint32_t rho_b; |
---|
69 | |
---|
70 | if(argc == 4){ |
---|
71 | ncycles = std::atoi(argv[1]); |
---|
72 | rho_a = std::atoi(argv[2]); |
---|
73 | rho_b = std::atoi(argv[3]); |
---|
74 | } else { |
---|
75 | std::cout << "Usage : simulation_cycles packet_rate broadcast_period" << std::endl; |
---|
76 | exit(1); |
---|
77 | } |
---|
78 | // Define VCI parameters |
---|
79 | typedef soclib::caba::VciParams<cell_width, |
---|
80 | plen_width, |
---|
81 | address_width, |
---|
82 | error_width, |
---|
83 | clen_width, |
---|
84 | rflag_width, |
---|
85 | srcid_width, |
---|
86 | pktid_width, |
---|
87 | trdid_width, |
---|
88 | wrplen_width> vci_param; |
---|
89 | |
---|
90 | // Mapping table primary network |
---|
91 | soclib::common::MappingTable maptab0(address_width, IntTab(soclib::common::uint32_log2(X_MAX)+soclib::common::uint32_log2(Y_MAX) ,srcid_width-soclib::common::uint32_log2(X_MAX)-soclib::common::uint32_log2(Y_MAX)), |
---|
92 | IntTab(soclib::common::uint32_log2(X_MAX)+soclib::common::uint32_log2(Y_MAX) ,srcid_width-soclib::common::uint32_log2(X_MAX)-soclib::common::uint32_log2(Y_MAX)), 0xFFC0000); |
---|
93 | soclib::common::MappingTable maptab1(address_width, IntTab(soclib::common::uint32_log2(X_MAX)+soclib::common::uint32_log2(Y_MAX) ,srcid_width-soclib::common::uint32_log2(X_MAX)-soclib::common::uint32_log2(Y_MAX)), |
---|
94 | IntTab(soclib::common::uint32_log2(X_MAX)+soclib::common::uint32_log2(Y_MAX) ,srcid_width-soclib::common::uint32_log2(X_MAX)-soclib::common::uint32_log2(Y_MAX)), 0xFFC0000); |
---|
95 | for(int i = 0 ; i < Y_MAX ; i++){ |
---|
96 | for(int j = 0 ; j < X_MAX ; j++){ |
---|
97 | std::ostringstream str0; |
---|
98 | std::ostringstream str1; |
---|
99 | str0 << "Target_c0_" << (i*Y_MAX+j) ; |
---|
100 | str1 << "Target_c1_" << (i*Y_MAX+j) ; |
---|
101 | maptab0.add(Segment(str0.str(), TARGET_ADDR + ((i*Y_MAX+j) << (address_width-soclib::common::uint32_log2(X_MAX)-soclib::common::uint32_log2(Y_MAX))), TARGET_SIZE, IntTab((i*X_MAX+j),0), false)); |
---|
102 | maptab1.add(Segment(str1.str(), TARGET_ADDR + ((i*Y_MAX+j) << (address_width-soclib::common::uint32_log2(X_MAX)-soclib::common::uint32_log2(Y_MAX))), TARGET_SIZE, IntTab((i*X_MAX+j),0), false)); |
---|
103 | } |
---|
104 | } |
---|
105 | |
---|
106 | |
---|
107 | sc_clock signal_clk("clk"); |
---|
108 | sc_signal<bool> signal_resetn("resetn"); |
---|
109 | |
---|
110 | soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c0 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth_c0", 2, N_CLUSTERS); |
---|
111 | soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c1 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth_c1", 2, N_CLUSTERS); |
---|
112 | /////////////////////////////////////////////////////////////// |
---|
113 | // VDSPIN Signals : one level for in and out, one level for X length in the mesh, |
---|
114 | // one level for Y length in the mesh, last level for each port of the router |
---|
115 | /////////////////////////////////////////////////////////////// |
---|
116 | soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c0 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_0", 2, X_MAX, Y_MAX, 5 ); |
---|
117 | soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c1 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_1", 2, X_MAX, Y_MAX, 5 ); |
---|
118 | soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c0 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_0", 2, X_MAX, Y_MAX, 5 ); |
---|
119 | soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c1 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_2", 2, X_MAX, Y_MAX, 5 ); |
---|
120 | |
---|
121 | |
---|
122 | // N_CLUSTERS ring. |
---|
123 | soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> * local_ring_c0 = (soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> *) malloc(sizeof(soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ) * N_CLUSTERS) ; |
---|
124 | soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> * local_ring_c1 = (soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> *) malloc(sizeof(soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ) * N_CLUSTERS) ; |
---|
125 | for(int i = 0 ; i < N_CLUSTERS ; i++){ // ringid, fifo, fifo, nb_init, nb_tgt |
---|
126 | std::ostringstream str0; |
---|
127 | std::ostringstream str1; |
---|
128 | str0 << "cluster_c0_" << i ; |
---|
129 | str1 << "cluster_c1_" << i ; |
---|
130 | new(&local_ring_c0[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> (str0.str().c_str(), |
---|
131 | maptab0, |
---|
132 | IntTab(i), |
---|
133 | 2, |
---|
134 | DEPTH, |
---|
135 | 1, |
---|
136 | 1); |
---|
137 | new(&local_ring_c1[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> (str1.str().c_str(), |
---|
138 | maptab1, |
---|
139 | IntTab(i), |
---|
140 | 2, |
---|
141 | DEPTH, |
---|
142 | 1, |
---|
143 | 1); |
---|
144 | } |
---|
145 | |
---|
146 | // Virtual dspin routers |
---|
147 | soclib::caba::VirtualDspinRouter<WIDTH_CMD> ** routers_cmd = (soclib::caba::VirtualDspinRouter<WIDTH_CMD> **) malloc(sizeof(soclib::caba::VirtualDspinRouter<WIDTH_CMD> *) * X_MAX); |
---|
148 | soclib::caba::VirtualDspinRouter<WIDTH_RSP> ** routers_rsp = (soclib::caba::VirtualDspinRouter<WIDTH_RSP> **) malloc(sizeof(soclib::caba::VirtualDspinRouter<WIDTH_RSP> *) * X_MAX); |
---|
149 | |
---|
150 | for(int i = 0; i < X_MAX; i++ ){ |
---|
151 | routers_cmd[i] = (soclib::caba::VirtualDspinRouter<WIDTH_CMD> * ) malloc(sizeof(soclib::caba::VirtualDspinRouter<WIDTH_CMD>) * Y_MAX); |
---|
152 | routers_rsp[i] = (soclib::caba::VirtualDspinRouter<WIDTH_RSP> * ) malloc(sizeof(soclib::caba::VirtualDspinRouter<WIDTH_RSP>) * Y_MAX); |
---|
153 | for(int j = 0; j < Y_MAX; j++){ |
---|
154 | std::ostringstream str0; |
---|
155 | std::ostringstream str1; |
---|
156 | str0 << "VDspinRouterCMD" << i << j; |
---|
157 | str1 << "VDspinRouterRSP" << i << j; |
---|
158 | new(&routers_cmd[i][j]) soclib::caba::VirtualDspinRouter<WIDTH_CMD> (str0.str().c_str(), i, j, soclib::common::uint32_log2(X_MAX), soclib::common::uint32_log2(Y_MAX), DSPIN_FIFO, DSPIN_FIFO); |
---|
159 | new(&routers_rsp[i][j]) soclib::caba::VirtualDspinRouter<WIDTH_RSP> (str1.str().c_str(), i, j, soclib::common::uint32_log2(X_MAX), soclib::common::uint32_log2(Y_MAX), DSPIN_FIFO, DSPIN_FIFO); |
---|
160 | } |
---|
161 | } |
---|
162 | |
---|
163 | |
---|
164 | /////////////////////////////////////////////////////////////// |
---|
165 | // Components |
---|
166 | /////////////////////////////////////////////////////////////// |
---|
167 | |
---|
168 | // N_CLUSTERS VCI Synthetic Initiator (1 initiator per cluster/network) |
---|
169 | soclib::caba::VciSyntheticInitiator<vci_param> * initiator_c0 = (soclib::caba::VciSyntheticInitiator<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticInitiator<vci_param> )* N_CLUSTERS); |
---|
170 | soclib::caba::VciSyntheticInitiator<vci_param> * initiator_c1 = (soclib::caba::VciSyntheticInitiator<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticInitiator<vci_param> )* N_CLUSTERS); |
---|
171 | for(int i = 0 ; i < X_MAX; i++) |
---|
172 | for(int j = 0 ; j < Y_MAX ; j++){ |
---|
173 | std::ostringstream str0; |
---|
174 | std::ostringstream str1; |
---|
175 | str0 << "Initiator_c0_" << i << "_" << j ; |
---|
176 | str1 << "Initiator_c1_" << i << "_" << j ; |
---|
177 | new(&initiator_c0[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> (str0.str().c_str() , maptab0, IntTab((i*Y_MAX+j) ,0), PACKET_LENGTH, 0, 100, X_MAX, Y_MAX); |
---|
178 | #if STAGE==1 |
---|
179 | if( (i + 1 == X_MAX) && (j + 1 == Y_MAX ) ) |
---|
180 | #endif |
---|
181 | new(&initiator_c1[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> (str1.str().c_str() , maptab1, IntTab((i*Y_MAX+j) ,0), PACKET_LENGTH, rho_a, 100, X_MAX, Y_MAX, rho_b, 0, X_MAX, 0, Y_MAX); |
---|
182 | |
---|
183 | #if STAGE==1 |
---|
184 | else |
---|
185 | new(&initiator_c1[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> (str1.str().c_str() , maptab1, IntTab((i*Y_MAX+j) ,0), PACKET_LENGTH, rho_a, 100, X_MAX, Y_MAX, 0, 0, X_MAX, 0, Y_MAX); |
---|
186 | #endif |
---|
187 | } |
---|
188 | |
---|
189 | soclib::caba::VciSyntheticTarget<vci_param> * target_c0 = (soclib::caba::VciSyntheticTarget<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticTarget<vci_param>) * N_CLUSTERS); |
---|
190 | soclib::caba::VciSyntheticTarget<vci_param> * target_c1 = (soclib::caba::VciSyntheticTarget<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticTarget<vci_param>) * N_CLUSTERS); |
---|
191 | for(int i = 0 ; i < X_MAX ; i++) |
---|
192 | for(int j = 0 ; j < Y_MAX ; j++){ |
---|
193 | std::ostringstream str0; |
---|
194 | std::ostringstream str1; |
---|
195 | str0 << "Ram_c0_" << (i*Y_MAX+j) ; |
---|
196 | str1 << "Ram_c1_" << (i*Y_MAX+j) ; |
---|
197 | new(&target_c0[Y_MAX*i+j]) soclib::caba::VciSyntheticTarget<vci_param> (str0.str().c_str() , IntTab(i*Y_MAX+j,0), maptab0, soclib::common::Loader(), 0); |
---|
198 | new(&target_c1[Y_MAX*i+j]) soclib::caba::VciSyntheticTarget<vci_param> (str1.str().c_str() , IntTab(i*Y_MAX+j,0), maptab1, soclib::common::Loader(), 0); |
---|
199 | } |
---|
200 | |
---|
201 | /////////////////////////////////////////////////////////////// |
---|
202 | // Connection of Synthetic Initiator to each local ring per cluster |
---|
203 | /////////////////////////////////////////////////////////////// |
---|
204 | for(int i = 0 ; i < N_CLUSTERS ; i++){ |
---|
205 | local_ring_c0[i].p_clk(signal_clk); |
---|
206 | local_ring_c0[i].p_resetn(signal_resetn); |
---|
207 | local_ring_c0[i].p_to_initiator[0](signal_vci_ini_synth_c0[0][i]); |
---|
208 | local_ring_c0[i].p_to_target[0](signal_vci_ini_synth_c0[1][i]); |
---|
209 | initiator_c0[i].p_clk(signal_clk); |
---|
210 | initiator_c0[i].p_resetn(signal_resetn); |
---|
211 | initiator_c0[i].p_vci(signal_vci_ini_synth_c0[0][i]); |
---|
212 | target_c0[i].p_clk(signal_clk); |
---|
213 | target_c0[i].p_resetn(signal_resetn); |
---|
214 | target_c0[i].p_vci(signal_vci_ini_synth_c0[1][i]); |
---|
215 | local_ring_c1[i].p_clk(signal_clk); |
---|
216 | local_ring_c1[i].p_resetn(signal_resetn); |
---|
217 | local_ring_c1[i].p_to_initiator[0](signal_vci_ini_synth_c1[0][i]); |
---|
218 | local_ring_c1[i].p_to_target[0](signal_vci_ini_synth_c1[1][i]); |
---|
219 | initiator_c1[i].p_clk(signal_clk); |
---|
220 | initiator_c1[i].p_resetn(signal_resetn); |
---|
221 | initiator_c1[i].p_vci(signal_vci_ini_synth_c1[0][i]); |
---|
222 | target_c1[i].p_clk(signal_clk); |
---|
223 | target_c1[i].p_resetn(signal_resetn); |
---|
224 | target_c1[i].p_vci(signal_vci_ini_synth_c1[1][i]); |
---|
225 | } |
---|
226 | |
---|
227 | /////////////////////////////////////////////////////////////// |
---|
228 | // Connection of each VDspin Router to each local ring and |
---|
229 | // neighbors VDspin Router |
---|
230 | /////////////////////////////////////////////////////////////// |
---|
231 | for(int i = 0; i < X_MAX ; i++){ |
---|
232 | for(int j = 0; j < Y_MAX ; j++){ |
---|
233 | routers_cmd[i][j].p_clk(signal_clk); |
---|
234 | routers_cmd[i][j].p_resetn(signal_resetn); |
---|
235 | routers_rsp[i][j].p_clk(signal_clk); |
---|
236 | routers_rsp[i][j].p_resetn(signal_resetn); |
---|
237 | local_ring_c0[i*Y_MAX+j].p_gate_cmd_in( dspin_signals_cmd_c0[0][i][j][LOCAL]); |
---|
238 | local_ring_c1[i*Y_MAX+j].p_gate_cmd_in( dspin_signals_cmd_c1[0][i][j][LOCAL]); |
---|
239 | local_ring_c0[i*Y_MAX+j].p_gate_cmd_out(dspin_signals_cmd_c0[1][i][j][LOCAL]); |
---|
240 | local_ring_c1[i*Y_MAX+j].p_gate_cmd_out(dspin_signals_cmd_c1[1][i][j][LOCAL]); |
---|
241 | local_ring_c0[i*Y_MAX+j].p_gate_rsp_in( dspin_signals_rsp_c0[0][i][j][LOCAL]); |
---|
242 | local_ring_c1[i*Y_MAX+j].p_gate_rsp_in( dspin_signals_rsp_c1[0][i][j][LOCAL]); |
---|
243 | local_ring_c0[i*Y_MAX+j].p_gate_rsp_out(dspin_signals_rsp_c0[1][i][j][LOCAL]); |
---|
244 | local_ring_c1[i*Y_MAX+j].p_gate_rsp_out(dspin_signals_rsp_c1[1][i][j][LOCAL]); |
---|
245 | for(int k = 0; k < 5; k++){ |
---|
246 | if(j == 0){ |
---|
247 | if(i == 0){ |
---|
248 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[0][i][j][k]); |
---|
249 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[0][i][j][k]); |
---|
250 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[1][i][j][k]); |
---|
251 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[1][i][j][k]); |
---|
252 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[0][i][j][k]); |
---|
253 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[0][i][j][k]); |
---|
254 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[1][i][j][k]); |
---|
255 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[1][i][j][k]); |
---|
256 | } else { |
---|
257 | if(k == WEST){ |
---|
258 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[1][i-1][j][EAST]); |
---|
259 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[1][i-1][j][EAST]); |
---|
260 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[0][i-1][j][EAST]); |
---|
261 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[0][i-1][j][EAST]); |
---|
262 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[1][i-1][j][EAST]); |
---|
263 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[1][i-1][j][EAST]); |
---|
264 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[0][i-1][j][EAST]); |
---|
265 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[0][i-1][j][EAST]); |
---|
266 | } else { |
---|
267 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[0][i][j][k]); |
---|
268 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[0][i][j][k]); |
---|
269 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[1][i][j][k]); |
---|
270 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[1][i][j][k]); |
---|
271 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[0][i][j][k]); |
---|
272 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[0][i][j][k]); |
---|
273 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[1][i][j][k]); |
---|
274 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[1][i][j][k]); |
---|
275 | } |
---|
276 | } |
---|
277 | } else { |
---|
278 | if(k == SOUTH){ |
---|
279 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[1][i][j-1][NORTH]); |
---|
280 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[1][i][j-1][NORTH]); |
---|
281 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[0][i][j-1][NORTH]); |
---|
282 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[0][i][j-1][NORTH]); |
---|
283 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[1][i][j-1][NORTH]); |
---|
284 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[1][i][j-1][NORTH]); |
---|
285 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[0][i][j-1][NORTH]); |
---|
286 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[0][i][j-1][NORTH]); |
---|
287 | } else if(k == WEST){ |
---|
288 | if(i == 0){ |
---|
289 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[0][i][j][k]); |
---|
290 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[0][i][j][k]); |
---|
291 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[1][i][j][k]); |
---|
292 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[1][i][j][k]); |
---|
293 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[0][i][j][k]); |
---|
294 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[0][i][j][k]); |
---|
295 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[1][i][j][k]); |
---|
296 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[1][i][j][k]); |
---|
297 | } else { |
---|
298 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[1][i-1][j][EAST]); |
---|
299 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[1][i-1][j][EAST]); |
---|
300 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[0][i-1][j][EAST]); |
---|
301 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[0][i-1][j][EAST]); |
---|
302 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[1][i-1][j][EAST]); |
---|
303 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[1][i-1][j][EAST]); |
---|
304 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[0][i-1][j][EAST]); |
---|
305 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[0][i-1][j][EAST]); |
---|
306 | } |
---|
307 | } else { |
---|
308 | routers_cmd[i][j].p_out[0][k](dspin_signals_cmd_c0[0][i][j][k]); |
---|
309 | routers_cmd[i][j].p_out[1][k](dspin_signals_cmd_c1[0][i][j][k]); |
---|
310 | routers_cmd[i][j].p_in[0][k](dspin_signals_cmd_c0[1][i][j][k]); |
---|
311 | routers_cmd[i][j].p_in[1][k](dspin_signals_cmd_c1[1][i][j][k]); |
---|
312 | routers_rsp[i][j].p_out[0][k](dspin_signals_rsp_c0[0][i][j][k]); |
---|
313 | routers_rsp[i][j].p_out[1][k](dspin_signals_rsp_c1[0][i][j][k]); |
---|
314 | routers_rsp[i][j].p_in[0][k](dspin_signals_rsp_c0[1][i][j][k]); |
---|
315 | routers_rsp[i][j].p_in[1][k](dspin_signals_rsp_c1[1][i][j][k]); |
---|
316 | } |
---|
317 | } |
---|
318 | } |
---|
319 | } |
---|
320 | } |
---|
321 | |
---|
322 | //////////////////////////////////////////////// |
---|
323 | // Simulation Loop // |
---|
324 | //////////////////////////////////////////////// |
---|
325 | |
---|
326 | |
---|
327 | sc_start(sc_core::sc_time(0, SC_NS)); |
---|
328 | signal_resetn = false; |
---|
329 | |
---|
330 | for(int i = 0; i < X_MAX ; i++){ |
---|
331 | for(int j = 0; j < Y_MAX ; j++){ |
---|
332 | if(j == 0){ |
---|
333 | dspin_signals_cmd_c0[0][i][j][SOUTH].read = true ; |
---|
334 | dspin_signals_cmd_c0[1][i][j][SOUTH].write = false ; |
---|
335 | dspin_signals_cmd_c1[0][i][j][SOUTH].read = true ; |
---|
336 | dspin_signals_cmd_c1[1][i][j][SOUTH].write = false ; |
---|
337 | dspin_signals_rsp_c0[0][i][j][SOUTH].read = true ; |
---|
338 | dspin_signals_rsp_c0[1][i][j][SOUTH].write = false ; |
---|
339 | dspin_signals_rsp_c1[0][i][j][SOUTH].read = true ; |
---|
340 | dspin_signals_rsp_c1[1][i][j][SOUTH].write = false ; |
---|
341 | } |
---|
342 | if(j == Y_MAX-1){ |
---|
343 | dspin_signals_cmd_c0[0][i][j][NORTH].read = true ; |
---|
344 | dspin_signals_cmd_c0[1][i][j][NORTH].write = false ; |
---|
345 | dspin_signals_cmd_c1[0][i][j][NORTH].read = true ; |
---|
346 | dspin_signals_cmd_c1[1][i][j][NORTH].write = false ; |
---|
347 | dspin_signals_rsp_c0[0][i][j][NORTH].read = true ; |
---|
348 | dspin_signals_rsp_c0[1][i][j][NORTH].write = false ; |
---|
349 | dspin_signals_rsp_c1[0][i][j][NORTH].read = true ; |
---|
350 | dspin_signals_rsp_c1[1][i][j][NORTH].write = false ; |
---|
351 | } |
---|
352 | if(i == 0){ |
---|
353 | dspin_signals_cmd_c0[0][i][j][WEST].read = true ; |
---|
354 | dspin_signals_cmd_c0[1][i][j][WEST].write = false ; |
---|
355 | dspin_signals_cmd_c1[0][i][j][WEST].read = true ; |
---|
356 | dspin_signals_cmd_c1[1][i][j][WEST].write = false ; |
---|
357 | dspin_signals_rsp_c0[0][i][j][WEST].read = true ; |
---|
358 | dspin_signals_rsp_c0[1][i][j][WEST].write = false ; |
---|
359 | dspin_signals_rsp_c1[0][i][j][WEST].read = true ; |
---|
360 | dspin_signals_rsp_c1[1][i][j][WEST].write = false ; |
---|
361 | } |
---|
362 | if(i == X_MAX-1){ |
---|
363 | dspin_signals_cmd_c0[0][i][j][EAST].read = true ; |
---|
364 | dspin_signals_cmd_c0[1][i][j][EAST].write = false ; |
---|
365 | dspin_signals_cmd_c1[0][i][j][EAST].read = true ; |
---|
366 | dspin_signals_cmd_c1[1][i][j][EAST].write = false ; |
---|
367 | dspin_signals_rsp_c0[0][i][j][EAST].read = true ; |
---|
368 | dspin_signals_rsp_c0[1][i][j][EAST].write = false ; |
---|
369 | dspin_signals_rsp_c1[0][i][j][EAST].read = true ; |
---|
370 | dspin_signals_rsp_c1[1][i][j][EAST].write = false ; |
---|
371 | } |
---|
372 | } |
---|
373 | } |
---|
374 | |
---|
375 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
376 | signal_resetn = true; |
---|
377 | |
---|
378 | for(int t = 0; t < ncycles; t++){ |
---|
379 | sc_start(sc_time(1, SC_NS)); |
---|
380 | //initiator_c1[4].print_trace(); |
---|
381 | //local_ring_c1[4].print_trace(); |
---|
382 | //target_c1[4].print_trace(); |
---|
383 | #if defined(DEBUG) |
---|
384 | for(int i = 0 ; i < Y_MAX ; i++){ |
---|
385 | for(int j = 0 ; j < X_MAX ; j++){ |
---|
386 | #endif |
---|
387 | #if DEBUG==1 |
---|
388 | //initiator_c0[i*Y_MAX+j].print_trace(); |
---|
389 | //std::cout << std::hex; |
---|
390 | //std::cout << "synt_cmdval = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].cmdval.read() << std::endl; |
---|
391 | //std::cout << "synt_cmdack = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].cmdack.read() << std::endl; |
---|
392 | //std::cout << "synt_address = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].address.read() << std::endl; |
---|
393 | //std::cout << "synt_cmd = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].cmd.read() << std::endl; |
---|
394 | //std::cout << "synt_srcid = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].srcid.read() << std::endl; |
---|
395 | //std::cout << "synt_trdid = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].trdid.read() << std::endl; |
---|
396 | //std::cout << "synt_plen = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].plen.read() << std::endl; |
---|
397 | //std::cout << "synt_eop = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].eop.read() << std::endl; |
---|
398 | //std::cout << "synt_rspval = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].rspval.read() << std::endl; |
---|
399 | //std::cout << "synt_rspack = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].rspack.read() << std::endl; |
---|
400 | //std::cout << "synt_rsrcid = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].rsrcid.read() << std::endl; |
---|
401 | //std::cout << "synt_rtrdid = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].rtrdid.read() << std::endl; |
---|
402 | //std::cout << "synt_rpktid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rpktid.read() << std::endl; |
---|
403 | //std::cout << "synt_rerror = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].rerror.read() << std::endl; |
---|
404 | //std::cout << "synt_reop = " << signal_vci_ini_synth_c0[0][i*Y_MAX+j].reop.read() << std::endl; |
---|
405 | //target_c0[i*Y_MAX+j].print_trace(); |
---|
406 | //std::cout << std::hex; |
---|
407 | //std::cout << "target_cmdval = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].cmdval.read() << std::endl; |
---|
408 | //std::cout << "target_address = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].address.read() << std::endl; |
---|
409 | //std::cout << "target_cmd = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].cmd.read() << std::endl; |
---|
410 | //std::cout << "target_srcid = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].srcid.read() << std::endl; |
---|
411 | //std::cout << "target_trdid = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].trdid.read() << std::endl; |
---|
412 | //std::cout << "target_plen = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].plen.read() << std::endl; |
---|
413 | //std::cout << "target_eop = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].eop.read() << std::endl; |
---|
414 | //std::cout << "target_rspval = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].rspval.read() << std::endl; |
---|
415 | //std::cout << "target_rspack = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].rspack.read() << std::endl; |
---|
416 | //std::cout << "target_rsrcid = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].rsrcid.read() << std::endl; |
---|
417 | //std::cout << "target_rtrdid = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].rtrdid.read() << std::endl; |
---|
418 | //std::cout << "target_rerror = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].rerror.read() << std::endl; |
---|
419 | //std::cout << "target_reop = " << signal_vci_ini_synth_c0[1][i*Y_MAX+j].reop.read() << std::endl; |
---|
420 | //initiator_c1[i*Y_MAX+j].print_trace(); |
---|
421 | //std::cout << std::hex; |
---|
422 | //std::cout << "synt_cmdval = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].cmdval.read() << std::endl; |
---|
423 | //std::cout << "synt_cmdack = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].cmdack.read() << std::endl; |
---|
424 | //std::cout << "synt_address = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].address.read() << std::endl; |
---|
425 | //std::cout << "synt_cmd = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].cmd.read() << std::endl; |
---|
426 | //std::cout << "synt_srcid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].srcid.read() << std::endl; |
---|
427 | //std::cout << "synt_trdid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].trdid.read() << std::endl; |
---|
428 | //std::cout << "synt_pktid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].pktid.read() << std::endl; |
---|
429 | //std::cout << "synt_plen = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].plen.read() << std::endl; |
---|
430 | //std::cout << "synt_eop = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].eop.read() << std::endl; |
---|
431 | //std::cout << "synt_rspval = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rspval.read() << std::endl; |
---|
432 | //std::cout << "synt_rspack = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rspack.read() << std::endl; |
---|
433 | //std::cout << "synt_rsrcid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rsrcid.read() << std::endl; |
---|
434 | //std::cout << "synt_rtrdid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rtrdid.read() << std::endl; |
---|
435 | //std::cout << "synt_rpktid = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rpktid.read() << std::endl; |
---|
436 | //std::cout << "synt_rerror = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].rerror.read() << std::endl; |
---|
437 | //std::cout << "synt_reop = " << signal_vci_ini_synth_c1[0][i*Y_MAX+j].reop.read() << std::endl; |
---|
438 | target_c1[i*Y_MAX+j].print_trace(); |
---|
439 | std::cout << std::hex; |
---|
440 | std::cout << "target_cmdval = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].cmdval.read() << std::endl; |
---|
441 | std::cout << "target_address = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].address.read() << std::endl; |
---|
442 | std::cout << "target_cmd = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].cmd.read() << std::endl; |
---|
443 | std::cout << "target_srcid = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].srcid.read() << std::endl; |
---|
444 | std::cout << "target_trdid = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].trdid.read() << std::endl; |
---|
445 | std::cout << "target_pktid = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].pktid.read() << std::endl; |
---|
446 | std::cout << "target_plen = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].plen.read() << std::endl; |
---|
447 | std::cout << "target_eop = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].eop.read() << std::endl; |
---|
448 | std::cout << "target_rspval = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].rspval.read() << std::endl; |
---|
449 | std::cout << "target_rspack = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].rspack.read() << std::endl; |
---|
450 | std::cout << "target_rsrcid = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].rsrcid.read() << std::endl; |
---|
451 | std::cout << "target_rtrdid = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].rtrdid.read() << std::endl; |
---|
452 | std::cout << "target_rpktid = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].rpktid.read() << std::endl; |
---|
453 | std::cout << "target_rerror = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].rerror.read() << std::endl; |
---|
454 | std::cout << "target_reop = " << signal_vci_ini_synth_c1[1][i*Y_MAX+j].reop.read() << std::endl; |
---|
455 | #endif |
---|
456 | #if DEBUG==2 |
---|
457 | local_ring_c0[i*Y_MAX+j].print_trace(); |
---|
458 | routers_cmd[i][j].print_trace(0); |
---|
459 | std::cout << std::dec << t << " ns" << std::endl; |
---|
460 | routers_rsp[i][j].print_trace(0); |
---|
461 | #endif |
---|
462 | #ifdef DEBUG |
---|
463 | } |
---|
464 | } |
---|
465 | #endif |
---|
466 | //initiator_c1[4].print_trace(); |
---|
467 | //std::cout << std::hex; |
---|
468 | //std::cout << "synt_cmdval = " << signal_vci_ini_synth_c1[0][255].cmdval.read() << std::endl; |
---|
469 | //std::cout << "synt_cmdack = " << signal_vci_ini_synth_c1[0][255].cmdack.read() << std::endl; |
---|
470 | //std::cout << "synt_address = " << signal_vci_ini_synth_c1[0][255].address.read() << std::endl; |
---|
471 | //std::cout << "synt_cmd = " << signal_vci_ini_synth_c1[0][255].cmd.read() << std::endl; |
---|
472 | //std::cout << "synt_srcid = " << signal_vci_ini_synth_c1[0][255].srcid.read() << std::endl; |
---|
473 | //std::cout << "synt_trdid = " << signal_vci_ini_synth_c1[0][255].trdid.read() << std::endl; |
---|
474 | //std::cout << "synt_pktid = " << signal_vci_ini_synth_c1[0][255].pktid.read() << std::endl; |
---|
475 | //std::cout << "synt_plen = " << signal_vci_ini_synth_c1[0][255].plen.read() << std::endl; |
---|
476 | //std::cout << "synt_eop = " << signal_vci_ini_synth_c1[0][255].eop.read() << std::endl; |
---|
477 | //std::cout << "synt_rspval = " << signal_vci_ini_synth_c1[0][255].rspval.read() << std::endl; |
---|
478 | //std::cout << "synt_rspack = " << signal_vci_ini_synth_c1[0][255].rspack.read() << std::endl; |
---|
479 | //std::cout << "synt_rsrcid = " << signal_vci_ini_synth_c1[0][255].rsrcid.read() << std::endl; |
---|
480 | //std::cout << "synt_rtrdid = " << signal_vci_ini_synth_c1[0][255].rtrdid.read() << std::endl; |
---|
481 | //std::cout << "synt_rpktid = " << signal_vci_ini_synth_c1[0][255].rpktid.read() << std::endl; |
---|
482 | //std::cout << "synt_rerror = " << signal_vci_ini_synth_c1[0][255].rerror.read() << std::endl; |
---|
483 | //std::cout << "synt_reop = " << signal_vci_ini_synth_c1[0][255].reop.read() << std::endl; |
---|
484 | //target_c1[4].print_trace(); |
---|
485 | //std::cout << std::hex; |
---|
486 | //std::cout << "target_cmdval = " << signal_vci_ini_synth_c1[1][4].cmdval.read() << std::endl; |
---|
487 | //std::cout << "target_address = " << signal_vci_ini_synth_c1[1][4].address.read() << std::endl; |
---|
488 | //std::cout << "target_cmd = " << signal_vci_ini_synth_c1[1][4].cmd.read() << std::endl; |
---|
489 | //std::cout << "target_srcid = " << signal_vci_ini_synth_c1[1][4].srcid.read() << std::endl; |
---|
490 | //std::cout << "target_trdid = " << signal_vci_ini_synth_c1[1][4].trdid.read() << std::endl; |
---|
491 | //std::cout << "target_pktid = " << signal_vci_ini_synth_c1[1][4].pktid.read() << std::endl; |
---|
492 | //std::cout << "target_plen = " << signal_vci_ini_synth_c1[1][4].plen.read() << std::endl; |
---|
493 | //std::cout << "target_eop = " << signal_vci_ini_synth_c1[1][4].eop.read() << std::endl; |
---|
494 | //std::cout << "target_rspval = " << signal_vci_ini_synth_c1[1][4].rspval.read() << std::endl; |
---|
495 | //std::cout << "target_rspack = " << signal_vci_ini_synth_c1[1][4].rspack.read() << std::endl; |
---|
496 | //std::cout << "target_rsrcid = " << signal_vci_ini_synth_c1[1][4].rsrcid.read() << std::endl; |
---|
497 | //std::cout << "target_rtrdid = " << signal_vci_ini_synth_c1[1][4].rtrdid.read() << std::endl; |
---|
498 | //std::cout << "target_rpktid = " << signal_vci_ini_synth_c1[1][4].rpktid.read() << std::endl; |
---|
499 | //std::cout << "target_rerror = " << signal_vci_ini_synth_c1[1][4].rerror.read() << std::endl; |
---|
500 | //std::cout << "target_reop = " << signal_vci_ini_synth_c1[1][4].reop.read() << std::endl; |
---|
501 | |
---|
502 | //for(int i = 0 ; i < Y_MAX ; i++){ |
---|
503 | // for(int j = 0 ; j < X_MAX ; j++){ |
---|
504 | // std::cout << std::dec << t << " cycles " << std::endl; |
---|
505 | // local_ring_c1[i*Y_MAX+j].print_trace(); |
---|
506 | // //initiator_c1[i*Y_MAX+j].print_trace(); |
---|
507 | // } |
---|
508 | //} |
---|
509 | //initiator_c1[4].print_trace(); |
---|
510 | //std::cout << std::hex; |
---|
511 | //std::cout << "synt_cmdval = " << signal_vci_ini_synth_c1[0][4].cmdval.read() << std::endl; |
---|
512 | //std::cout << "synt_cmdack = " << signal_vci_ini_synth_c1[0][4].cmdack.read() << std::endl; |
---|
513 | //std::cout << "synt_address = " << signal_vci_ini_synth_c1[0][4].address.read() << std::endl; |
---|
514 | //std::cout << "synt_cmd = " << signal_vci_ini_synth_c1[0][4].cmd.read() << std::endl; |
---|
515 | //std::cout << "synt_srcid = " << signal_vci_ini_synth_c1[0][4].srcid.read() << std::endl; |
---|
516 | //std::cout << "synt_trdid = " << signal_vci_ini_synth_c1[0][4].trdid.read() << std::endl; |
---|
517 | //std::cout << "synt_pktid = " << signal_vci_ini_synth_c1[0][4].pktid.read() << std::endl; |
---|
518 | //std::cout << "synt_plen = " << signal_vci_ini_synth_c1[0][4].plen.read() << std::endl; |
---|
519 | //std::cout << "synt_eop = " << signal_vci_ini_synth_c1[0][4].eop.read() << std::endl; |
---|
520 | //std::cout << "synt_rspval = " << signal_vci_ini_synth_c1[0][4].rspval.read() << std::endl; |
---|
521 | //std::cout << "synt_rspack = " << signal_vci_ini_synth_c1[0][4].rspack.read() << std::endl; |
---|
522 | //std::cout << "synt_rsrcid = " << signal_vci_ini_synth_c1[0][4].rsrcid.read() << std::endl; |
---|
523 | //std::cout << "synt_rtrdid = " << signal_vci_ini_synth_c1[0][4].rtrdid.read() << std::endl; |
---|
524 | //std::cout << "synt_rpktid = " << signal_vci_ini_synth_c1[0][4].rpktid.read() << std::endl; |
---|
525 | //std::cout << "synt_rerror = " << signal_vci_ini_synth_c1[0][4].rerror.read() << std::endl; |
---|
526 | //std::cout << "synt_reop = " << signal_vci_ini_synth_c1[0][4].reop.read() << std::endl; |
---|
527 | //local_ring_c1[4].print_trace(); |
---|
528 | //initiator_c1[27].print_fifo_state(); |
---|
529 | //if (!(t%1000000)) |
---|
530 | // std::cout <<std::dec << t << " 1000000 cycles passed" << std::endl; |
---|
531 | |
---|
532 | |
---|
533 | } |
---|
534 | |
---|
535 | //double latency_c0 = 0; |
---|
536 | double latency_c1 = 0; |
---|
537 | double latency_bc = 0; |
---|
538 | std::cout << "Results : " << std::endl; |
---|
539 | for(int i = 0 ; i < Y_MAX ; i++){ |
---|
540 | for(int j = 0 ; j < X_MAX ; j++){ |
---|
541 | //initiator_c0[i*Y_MAX+j].printStats(); |
---|
542 | //latency_c0 += initiator_c0[i*Y_MAX+j].getLatencySingle() ; |
---|
543 | initiator_c1[i*Y_MAX+j].printStats(); |
---|
544 | latency_c1 += initiator_c1[i*Y_MAX+j].getLatencySingle() ; |
---|
545 | latency_bc += initiator_c1[i*Y_MAX+j].getLatencyBC(); |
---|
546 | std::cout << "bc latency " << latency_bc << std::endl; |
---|
547 | } |
---|
548 | } |
---|
549 | |
---|
550 | |
---|
551 | //std::cout << "Latency_c0 : " << latency_c0 << std::endl; |
---|
552 | std::cout << "Latency_c1 : " << latency_c1 << std::endl; |
---|
553 | std::cout << "BC latency : " << latency_bc << std::endl; |
---|
554 | |
---|
555 | std::cout << "Simulation Ends" << std::endl; |
---|
556 | |
---|
557 | |
---|
558 | return EXIT_SUCCESS; |
---|
559 | } |
---|
560 | |
---|
561 | int sc_main (int argc, char *argv[]) |
---|
562 | { |
---|
563 | try { |
---|
564 | return _main(argc, argv); |
---|
565 | } catch (std::exception &e) { |
---|
566 | std::cout << e.what() << std::endl; |
---|
567 | } catch (...) { |
---|
568 | std::cout << "Unknown exception occured" << std::endl; |
---|
569 | throw; |
---|
570 | } |
---|
571 | return 1; |
---|
572 | } |
---|
573 | |
---|