1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File: top.cpp |
---|
3 | // Author: Alain Greiner |
---|
4 | // Copyright: UPMC/LIP6 |
---|
5 | // Date : august 2013 |
---|
6 | // This program is released under the GNU public license |
---|
7 | /////////////////////////////////////////////////////////////////////////////// |
---|
8 | // This file define a generic TSAR architecture with an IO network emulating |
---|
9 | // an external bus (i.e. Hypertransport) to access external peripherals: |
---|
10 | // |
---|
11 | // - BROM : boot ROM |
---|
12 | // - FBUF : Frame Buffer |
---|
13 | // - MTTY : multi TTY (up to 15 channels) |
---|
14 | // - MNIC : Network controller (up to 2 channels) |
---|
15 | // - CDMA : Chained Buffer DMA controller (up to 4 channels) |
---|
16 | // - BDEV : Dlock Device controler (1 channel) |
---|
17 | // |
---|
18 | // The internal physical address space is 40 bits. |
---|
19 | // |
---|
20 | // It contains a 2D mesh of XMAX*YMAX clusters, and 3 networks: |
---|
21 | // |
---|
22 | // 1) the INT network supports Read/Write transactions |
---|
23 | // between processors and L2 caches or peripherals. |
---|
24 | // (VCI ADDDRESS = 40 bits / VCI DATA width = 32 bits) |
---|
25 | // It supports also coherence transactions between L1 & L2 caches. |
---|
26 | // 3) the RAM network is emulating the 3D network between L2 caches |
---|
27 | // and L3 caches, and is implemented as a 2D mesh between the L2 caches, |
---|
28 | // the two IO bridges and the physical RAMs disributed in all clusters. |
---|
29 | // (VCI ADDRESS = 40 bits / VCI DATA = 64 bits) |
---|
30 | // 4) the IOX network connects the two IO bridge components to the |
---|
31 | // 6 external peripheral controllers. |
---|
32 | // (VCI ADDDRESS = 40 bits / VCI DATA width = 64 bits) |
---|
33 | // |
---|
34 | // The external peripherals IRQs are connected to the XICU component |
---|
35 | // in cluster(0,0): therefore, the number of channels for the external |
---|
36 | // peripherals (MTTY, MNIC, CDMA) is limited by the number of IRQ ports... |
---|
37 | // |
---|
38 | // In cluster(0,0), the XICU HWI input ports are connected as follow: |
---|
39 | // - IRQ_IN[0] to IRQ_IN[7] grounded (reserved for PTI or SWI) |
---|
40 | // - IRQ_IN[8] to IRQ_IN[9] are connected to 2 NIC_RX channels. |
---|
41 | // - IRQ_IN[10] to IRQ_IN[11] are connected to 2 NIC_TX channels. |
---|
42 | // - IRQ_IN[12] to IRQ_IN[15] are connected to 4 CDMA channels |
---|
43 | // - IRQ_IN[16] to IRQ_IN[30] are connected to 15 TTY channels |
---|
44 | // - IRQ_IN[31] is connected to BDEV |
---|
45 | // In other clusters, the XICU HWI input ports are grounded. |
---|
46 | // |
---|
47 | // All clusters are identical, but cluster(0,0) and cluster(XMAX-1,YMAX-1) |
---|
48 | // contain an extra IO bridge component. These IOB0 & IOB1 components are |
---|
49 | // connected to the three networks (INT, RAM, IOX). |
---|
50 | // The number of clusters cannot be larger than 256. |
---|
51 | // The number of processors per cluster cannot be larger than 4. |
---|
52 | // |
---|
53 | // - It uses two dspin_local_crossbar per cluster to implement the |
---|
54 | // local interconnect correponding to the INT network. |
---|
55 | // - It uses two dspin_local_crossbar per cluster to implement the |
---|
56 | // local interconnect correponding to the coherence INT network. |
---|
57 | // - It uses two virtual_dspin_router per cluster to implement |
---|
58 | // the INT network (routing both the direct and coherence trafic). |
---|
59 | // - It uses two dspin_router per cluster to implement the RAM network. |
---|
60 | // - It uses the vci_cc_vcache_wrapper. |
---|
61 | // - It uses the vci_mem_cache. |
---|
62 | // - It contains one vci_xicu and one vci_multi_dma per cluster. |
---|
63 | // - It contains one vci_simple ram per cluster to model the L3 cache. |
---|
64 | // |
---|
65 | // The TsarIobCluster component is defined in files |
---|
66 | // tsar_iob_cluster.* (with * = cpp, h, sd) |
---|
67 | // |
---|
68 | // The main hardware parameters must be defined in the hard_config.h file : |
---|
69 | // - XMAX : number of clusters in a row (power of 2) |
---|
70 | // - YMAX : number of clusters in a column (power of 2) |
---|
71 | // - CLUSTER_SIZE : size of the segment allocated to a cluster |
---|
72 | // - NB_PROCS_MAX : number of processors per cluster (power of 2) |
---|
73 | // - NB_DMA_CHANNELS : number of DMA channels per cluster (< 9) |
---|
74 | // - NB_TTY_CHANNELS : number of TTY channels in I/O network (< 16) |
---|
75 | // - NB_NIC_CHANNELS : number of NIC channels in I/O network (< 9) |
---|
76 | // |
---|
77 | // Some secondary hardware parameters must be defined in this top.cpp file: |
---|
78 | // - XRAM_LATENCY : external ram latency |
---|
79 | // - MEMC_WAYS : L2 cache number of ways |
---|
80 | // - MEMC_SETS : L2 cache number of sets |
---|
81 | // - L1_IWAYS |
---|
82 | // - L1_ISETS |
---|
83 | // - L1_DWAYS |
---|
84 | // - L1_DSETS |
---|
85 | // - FBUF_X_SIZE : width of frame buffer (pixels) |
---|
86 | // - FBUF_Y_SIZE : heigth of frame buffer (lines) |
---|
87 | // - BDEV_SECTOR_SIZE : block size for block drvice |
---|
88 | // - BDEV_IMAGE_NAME : file pathname for block device |
---|
89 | // - NIC_RX_NAME : file pathname for NIC received packets |
---|
90 | // - NIC_TX_NAME : file pathname for NIC transmited packets |
---|
91 | // - NIC_TIMEOUT : max number of cycles before closing a container |
---|
92 | // |
---|
93 | // General policy for 40 bits physical address decoding: |
---|
94 | // All physical segments base addresses are multiple of 1 Mbytes |
---|
95 | // (=> the 24 LSB bits = 0, and the 16 MSB bits define the target) |
---|
96 | // The (x_width + y_width) MSB bits (left aligned) define |
---|
97 | // the cluster index, and the LADR bits define the local index: |
---|
98 | // | X_ID | Y_ID |---| LADR | OFFSET | |
---|
99 | // |x_width|y_width|---| 8 | 24 | |
---|
100 | // |
---|
101 | // General policy for 14 bits SRCID decoding: |
---|
102 | // Each component is identified by (x_id, y_id, l_id) tuple. |
---|
103 | // | X_ID | Y_ID |---| L_ID | |
---|
104 | // |x_width|y_width|---| 6 | |
---|
105 | ///////////////////////////////////////////////////////////////////////// |
---|
106 | |
---|
107 | #include <systemc> |
---|
108 | #include <sys/time.h> |
---|
109 | #include <iostream> |
---|
110 | #include <sstream> |
---|
111 | #include <cstdlib> |
---|
112 | #include <cstdarg> |
---|
113 | #include <stdint.h> |
---|
114 | |
---|
115 | #include "gdbserver.h" |
---|
116 | #include "mapping_table.h" |
---|
117 | |
---|
118 | #include "tsar_iob_cluster.h" |
---|
119 | #include "vci_chbuf_dma.h" |
---|
120 | #include "vci_multi_tty.h" |
---|
121 | #include "vci_multi_nic.h" |
---|
122 | #include "vci_simple_rom.h" |
---|
123 | #include "vci_block_device_tsar.h" |
---|
124 | #include "vci_framebuffer.h" |
---|
125 | #include "vci_iox_network.h" |
---|
126 | |
---|
127 | #include "alloc_elems.h" |
---|
128 | |
---|
129 | /////////////////////////////////////////////////// |
---|
130 | // OS |
---|
131 | /////////////////////////////////////////////////// |
---|
132 | #define USE_ALMOS 0 |
---|
133 | |
---|
134 | #define almos_bootloader_pathname "bootloader.bin" |
---|
135 | #define almos_kernel_pathname "kernel-soclib.bin@0xbfc10000:D" |
---|
136 | #define almos_archinfo_pathname "arch-info.bin@0xBFC08000:D" |
---|
137 | |
---|
138 | /////////////////////////////////////////////////// |
---|
139 | // Parallelisation |
---|
140 | /////////////////////////////////////////////////// |
---|
141 | #define USE_OPENMP 0 |
---|
142 | |
---|
143 | #if USE_OPENMP |
---|
144 | #include <omp.h> |
---|
145 | #endif |
---|
146 | |
---|
147 | /////////////////////////////////////////////////////////// |
---|
148 | // DSPIN parameters |
---|
149 | /////////////////////////////////////////////////////////// |
---|
150 | |
---|
151 | #define dspin_int_cmd_width 39 |
---|
152 | #define dspin_int_rsp_width 32 |
---|
153 | |
---|
154 | #define dspin_ram_cmd_width 64 |
---|
155 | #define dspin_ram_rsp_width 64 |
---|
156 | |
---|
157 | /////////////////////////////////////////////////////////// |
---|
158 | // VCI fields width for the 3 VCI networks |
---|
159 | /////////////////////////////////////////////////////////// |
---|
160 | |
---|
161 | #define vci_cell_width_int 4 |
---|
162 | #define vci_cell_width_ext 8 |
---|
163 | |
---|
164 | #define vci_plen_width 8 |
---|
165 | #define vci_address_width 40 |
---|
166 | #define vci_rerror_width 1 |
---|
167 | #define vci_clen_width 1 |
---|
168 | #define vci_rflag_width 1 |
---|
169 | #define vci_srcid_width 14 |
---|
170 | #define vci_pktid_width 4 |
---|
171 | #define vci_trdid_width 4 |
---|
172 | #define vci_wrplen_width 1 |
---|
173 | |
---|
174 | //////////////////////////////////////////////////////////// |
---|
175 | // Main Hardware Parameters values |
---|
176 | //////////////////////i///////////////////////////////////// |
---|
177 | |
---|
178 | #include "/Users/alain/soc/giet_vm/hard_config.h" |
---|
179 | |
---|
180 | //////////////////////////////////////////////////////////// |
---|
181 | // Secondary Hardware Parameters values |
---|
182 | //////////////////////i///////////////////////////////////// |
---|
183 | |
---|
184 | #define XMAX CLUSTER_X |
---|
185 | #define YMAX CLUSTER_Y |
---|
186 | |
---|
187 | #define XRAM_LATENCY 0 |
---|
188 | |
---|
189 | #define MEMC_WAYS 16 |
---|
190 | #define MEMC_SETS 256 |
---|
191 | |
---|
192 | #define L1_IWAYS 4 |
---|
193 | #define L1_ISETS 64 |
---|
194 | |
---|
195 | #define L1_DWAYS 4 |
---|
196 | #define L1_DSETS 64 |
---|
197 | |
---|
198 | #define FBUF_X_SIZE 128 |
---|
199 | #define FBUF_Y_SIZE 128 |
---|
200 | |
---|
201 | #define BDEV_SECTOR_SIZE 512 |
---|
202 | #define BDEV_IMAGE_NAME "giet_vm/display/images.raw" |
---|
203 | |
---|
204 | #define NIC_RX_NAME "giet_vm/nic/rx_packets.txt" |
---|
205 | #define NIC_TX_NAME "giet_vm/nic/tx_packets.txt" |
---|
206 | #define NIC_TIMEOUT 10000 |
---|
207 | |
---|
208 | #define NORTH 0 |
---|
209 | #define SOUTH 1 |
---|
210 | #define EAST 2 |
---|
211 | #define WEST 3 |
---|
212 | |
---|
213 | #define cluster(x,y) ((y) + YMAX*(x)) |
---|
214 | |
---|
215 | //////////////////////////////////////////////////////////// |
---|
216 | // Software to be loaded in ROM & RAM |
---|
217 | //////////////////////i///////////////////////////////////// |
---|
218 | |
---|
219 | #define BOOT_SOFT_NAME "giet_vm/soft.elf" |
---|
220 | |
---|
221 | //////////////////////////////////////////////////////////// |
---|
222 | // DEBUG Parameters default values |
---|
223 | //////////////////////i///////////////////////////////////// |
---|
224 | |
---|
225 | #define MAX_FROZEN_CYCLES 10000 |
---|
226 | |
---|
227 | ///////////////////////////////////////////////////////// |
---|
228 | // Physical segments definition |
---|
229 | ///////////////////////////////////////////////////////// |
---|
230 | |
---|
231 | // Non replicated peripherals (must be in cluster 0) |
---|
232 | |
---|
233 | #define BROM_BASE 0x00BFC00000 |
---|
234 | #define BROM_SIZE 0x0000100000 // 1 M Kbytes |
---|
235 | |
---|
236 | #define IOBX_BASE 0x00BE000000 |
---|
237 | #define IOBX_SIZE 0x0000001000 // 4 K Kbytes |
---|
238 | |
---|
239 | #define BDEV_BASE 0x00B3000000 |
---|
240 | #define BDEV_SIZE 0x0000008000 // 4 Kbytes |
---|
241 | |
---|
242 | #define MTTY_BASE 0x00B4000000 |
---|
243 | #define MTTY_SIZE 0x0000001000 * NB_TTY_CHANNELS // 4 Kbytes |
---|
244 | |
---|
245 | #define MNIC_BASE 0x00B5000000 |
---|
246 | #define MNIC_SIZE 0x0000080000 // 512 Kbytes |
---|
247 | |
---|
248 | #define CDMA_BASE 0x00B6000000 |
---|
249 | #define CDMA_SIZE 0x0000001000 * (NB_NIC_CHANNELS * 2) // 4 Kbytes per channel |
---|
250 | |
---|
251 | #define FBUF_BASE 0x00B7000000 |
---|
252 | #define FBUF_SIZE FBUF_X_SIZE * FBUF_Y_SIZE |
---|
253 | |
---|
254 | // Replicated peripherals : address is incremented by a cluster offset |
---|
255 | // offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
256 | |
---|
257 | #define XRAM_BASE 0x0000000000 |
---|
258 | #define XRAM_SIZE 0x0010000000 // 256 Mbytes |
---|
259 | |
---|
260 | #define XICU_BASE 0x00B0000000 |
---|
261 | #define XICU_SIZE 0x0000001000 // 4 Kbytes |
---|
262 | |
---|
263 | #define MDMA_BASE 0x00B1000000 |
---|
264 | #define MDMA_SIZE 0x0000001000 * NB_DMA_CHANNELS // 4 Kbytes per channel |
---|
265 | |
---|
266 | // Replicated memory segments (XRAM) : address is incremented by a cluster offset |
---|
267 | // offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
268 | |
---|
269 | #define MEMC_BASE 0x00B2000000 |
---|
270 | #define MEMC_SIZE 0x0000001000 // 4 Kbytes |
---|
271 | |
---|
272 | //////////////////////////////////////////////////////////////////////// |
---|
273 | // SRCID definition |
---|
274 | //////////////////////////////////////////////////////////////////////// |
---|
275 | // All initiators are in the same indexing space (14 bits). |
---|
276 | // The SRCID is structured in two fields: |
---|
277 | // - The 10 MSB bits define the cluster index (left aligned) |
---|
278 | // - The 4 LSB bits define the local index. |
---|
279 | // Two different initiators cannot have the same SRCID, but a given |
---|
280 | // initiator can have two alias SRCIDs: |
---|
281 | // - Internal initiators (procs, mdma) are replicated in all clusters, |
---|
282 | // and each initiator has one single SRCID. |
---|
283 | // - External initiators (bdev, cdma) are not replicated, but can be |
---|
284 | // accessed in 2 clusters : cluster_iob0 and cluster_iob1. |
---|
285 | // They have the same local index, but two different cluster indexes. |
---|
286 | // As cluster_iob0 and cluster_iob1 contain both internal initiators |
---|
287 | // and external initiators, they must have different local indexes. |
---|
288 | // Consequence: For a local interconnect, the INI_ID port index |
---|
289 | // is NOT equal to the SRCID local index, and the local interconnect |
---|
290 | // must make a translation: SRCID => INI_ID (port index) |
---|
291 | //////////////////////////////////////////////////////////////////////// |
---|
292 | |
---|
293 | #define PROC_LOCAL_SRCID 0x0 // from 0 to 7 |
---|
294 | #define MDMA_LOCAL_SRCID 0x8 |
---|
295 | #define IOBX_LOCAL_SRCID 0x9 |
---|
296 | #define MEMC_LOCAL_SRCID 0xA |
---|
297 | #define CDMA_LOCAL_SRCID 0xE // hard-coded in dspin_tsar |
---|
298 | #define BDEV_LOCAL_SRCID 0xF // hard-coded in dspin_tsar |
---|
299 | |
---|
300 | /////////////////////////////////////////////////////////////////////// |
---|
301 | // TGT_ID and INI_ID port indexing for INT local interconnect |
---|
302 | /////////////////////////////////////////////////////////////////////// |
---|
303 | |
---|
304 | #define INT_MEMC_TGT_ID 0 |
---|
305 | #define INT_XICU_TGT_ID 1 |
---|
306 | #define INT_MDMA_TGT_ID 2 |
---|
307 | #define INT_IOBX_TGT_ID 3 |
---|
308 | |
---|
309 | #define INT_PROC_INI_ID 0 // from 0 to (NB_PROCS_MAX-1) |
---|
310 | #define INT_MDMA_INI_ID NB_PROCS_MAX |
---|
311 | #define INT_IOBX_INI_ID (NB_PROCS_MAX+1) |
---|
312 | |
---|
313 | /////////////////////////////////////////////////////////////////////// |
---|
314 | // TGT_ID and INI_ID port indexing for RAM local interconnect |
---|
315 | /////////////////////////////////////////////////////////////////////// |
---|
316 | |
---|
317 | #define RAM_XRAM_TGT_ID 0 |
---|
318 | |
---|
319 | #define RAM_MEMC_INI_ID 0 |
---|
320 | #define RAM_IOBX_INI_ID 1 |
---|
321 | |
---|
322 | /////////////////////////////////////////////////////////////////////// |
---|
323 | // TGT_ID and INI_ID port indexing for I0X local interconnect |
---|
324 | /////////////////////////////////////////////////////////////////////// |
---|
325 | |
---|
326 | #define IOX_IOB0_TGT_ID 0 // don't change this value |
---|
327 | #define IOX_IOB1_TGT_ID 1 // don't change this value |
---|
328 | #define IOX_FBUF_TGT_ID 2 |
---|
329 | #define IOX_BDEV_TGT_ID 3 |
---|
330 | #define IOX_MNIC_TGT_ID 4 |
---|
331 | #define IOX_CDMA_TGT_ID 5 |
---|
332 | #define IOX_BROM_TGT_ID 6 |
---|
333 | #define IOX_MTTY_TGT_ID 7 |
---|
334 | |
---|
335 | #define IOX_IOB0_INI_ID 0 // Don't change this value |
---|
336 | #define IOX_IOB1_INI_ID 1 // Don't change this value |
---|
337 | #define IOX_BDEV_INI_ID 2 |
---|
338 | #define IOX_CDMA_INI_ID 3 |
---|
339 | |
---|
340 | //////////////////////////////////////////////////////////////////////// |
---|
341 | int _main(int argc, char *argv[]) |
---|
342 | //////////////////////////////////////////////////////////////////////// |
---|
343 | { |
---|
344 | using namespace sc_core; |
---|
345 | using namespace soclib::caba; |
---|
346 | using namespace soclib::common; |
---|
347 | |
---|
348 | |
---|
349 | char soft_name[256] = BOOT_SOFT_NAME; // pathname: binary code |
---|
350 | size_t ncycles = 1000000000; // simulated cycles |
---|
351 | char disk_name[256] = BDEV_IMAGE_NAME; // pathname: disk image |
---|
352 | char nic_rx_name[256] = NIC_RX_NAME; // pathname: rx packets file |
---|
353 | char nic_tx_name[256] = NIC_TX_NAME; // pathname: tx packets file |
---|
354 | ssize_t threads_nr = 1; // simulator's threads number |
---|
355 | bool debug_ok = false; // trace activated |
---|
356 | size_t debug_period = 1; // trace period |
---|
357 | size_t debug_memc_id = 0xFFFFFFFF; // index of traced memc |
---|
358 | size_t debug_proc_id = 0xFFFFFFFF; // index of traced proc |
---|
359 | bool debug_iob = false; // trace iob0 & iob1 when true |
---|
360 | uint32_t debug_from = 0; // trace start cycle |
---|
361 | uint32_t frozen_cycles = MAX_FROZEN_CYCLES; // monitoring frozen processor |
---|
362 | size_t cluster_iob0 = cluster(0,0); // cluster containing IOB0 |
---|
363 | size_t cluster_iob1 = cluster(XMAX-1,YMAX-1); // cluster containing IOB1 |
---|
364 | size_t block_size = BDEV_SECTOR_SIZE; // disk block size |
---|
365 | |
---|
366 | ////////////// command line arguments ////////////////////// |
---|
367 | if (argc > 1) |
---|
368 | { |
---|
369 | for (int n = 1; n < argc; n = n + 2) |
---|
370 | { |
---|
371 | if ((strcmp(argv[n],"-NCYCLES") == 0) && (n+1<argc)) |
---|
372 | { |
---|
373 | ncycles = atoi(argv[n+1]); |
---|
374 | } |
---|
375 | else if ((strcmp(argv[n],"-SOFT") == 0) && (n+1<argc) ) |
---|
376 | { |
---|
377 | strcpy(soft_name, argv[n+1]); |
---|
378 | } |
---|
379 | else if ((strcmp(argv[n],"-DEBUG") == 0) && (n+1<argc) ) |
---|
380 | { |
---|
381 | debug_ok = true; |
---|
382 | debug_from = atoi(argv[n+1]); |
---|
383 | } |
---|
384 | else if ((strcmp(argv[n],"-DISK") == 0) && (n+1<argc) ) |
---|
385 | { |
---|
386 | strcpy(disk_name, argv[n+1]); |
---|
387 | } |
---|
388 | else if ((strcmp(argv[n],"-MEMCID") == 0) && (n+1<argc) ) |
---|
389 | { |
---|
390 | debug_memc_id = atoi(argv[n+1]); |
---|
391 | assert( (debug_memc_id < (XMAX*YMAX) ) && |
---|
392 | "debug_memc_id larger than XMAX * YMAX" ); |
---|
393 | } |
---|
394 | else if ((strcmp(argv[n],"-IOB") == 0) && (n+1<argc) ) |
---|
395 | { |
---|
396 | debug_iob = atoi(argv[n+1]); |
---|
397 | } |
---|
398 | else if ((strcmp(argv[n],"-PROCID") == 0) && (n+1<argc) ) |
---|
399 | { |
---|
400 | debug_proc_id = atoi(argv[n+1]); |
---|
401 | assert( (debug_proc_id < (XMAX * YMAX * NB_PROCS_MAX) ) && |
---|
402 | "debug_proc_id larger than XMAX * YMAX * NB_PROCS" ); |
---|
403 | } |
---|
404 | else if ((strcmp(argv[n], "-THREADS") == 0) && ((n+1) < argc)) |
---|
405 | { |
---|
406 | threads_nr = atoi(argv[n+1]); |
---|
407 | threads_nr = (threads_nr < 1) ? 1 : threads_nr; |
---|
408 | } |
---|
409 | else if ((strcmp(argv[n], "-FROZEN") == 0) && (n+1 < argc)) |
---|
410 | { |
---|
411 | frozen_cycles = atoi(argv[n+1]); |
---|
412 | } |
---|
413 | else if ((strcmp(argv[n], "-PERIOD") == 0) && (n+1 < argc)) |
---|
414 | { |
---|
415 | debug_period = atoi(argv[n+1]); |
---|
416 | } |
---|
417 | else |
---|
418 | { |
---|
419 | std::cout << " Arguments are (key,value) couples." << std::endl; |
---|
420 | std::cout << " The order is not important." << std::endl; |
---|
421 | std::cout << " Accepted arguments are :" << std::endl << std::endl; |
---|
422 | std::cout << " -SOFT pathname_for_embedded_soft" << std::endl; |
---|
423 | std::cout << " -DISK pathname_for_disk_image" << std::endl; |
---|
424 | std::cout << " -NCYCLES number_of_simulated_cycles" << std::endl; |
---|
425 | std::cout << " -DEBUG debug_start_cycle" << std::endl; |
---|
426 | std::cout << " -THREADS simulator's threads number" << std::endl; |
---|
427 | std::cout << " -FROZEN max_number_of_lines" << std::endl; |
---|
428 | std::cout << " -PERIOD number_of_cycles between trace" << std::endl; |
---|
429 | std::cout << " -MEMCID index_memc_to_be_traced" << std::endl; |
---|
430 | std::cout << " -PROCID index_proc_to_be_traced" << std::endl; |
---|
431 | std::cout << " -IOB non_zero_value" << std::endl; |
---|
432 | exit(0); |
---|
433 | } |
---|
434 | } |
---|
435 | } |
---|
436 | |
---|
437 | // checking hardware parameters |
---|
438 | assert( ( (XMAX == 1) or (XMAX == 2) or (XMAX == 4) or |
---|
439 | (XMAX == 8) or (XMAX == 16) ) and |
---|
440 | "The XMAX parameter must be 1, 2, 4, 8 or 16" ); |
---|
441 | |
---|
442 | assert( ( (YMAX == 1) or (YMAX == 2) or (YMAX == 4) or |
---|
443 | (YMAX == 8) or (YMAX == 16) ) and |
---|
444 | "The YMAX parameter must be 1, 2, 4, 8 or 16" ); |
---|
445 | |
---|
446 | assert( ( (NB_PROCS_MAX == 1) or (NB_PROCS_MAX == 2) or (NB_PROCS_MAX == 4) ) and |
---|
447 | "The NB_PROCS_MAX parameter must be 1, 2, 4" ); |
---|
448 | |
---|
449 | assert( (NB_DMA_CHANNELS == 4) and |
---|
450 | "The NB_DMA_CHANNELS parameter must be 4" ); |
---|
451 | |
---|
452 | assert( (NB_TTY_CHANNELS < 16) and |
---|
453 | "The NB_TTY_CHANNELS parameter must be smaller than 16" ); |
---|
454 | |
---|
455 | assert( (NB_NIC_CHANNELS == 2) and |
---|
456 | "The NB_NIC_CHANNELS parameter must be 2" ); |
---|
457 | |
---|
458 | std::cout << std::endl; |
---|
459 | std::cout << " - XMAX = " << XMAX << std::endl; |
---|
460 | std::cout << " - YMAX = " << YMAX << std::endl; |
---|
461 | std::cout << " - NB_PROCS_MAX = " << NB_PROCS_MAX << std::endl; |
---|
462 | std::cout << " - NB_DMA_CHANNELS = " << NB_DMA_CHANNELS << std::endl; |
---|
463 | std::cout << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl; |
---|
464 | std::cout << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl; |
---|
465 | std::cout << " - MEMC_WAYS = " << MEMC_WAYS << std::endl; |
---|
466 | std::cout << " - MEMC_SETS = " << MEMC_SETS << std::endl; |
---|
467 | std::cout << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl; |
---|
468 | std::cout << " - MAX_FROZEN = " << frozen_cycles << std::endl; |
---|
469 | |
---|
470 | std::cout << std::endl; |
---|
471 | |
---|
472 | #if USE_OPENMP |
---|
473 | omp_set_dynamic(false); |
---|
474 | omp_set_num_threads(threads_nr); |
---|
475 | std::cerr << "Built with openmp version " << _OPENMP << std::endl; |
---|
476 | #endif |
---|
477 | |
---|
478 | // Define VciParams objects |
---|
479 | typedef soclib::caba::VciParams<vci_cell_width_int, |
---|
480 | vci_plen_width, |
---|
481 | vci_address_width, |
---|
482 | vci_rerror_width, |
---|
483 | vci_clen_width, |
---|
484 | vci_rflag_width, |
---|
485 | vci_srcid_width, |
---|
486 | vci_pktid_width, |
---|
487 | vci_trdid_width, |
---|
488 | vci_wrplen_width> vci_param_int; |
---|
489 | |
---|
490 | typedef soclib::caba::VciParams<vci_cell_width_ext, |
---|
491 | vci_plen_width, |
---|
492 | vci_address_width, |
---|
493 | vci_rerror_width, |
---|
494 | vci_clen_width, |
---|
495 | vci_rflag_width, |
---|
496 | vci_srcid_width, |
---|
497 | vci_pktid_width, |
---|
498 | vci_trdid_width, |
---|
499 | vci_wrplen_width> vci_param_ext; |
---|
500 | |
---|
501 | // Define parameters depending on mesh size |
---|
502 | size_t x_width; |
---|
503 | size_t y_width; |
---|
504 | |
---|
505 | if (XMAX == 1) x_width = 0; |
---|
506 | else if (XMAX == 2) x_width = 1; |
---|
507 | else if (XMAX <= 4) x_width = 2; |
---|
508 | else if (XMAX <= 8) x_width = 3; |
---|
509 | else x_width = 4; |
---|
510 | |
---|
511 | if (YMAX == 1) y_width = 0; |
---|
512 | else if (YMAX == 2) y_width = 1; |
---|
513 | else if (YMAX <= 4) y_width = 2; |
---|
514 | else if (YMAX <= 8) y_width = 3; |
---|
515 | else y_width = 4; |
---|
516 | |
---|
517 | ///////////////////////////////////////////////////////////////////// |
---|
518 | // INT network mapping table |
---|
519 | // - two levels address decoding for commands |
---|
520 | // - two levels srcid decoding for responses |
---|
521 | // - NB_PROCS_MAX + 2 (MDMA, IOBX) local initiators per cluster |
---|
522 | // - 4 local targets (MEMC, XICU, MDMA, IOBX) per cluster |
---|
523 | ///////////////////////////////////////////////////////////////////// |
---|
524 | MappingTable maptab_int( vci_address_width, |
---|
525 | IntTab(x_width + y_width, 16 - x_width - y_width), |
---|
526 | IntTab(x_width + y_width, vci_srcid_width - x_width - y_width), |
---|
527 | 0x00FF000000); |
---|
528 | |
---|
529 | for (size_t x = 0; x < XMAX; x++) |
---|
530 | { |
---|
531 | for (size_t y = 0; y < YMAX; y++) |
---|
532 | { |
---|
533 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
534 | << (vci_address_width-x_width-y_width); |
---|
535 | bool config = true; |
---|
536 | bool cacheable = true; |
---|
537 | |
---|
538 | // the four following segments are defined in all clusters |
---|
539 | |
---|
540 | std::ostringstream smemc_conf; |
---|
541 | smemc_conf << "int_seg_memc_conf_" << x << "_" << y; |
---|
542 | maptab_int.add(Segment(smemc_conf.str(), MEMC_BASE+offset, MEMC_SIZE, |
---|
543 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), not cacheable, config )); |
---|
544 | |
---|
545 | std::ostringstream smemc_xram; |
---|
546 | smemc_xram << "int_seg_memc_xram_" << x << "_" << y; |
---|
547 | maptab_int.add(Segment(smemc_xram.str(), XRAM_BASE+offset, XRAM_SIZE, |
---|
548 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), cacheable)); |
---|
549 | |
---|
550 | std::ostringstream sxicu; |
---|
551 | sxicu << "int_seg_xicu_" << x << "_" << y; |
---|
552 | maptab_int.add(Segment(sxicu.str(), XICU_BASE+offset, XICU_SIZE, |
---|
553 | IntTab(cluster(x,y),INT_XICU_TGT_ID), not cacheable)); |
---|
554 | |
---|
555 | std::ostringstream smdma; |
---|
556 | smdma << "int_seg_mdma_" << x << "_" << y; |
---|
557 | maptab_int.add(Segment(smdma.str(), MDMA_BASE+offset, MDMA_SIZE, |
---|
558 | IntTab(cluster(x,y),INT_MDMA_TGT_ID), not cacheable)); |
---|
559 | |
---|
560 | // the following segments are only defined in cluster_iob0 or in cluster_iob1 |
---|
561 | |
---|
562 | if ( (cluster(x,y) == cluster_iob0) or (cluster(x,y) == cluster_iob1) ) |
---|
563 | { |
---|
564 | std::ostringstream siobx; |
---|
565 | siobx << "int_seg_iobx_" << x << "_" << y; |
---|
566 | maptab_int.add(Segment(siobx.str(), IOBX_BASE+offset, IOBX_SIZE, |
---|
567 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable, config )); |
---|
568 | |
---|
569 | std::ostringstream stty; |
---|
570 | stty << "int_seg_mtty_" << x << "_" << y; |
---|
571 | maptab_int.add(Segment(stty.str(), MTTY_BASE+offset, MTTY_SIZE, |
---|
572 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
573 | |
---|
574 | std::ostringstream sfbf; |
---|
575 | sfbf << "int_seg_fbuf_" << x << "_" << y; |
---|
576 | maptab_int.add(Segment(sfbf.str(), FBUF_BASE+offset, FBUF_SIZE, |
---|
577 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
578 | |
---|
579 | std::ostringstream sbdv; |
---|
580 | sbdv << "int_seg_bdev_" << x << "_" << y; |
---|
581 | maptab_int.add(Segment(sbdv.str(), BDEV_BASE+offset, BDEV_SIZE, |
---|
582 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
583 | |
---|
584 | std::ostringstream snic; |
---|
585 | snic << "int_seg_mnic_" << x << "_" << y; |
---|
586 | maptab_int.add(Segment(snic.str(), MNIC_BASE+offset, MNIC_SIZE, |
---|
587 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
588 | |
---|
589 | std::ostringstream srom; |
---|
590 | srom << "int_seg_brom_" << x << "_" << y; |
---|
591 | maptab_int.add(Segment(srom.str(), BROM_BASE+offset, BROM_SIZE, |
---|
592 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), cacheable )); |
---|
593 | |
---|
594 | std::ostringstream sdma; |
---|
595 | sdma << "int_seg_cdma_" << x << "_" << y; |
---|
596 | maptab_int.add(Segment(sdma.str(), CDMA_BASE+offset, CDMA_SIZE, |
---|
597 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
598 | } |
---|
599 | |
---|
600 | // This define the mapping between the SRCIDs |
---|
601 | // and the port index on the local interconnect. |
---|
602 | |
---|
603 | maptab_int.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
604 | IntTab( cluster(x,y), INT_MDMA_INI_ID ) ); |
---|
605 | |
---|
606 | maptab_int.srcid_map( IntTab( cluster(x,y), IOBX_LOCAL_SRCID ), |
---|
607 | IntTab( cluster(x,y), INT_IOBX_INI_ID ) ); |
---|
608 | |
---|
609 | for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ ) |
---|
610 | maptab_int.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+p ), |
---|
611 | IntTab( cluster(x,y), INT_PROC_INI_ID+p ) ); |
---|
612 | } |
---|
613 | } |
---|
614 | std::cout << "INT network " << maptab_int << std::endl; |
---|
615 | |
---|
616 | ///////////////////////////////////////////////////////////////////////// |
---|
617 | // RAM network mapping table |
---|
618 | // - two levels address decoding for commands |
---|
619 | // - two levels srcid decoding for responses |
---|
620 | // - 2 local initiators (MEMC, IOBX) per cluster |
---|
621 | // (IOBX component only in cluster_iob0 and cluster_iob1) |
---|
622 | // - 1 local target (XRAM) per cluster |
---|
623 | //////////////////////////////////////////////////////////////////////// |
---|
624 | MappingTable maptab_ram( vci_address_width, |
---|
625 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
626 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
627 | 0x00FF000000); |
---|
628 | |
---|
629 | for (size_t x = 0; x < XMAX; x++) |
---|
630 | { |
---|
631 | for (size_t y = 0; y < YMAX ; y++) |
---|
632 | { |
---|
633 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
634 | << (vci_address_width-x_width-y_width); |
---|
635 | |
---|
636 | std::ostringstream sxram; |
---|
637 | sxram << "ext_seg_xram_" << x << "_" << y; |
---|
638 | maptab_ram.add(Segment(sxram.str(), XRAM_BASE+offset, |
---|
639 | XRAM_SIZE, IntTab(cluster(x,y), 0), false)); |
---|
640 | } |
---|
641 | } |
---|
642 | |
---|
643 | // This define the mapping between the initiators SRCID |
---|
644 | // and the port index on the RAM local interconnect. |
---|
645 | // External initiator have two alias SRCID (iob0 / iob1) |
---|
646 | |
---|
647 | maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), |
---|
648 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); |
---|
649 | |
---|
650 | maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), |
---|
651 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); |
---|
652 | |
---|
653 | maptab_ram.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), |
---|
654 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); |
---|
655 | |
---|
656 | maptab_ram.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
657 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); |
---|
658 | |
---|
659 | maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ), |
---|
660 | IntTab( cluster_iob1, RAM_MEMC_INI_ID ) ); |
---|
661 | |
---|
662 | std::cout << "RAM network " << maptab_ram << std::endl; |
---|
663 | |
---|
664 | /////////////////////////////////////////////////////////////////////// |
---|
665 | // IOX network mapping table |
---|
666 | // - two levels address decoding for commands |
---|
667 | // - two levels srcid decoding for responses |
---|
668 | // - 4 initiators (IOB0, IOB1, BDEV, CDMA) |
---|
669 | // - 8 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, BROM, MNIC) |
---|
670 | /////////////////////////////////////////////////////////////////////// |
---|
671 | MappingTable maptab_iox( vci_address_width, |
---|
672 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
673 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
674 | 0x00FF000000); |
---|
675 | |
---|
676 | // compute base addresses for cluster_iob0 and cluster_iob1 |
---|
677 | uint64_t iob0_base = ((uint64_t)cluster_iob0) << (vci_address_width - x_width - y_width); |
---|
678 | uint64_t iob1_base = ((uint64_t)cluster_iob1) << (vci_address_width - x_width - y_width); |
---|
679 | |
---|
680 | // Each peripheral can be accessed through two segments, |
---|
681 | // depending on the used IOB (IOB0 or IOB1). |
---|
682 | maptab_iox.add(Segment("iox_seg_mtty_0", MTTY_BASE + iob0_base, MTTY_SIZE, |
---|
683 | IntTab(cluster_iob0,IOX_MTTY_TGT_ID), false)); |
---|
684 | maptab_iox.add(Segment("iox_seg_mtty_1", MTTY_BASE + iob1_base, MTTY_SIZE, |
---|
685 | IntTab(cluster_iob1,IOX_MTTY_TGT_ID), false)); |
---|
686 | |
---|
687 | maptab_iox.add(Segment("iox_seg_fbuf_0", FBUF_BASE + iob0_base, FBUF_SIZE, |
---|
688 | IntTab(cluster_iob0,IOX_FBUF_TGT_ID), false)); |
---|
689 | maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, FBUF_SIZE, |
---|
690 | IntTab(cluster_iob1,IOX_FBUF_TGT_ID), false)); |
---|
691 | |
---|
692 | maptab_iox.add(Segment("iox_seg_bdev_0", BDEV_BASE + iob0_base, BDEV_SIZE, |
---|
693 | IntTab(cluster_iob0,IOX_BDEV_TGT_ID), false)); |
---|
694 | maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, BDEV_SIZE, |
---|
695 | IntTab(cluster_iob1,IOX_BDEV_TGT_ID), false)); |
---|
696 | |
---|
697 | maptab_iox.add(Segment("iox_seg_mnic_0", MNIC_BASE + iob0_base, MNIC_SIZE, |
---|
698 | IntTab(cluster_iob0,IOX_MNIC_TGT_ID), false)); |
---|
699 | maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, MNIC_SIZE, |
---|
700 | IntTab(cluster_iob1,IOX_MNIC_TGT_ID), false)); |
---|
701 | |
---|
702 | maptab_iox.add(Segment("iox_seg_cdma_0", CDMA_BASE + iob0_base, CDMA_SIZE, |
---|
703 | IntTab(cluster_iob0,IOX_CDMA_TGT_ID), false)); |
---|
704 | maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, CDMA_SIZE, |
---|
705 | IntTab(cluster_iob1,IOX_CDMA_TGT_ID), false)); |
---|
706 | |
---|
707 | maptab_iox.add(Segment("iox_seg_brom_0", BROM_BASE + iob0_base, BROM_SIZE, |
---|
708 | IntTab(cluster_iob0,IOX_BROM_TGT_ID), false)); |
---|
709 | maptab_iox.add(Segment("iox_seg_brom_1", BROM_BASE + iob1_base, BROM_SIZE, |
---|
710 | IntTab(cluster_iob1,IOX_BROM_TGT_ID), false)); |
---|
711 | |
---|
712 | // Each physical RAM can be accessed through IOB0, or through IOB1. |
---|
713 | // if IOMMU is not activated, addresses are 40 bits (physical addresses), |
---|
714 | // and the choice depends on on address bit A[39]. |
---|
715 | // if IOMMU is activated the addresses use only 32 bits (virtual addresses), |
---|
716 | // and the choice depends on address bit A[31]. |
---|
717 | for (size_t x = 0; x < XMAX; x++) |
---|
718 | { |
---|
719 | for (size_t y = 0; y < YMAX ; y++) |
---|
720 | { |
---|
721 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
722 | << (vci_address_width-x_width-y_width); |
---|
723 | |
---|
724 | if ( x < (XMAX/2) ) // send command to XRAM through IOB0 |
---|
725 | { |
---|
726 | std::ostringstream siob0; |
---|
727 | siob0 << "iox_seg_xram_" << x << "_" << y; |
---|
728 | maptab_iox.add(Segment(siob0.str(), offset, 0x80000000, |
---|
729 | IntTab(cluster_iob0,IOX_IOB0_TGT_ID), false)); |
---|
730 | } |
---|
731 | else // send command to XRAM through IOB1 |
---|
732 | { |
---|
733 | std::ostringstream siob1; |
---|
734 | siob1 << "iox_seg_xram_" << x << "_" << y; |
---|
735 | maptab_iox.add(Segment(siob1.str(), offset, 0x80000000, |
---|
736 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
737 | } |
---|
738 | } |
---|
739 | } |
---|
740 | // useful when IOMMU activated |
---|
741 | maptab_iox.add(Segment("iox_seg_xram ", 0xc0000000, 0x40000000, |
---|
742 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
743 | |
---|
744 | // This define the mapping between the initiators (identified by the SRCID) |
---|
745 | // and the port index on the IOX local interconnect. |
---|
746 | // External initiator have two alias SRCID (iob0 / iob1 access) |
---|
747 | |
---|
748 | maptab_iox.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), |
---|
749 | IntTab( cluster_iob0, IOX_CDMA_INI_ID ) ); |
---|
750 | |
---|
751 | maptab_iox.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), |
---|
752 | IntTab( cluster_iob1, IOX_CDMA_INI_ID ) ); |
---|
753 | |
---|
754 | maptab_iox.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), |
---|
755 | IntTab( cluster_iob0, IOX_BDEV_INI_ID ) ); |
---|
756 | |
---|
757 | maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
758 | IntTab( cluster_iob0, IOX_BDEV_INI_ID ) ); |
---|
759 | |
---|
760 | for (size_t x = 0; x < XMAX; x++) |
---|
761 | { |
---|
762 | for (size_t y = 0; y < YMAX ; y++) |
---|
763 | { |
---|
764 | size_t iob = ( x < (XMAX/2) ) ? IOX_IOB0_INI_ID : IOX_IOB1_INI_ID; |
---|
765 | |
---|
766 | for (size_t p = 0 ; p < NB_PROCS_MAX ; p++) |
---|
767 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID + p ), |
---|
768 | IntTab( cluster(x,y), iob ) ); |
---|
769 | |
---|
770 | maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
771 | IntTab( cluster(x,y), IOX_IOB0_INI_ID ) ); |
---|
772 | } |
---|
773 | } |
---|
774 | |
---|
775 | std::cout << "IOX network " << maptab_iox << std::endl; |
---|
776 | |
---|
777 | //////////////////// |
---|
778 | // Signals |
---|
779 | /////////////////// |
---|
780 | |
---|
781 | sc_clock signal_clk("clk"); |
---|
782 | sc_signal<bool> signal_resetn("resetn"); |
---|
783 | |
---|
784 | sc_signal<bool> signal_irq_false; |
---|
785 | sc_signal<bool> signal_irq_bdev; |
---|
786 | sc_signal<bool> signal_irq_mnic_rx[NB_NIC_CHANNELS]; |
---|
787 | sc_signal<bool> signal_irq_mnic_tx[NB_NIC_CHANNELS]; |
---|
788 | sc_signal<bool> signal_irq_mtty[NB_TTY_CHANNELS]; |
---|
789 | sc_signal<bool> signal_irq_cdma[NB_NIC_CHANNELS*2]; |
---|
790 | |
---|
791 | // DSPIN signals for loopback in cluster_iob0 & cluster_iob1 |
---|
792 | DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob0_loopback; |
---|
793 | DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob0_loopback; |
---|
794 | DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob1_loopback; |
---|
795 | DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob1_loopback; |
---|
796 | |
---|
797 | // VCI signals for IOX network |
---|
798 | VciSignals<vci_param_ext> signal_vci_ini_iob0("signal_vci_ini_iob0"); |
---|
799 | VciSignals<vci_param_ext> signal_vci_ini_iob1("signal_vci_ini_iob1"); |
---|
800 | VciSignals<vci_param_ext> signal_vci_ini_bdev("signal_vci_ini_bdev"); |
---|
801 | VciSignals<vci_param_ext> signal_vci_ini_cdma("signal_vci_ini_cdma"); |
---|
802 | |
---|
803 | VciSignals<vci_param_ext> signal_vci_tgt_iob0("signal_vci_tgt_iob0"); |
---|
804 | VciSignals<vci_param_ext> signal_vci_tgt_iob1("signal_vci_tgt_iob1"); |
---|
805 | VciSignals<vci_param_ext> signal_vci_tgt_mtty("signal_vci_tgt_mtty"); |
---|
806 | VciSignals<vci_param_ext> signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); |
---|
807 | VciSignals<vci_param_ext> signal_vci_tgt_mnic("signal_vci_tgt_mnic"); |
---|
808 | VciSignals<vci_param_ext> signal_vci_tgt_brom("signal_vci_tgt_brom"); |
---|
809 | VciSignals<vci_param_ext> signal_vci_tgt_bdev("signal_vci_tgt_bdev"); |
---|
810 | VciSignals<vci_param_ext> signal_vci_tgt_cdma("signal_vci_tgt_cdma"); |
---|
811 | |
---|
812 | // Horizontal inter-clusters INT network DSPIN |
---|
813 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_inc = |
---|
814 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_inc", XMAX-1, YMAX, 3); |
---|
815 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_dec = |
---|
816 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_dec", XMAX-1, YMAX, 3); |
---|
817 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_inc = |
---|
818 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_inc", XMAX-1, YMAX, 2); |
---|
819 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_dec = |
---|
820 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_dec", XMAX-1, YMAX, 2); |
---|
821 | |
---|
822 | // Vertical inter-clusters INT network DSPIN |
---|
823 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_inc = |
---|
824 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_inc", XMAX, YMAX-1, 3); |
---|
825 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_dec = |
---|
826 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_dec", XMAX, YMAX-1, 3); |
---|
827 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_inc = |
---|
828 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_inc", XMAX, YMAX-1, 2); |
---|
829 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_dec = |
---|
830 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_dec", XMAX, YMAX-1, 2); |
---|
831 | |
---|
832 | // Mesh boundaries INT network DSPIN |
---|
833 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_in = |
---|
834 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_in", XMAX, YMAX, 4, 3); |
---|
835 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_out = |
---|
836 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_out", XMAX, YMAX, 4, 3); |
---|
837 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_in = |
---|
838 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_in", XMAX, YMAX, 4, 2); |
---|
839 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_out = |
---|
840 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_out", XMAX, YMAX, 4, 2); |
---|
841 | |
---|
842 | |
---|
843 | // Horizontal inter-clusters RAM network DSPIN |
---|
844 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_inc = |
---|
845 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_inc", XMAX-1, YMAX); |
---|
846 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_dec = |
---|
847 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_dec", XMAX-1, YMAX); |
---|
848 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_inc = |
---|
849 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_inc", XMAX-1, YMAX); |
---|
850 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_dec = |
---|
851 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_dec", XMAX-1, YMAX); |
---|
852 | |
---|
853 | // Vertical inter-clusters RAM network DSPIN |
---|
854 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_inc = |
---|
855 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_inc", XMAX, YMAX-1); |
---|
856 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_dec = |
---|
857 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_dec", XMAX, YMAX-1); |
---|
858 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_inc = |
---|
859 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_inc", XMAX, YMAX-1); |
---|
860 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_dec = |
---|
861 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_dec", XMAX, YMAX-1); |
---|
862 | |
---|
863 | // Mesh boundaries RAM network DSPIN |
---|
864 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_in = |
---|
865 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_in", XMAX, YMAX, 4); |
---|
866 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_out = |
---|
867 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_out", XMAX, YMAX, 4); |
---|
868 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_in = |
---|
869 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_in", XMAX, YMAX, 4); |
---|
870 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_out = |
---|
871 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_out", XMAX, YMAX, 4); |
---|
872 | |
---|
873 | //////////////////////////// |
---|
874 | // Loader |
---|
875 | //////////////////////////// |
---|
876 | |
---|
877 | #if USE_ALMOS |
---|
878 | soclib::common::Loader loader(almos_bootloader_pathname, |
---|
879 | almos_archinfo_pathname, |
---|
880 | almos_kernel_pathname); |
---|
881 | #else |
---|
882 | soclib::common::Loader loader(soft_name); |
---|
883 | #endif |
---|
884 | |
---|
885 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; |
---|
886 | proc_iss::set_loader(loader); |
---|
887 | |
---|
888 | //////////////////////////////////////// |
---|
889 | // Instanciated Hardware Components |
---|
890 | //////////////////////////////////////// |
---|
891 | |
---|
892 | std::cout << std::endl << "External Bus and Peripherals" << std::endl << std::endl; |
---|
893 | |
---|
894 | // IOX network |
---|
895 | VciIoxNetwork<vci_param_ext>* iox_network; |
---|
896 | iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network", |
---|
897 | maptab_iox, |
---|
898 | 8, // number of targets |
---|
899 | 4 ); // number of initiators |
---|
900 | // boot ROM |
---|
901 | VciSimpleRom<vci_param_ext>* brom; |
---|
902 | brom = new VciSimpleRom<vci_param_ext>( "brom", |
---|
903 | IntTab(0, IOX_BROM_TGT_ID), |
---|
904 | maptab_iox, |
---|
905 | loader ); |
---|
906 | // Network Controller |
---|
907 | VciMultiNic<vci_param_ext>* mnic; |
---|
908 | mnic = new VciMultiNic<vci_param_ext>( "mnic", |
---|
909 | IntTab(0, IOX_MNIC_TGT_ID), |
---|
910 | maptab_iox, |
---|
911 | NB_NIC_CHANNELS, |
---|
912 | nic_rx_name, |
---|
913 | nic_tx_name, |
---|
914 | 0, // mac_4 address |
---|
915 | 0 ); // mac_2 address |
---|
916 | |
---|
917 | // Frame Buffer |
---|
918 | VciFrameBuffer<vci_param_ext>* fbuf; |
---|
919 | fbuf = new VciFrameBuffer<vci_param_ext>( "fbuf", |
---|
920 | IntTab(0, IOX_FBUF_TGT_ID), |
---|
921 | maptab_iox, |
---|
922 | FBUF_X_SIZE, FBUF_Y_SIZE ); |
---|
923 | |
---|
924 | // Block Device |
---|
925 | // for AHCI |
---|
926 | // std::vector<std::string> filenames; |
---|
927 | // filenames.push_back(disk_name); // one single disk |
---|
928 | VciBlockDeviceTsar<vci_param_ext>* bdev; |
---|
929 | bdev = new VciBlockDeviceTsar<vci_param_ext>( "bdev", |
---|
930 | maptab_iox, |
---|
931 | IntTab(0, BDEV_LOCAL_SRCID), |
---|
932 | IntTab(0, IOX_BDEV_TGT_ID), |
---|
933 | disk_name, |
---|
934 | block_size, |
---|
935 | 64, // burst size (bytes) |
---|
936 | 0 ); // disk latency |
---|
937 | |
---|
938 | // Chained Buffer DMA controller |
---|
939 | VciChbufDma<vci_param_ext>* cdma; |
---|
940 | cdma = new VciChbufDma<vci_param_ext>( "cdma", |
---|
941 | maptab_iox, |
---|
942 | IntTab(0, CDMA_LOCAL_SRCID), |
---|
943 | IntTab(0, IOX_CDMA_TGT_ID), |
---|
944 | 64, // burst size (bytes) |
---|
945 | 2*NB_NIC_CHANNELS ); |
---|
946 | // Multi-TTY controller |
---|
947 | std::vector<std::string> vect_names; |
---|
948 | for( size_t tid = 0 ; tid < NB_TTY_CHANNELS ; tid++ ) |
---|
949 | { |
---|
950 | std::ostringstream term_name; |
---|
951 | term_name << "term" << tid; |
---|
952 | vect_names.push_back(term_name.str().c_str()); |
---|
953 | } |
---|
954 | VciMultiTty<vci_param_ext>* mtty; |
---|
955 | mtty = new VciMultiTty<vci_param_ext>( "mtty", |
---|
956 | IntTab(0, IOX_MTTY_TGT_ID), |
---|
957 | maptab_iox, |
---|
958 | vect_names); |
---|
959 | // Clusters |
---|
960 | TsarIobCluster<vci_param_int, |
---|
961 | vci_param_ext, |
---|
962 | dspin_int_cmd_width, |
---|
963 | dspin_int_rsp_width, |
---|
964 | dspin_ram_cmd_width, |
---|
965 | dspin_ram_rsp_width>* clusters[XMAX][YMAX]; |
---|
966 | |
---|
967 | #if USE_OPENMP |
---|
968 | #pragma omp parallel |
---|
969 | { |
---|
970 | #pragma omp for |
---|
971 | #endif |
---|
972 | for(size_t i = 0; i < (XMAX * YMAX); i++) |
---|
973 | { |
---|
974 | size_t x = i / YMAX; |
---|
975 | size_t y = i % YMAX; |
---|
976 | |
---|
977 | #if USE_OPENMP |
---|
978 | #pragma omp critical |
---|
979 | { |
---|
980 | #endif |
---|
981 | std::cout << std::endl; |
---|
982 | std::cout << "Cluster_" << std::dec << x << "_" << y << std::endl; |
---|
983 | std::cout << std::endl; |
---|
984 | |
---|
985 | std::ostringstream sc; |
---|
986 | sc << "cluster_" << x << "_" << y; |
---|
987 | clusters[x][y] = new TsarIobCluster<vci_param_int, |
---|
988 | vci_param_ext, |
---|
989 | dspin_int_cmd_width, |
---|
990 | dspin_int_rsp_width, |
---|
991 | dspin_ram_cmd_width, |
---|
992 | dspin_ram_rsp_width> |
---|
993 | ( |
---|
994 | sc.str().c_str(), |
---|
995 | NB_PROCS_MAX, |
---|
996 | NB_DMA_CHANNELS, |
---|
997 | x, |
---|
998 | y, |
---|
999 | XMAX, |
---|
1000 | YMAX, |
---|
1001 | |
---|
1002 | maptab_int, |
---|
1003 | maptab_ram, |
---|
1004 | maptab_iox, |
---|
1005 | |
---|
1006 | x_width, |
---|
1007 | y_width, |
---|
1008 | vci_srcid_width - x_width - y_width, // l_id width, |
---|
1009 | |
---|
1010 | INT_MEMC_TGT_ID, |
---|
1011 | INT_XICU_TGT_ID, |
---|
1012 | INT_MDMA_TGT_ID, |
---|
1013 | INT_IOBX_TGT_ID, |
---|
1014 | |
---|
1015 | INT_PROC_INI_ID, |
---|
1016 | INT_MDMA_INI_ID, |
---|
1017 | INT_IOBX_INI_ID, |
---|
1018 | |
---|
1019 | RAM_XRAM_TGT_ID, |
---|
1020 | |
---|
1021 | RAM_MEMC_INI_ID, |
---|
1022 | RAM_IOBX_INI_ID, |
---|
1023 | |
---|
1024 | MEMC_WAYS, |
---|
1025 | MEMC_SETS, |
---|
1026 | L1_IWAYS, |
---|
1027 | L1_ISETS, |
---|
1028 | L1_DWAYS, |
---|
1029 | L1_DSETS, |
---|
1030 | XRAM_LATENCY, |
---|
1031 | |
---|
1032 | loader, |
---|
1033 | |
---|
1034 | frozen_cycles, |
---|
1035 | debug_from, |
---|
1036 | debug_ok and (cluster(x,y) == debug_memc_id), |
---|
1037 | debug_ok and (cluster(x,y) == debug_proc_id), |
---|
1038 | debug_ok and debug_iob |
---|
1039 | ); |
---|
1040 | |
---|
1041 | #if USE_OPENMP |
---|
1042 | } // end critical |
---|
1043 | #endif |
---|
1044 | } // end for |
---|
1045 | #if USE_OPENMP |
---|
1046 | } |
---|
1047 | #endif |
---|
1048 | |
---|
1049 | std::cout << std::endl; |
---|
1050 | |
---|
1051 | /////////////////////////////////////////////////////////////////////////////// |
---|
1052 | // Net-list |
---|
1053 | /////////////////////////////////////////////////////////////////////////////// |
---|
1054 | |
---|
1055 | // IOX network connexion |
---|
1056 | iox_network->p_clk (signal_clk); |
---|
1057 | iox_network->p_resetn (signal_resetn); |
---|
1058 | iox_network->p_to_ini[IOX_IOB0_INI_ID] (signal_vci_ini_iob0); |
---|
1059 | iox_network->p_to_ini[IOX_IOB1_INI_ID] (signal_vci_ini_iob1); |
---|
1060 | iox_network->p_to_ini[IOX_BDEV_INI_ID] (signal_vci_ini_bdev); |
---|
1061 | iox_network->p_to_ini[IOX_CDMA_INI_ID] (signal_vci_ini_cdma); |
---|
1062 | iox_network->p_to_tgt[IOX_IOB0_TGT_ID] (signal_vci_tgt_iob0); |
---|
1063 | iox_network->p_to_tgt[IOX_IOB1_TGT_ID] (signal_vci_tgt_iob1); |
---|
1064 | iox_network->p_to_tgt[IOX_MTTY_TGT_ID] (signal_vci_tgt_mtty); |
---|
1065 | iox_network->p_to_tgt[IOX_FBUF_TGT_ID] (signal_vci_tgt_fbuf); |
---|
1066 | iox_network->p_to_tgt[IOX_MNIC_TGT_ID] (signal_vci_tgt_mnic); |
---|
1067 | iox_network->p_to_tgt[IOX_BROM_TGT_ID] (signal_vci_tgt_brom); |
---|
1068 | iox_network->p_to_tgt[IOX_BDEV_TGT_ID] (signal_vci_tgt_bdev); |
---|
1069 | iox_network->p_to_tgt[IOX_CDMA_TGT_ID] (signal_vci_tgt_cdma); |
---|
1070 | |
---|
1071 | // BDEV connexion |
---|
1072 | bdev->p_clk (signal_clk); |
---|
1073 | bdev->p_resetn (signal_resetn); |
---|
1074 | bdev->p_irq (signal_irq_bdev); |
---|
1075 | |
---|
1076 | // For AHCI |
---|
1077 | // bdev->p_channel_irq[0] (signal_irq_bdev); |
---|
1078 | |
---|
1079 | bdev->p_vci_target (signal_vci_tgt_bdev); |
---|
1080 | bdev->p_vci_initiator (signal_vci_ini_bdev); |
---|
1081 | |
---|
1082 | std::cout << " - BDEV connected" << std::endl; |
---|
1083 | |
---|
1084 | // FBUF connexion |
---|
1085 | fbuf->p_clk (signal_clk); |
---|
1086 | fbuf->p_resetn (signal_resetn); |
---|
1087 | fbuf->p_vci (signal_vci_tgt_fbuf); |
---|
1088 | |
---|
1089 | std::cout << " - FBUF connected" << std::endl; |
---|
1090 | |
---|
1091 | // MNIC connexion |
---|
1092 | mnic->p_clk (signal_clk); |
---|
1093 | mnic->p_resetn (signal_resetn); |
---|
1094 | mnic->p_vci (signal_vci_tgt_mnic); |
---|
1095 | for ( size_t i=0 ; i<NB_NIC_CHANNELS ; i++ ) |
---|
1096 | { |
---|
1097 | mnic->p_rx_irq[i] (signal_irq_mnic_rx[i]); |
---|
1098 | mnic->p_tx_irq[i] (signal_irq_mnic_tx[i]); |
---|
1099 | } |
---|
1100 | |
---|
1101 | std::cout << " - MNIC connected" << std::endl; |
---|
1102 | |
---|
1103 | // BROM connexion |
---|
1104 | brom->p_clk (signal_clk); |
---|
1105 | brom->p_resetn (signal_resetn); |
---|
1106 | brom->p_vci (signal_vci_tgt_brom); |
---|
1107 | |
---|
1108 | std::cout << " - BROM connected" << std::endl; |
---|
1109 | |
---|
1110 | // MTTY connexion |
---|
1111 | mtty->p_clk (signal_clk); |
---|
1112 | mtty->p_resetn (signal_resetn); |
---|
1113 | mtty->p_vci (signal_vci_tgt_mtty); |
---|
1114 | for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ ) |
---|
1115 | { |
---|
1116 | mtty->p_irq[i] (signal_irq_mtty[i]); |
---|
1117 | } |
---|
1118 | |
---|
1119 | std::cout << " - MTTY connected" << std::endl; |
---|
1120 | |
---|
1121 | // CDMA connexion |
---|
1122 | cdma->p_clk (signal_clk); |
---|
1123 | cdma->p_resetn (signal_resetn); |
---|
1124 | cdma->p_vci_target (signal_vci_tgt_cdma); |
---|
1125 | cdma->p_vci_initiator (signal_vci_ini_cdma); |
---|
1126 | for ( size_t i=0 ; i<(NB_NIC_CHANNELS*2) ; i++) |
---|
1127 | { |
---|
1128 | cdma->p_irq[i] (signal_irq_cdma[i]); |
---|
1129 | } |
---|
1130 | |
---|
1131 | std::cout << " - CDMA connected" << std::endl; |
---|
1132 | |
---|
1133 | // IRQ connexions from external peripherals (cluster_iob0 only) |
---|
1134 | // IRQ_MNIC_RX -> IRQ[08] to IRQ[09] |
---|
1135 | // IRQ_MNIC_TX -> IRQ[10] to IRQ[11] |
---|
1136 | // IRQ_CDMA -> IRQ[12] to IRQ[15] |
---|
1137 | // IRQ_MTTY -> IRQ[16] to IRQ[30] |
---|
1138 | // IRQ_BDEV -> IRQ[31] |
---|
1139 | |
---|
1140 | size_t mx = 16 + NB_TTY_CHANNELS; |
---|
1141 | for ( size_t n=0 ; n<32 ; n++ ) |
---|
1142 | { |
---|
1143 | if ( n < 8 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); |
---|
1144 | |
---|
1145 | else if ( n < 10 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); |
---|
1146 | // else if ( n < 10 ) (*clusters[0][0]->p_irq[n]) (signal_irq_mnic_rx[n-8]); |
---|
1147 | |
---|
1148 | else if ( n < 12 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); |
---|
1149 | // else if ( n < 12 ) (*clusters[0][0]->p_irq[n]) (signal_irq_mnic_tx[n-10]); |
---|
1150 | |
---|
1151 | else if ( n < 16 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); |
---|
1152 | // else if ( n < 16 ) (*clusters[0][0]->p_irq[n]) (signal_irq_cdma[n-12]); |
---|
1153 | |
---|
1154 | else if ( n < mx ) (*clusters[0][0]->p_irq[n]) (signal_irq_mtty[n-16]); |
---|
1155 | else if ( n < 31 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); |
---|
1156 | |
---|
1157 | else (*clusters[0][0]->p_irq[n]) (signal_irq_bdev); |
---|
1158 | } |
---|
1159 | |
---|
1160 | // IOB0 cluster connexion to IOX network |
---|
1161 | (*clusters[0][0]->p_vci_iob_iox_ini) (signal_vci_ini_iob0); |
---|
1162 | (*clusters[0][0]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob0); |
---|
1163 | |
---|
1164 | // IOB1 cluster connexion to IOX network |
---|
1165 | (*clusters[XMAX-1][YMAX-1]->p_vci_iob_iox_ini) (signal_vci_ini_iob1); |
---|
1166 | (*clusters[XMAX-1][YMAX-1]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob1); |
---|
1167 | |
---|
1168 | // All clusters Clock & RESET connexions |
---|
1169 | for ( size_t x = 0; x < (XMAX); x++ ) |
---|
1170 | { |
---|
1171 | for (size_t y = 0; y < YMAX; y++) |
---|
1172 | { |
---|
1173 | clusters[x][y]->p_clk (signal_clk); |
---|
1174 | clusters[x][y]->p_resetn (signal_resetn); |
---|
1175 | } |
---|
1176 | } |
---|
1177 | |
---|
1178 | // Inter Clusters horizontal connections |
---|
1179 | if (XMAX > 1) |
---|
1180 | { |
---|
1181 | for (size_t x = 0; x < (XMAX-1); x++) |
---|
1182 | { |
---|
1183 | for (size_t y = 0; y < YMAX; y++) |
---|
1184 | { |
---|
1185 | for (size_t k = 0; k < 3; k++) |
---|
1186 | { |
---|
1187 | clusters[x][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
1188 | clusters[x+1][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
1189 | clusters[x][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
1190 | clusters[x+1][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
1191 | } |
---|
1192 | |
---|
1193 | for (size_t k = 0; k < 2; k++) |
---|
1194 | { |
---|
1195 | clusters[x][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
1196 | clusters[x+1][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
1197 | clusters[x][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
1198 | clusters[x+1][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
1199 | } |
---|
1200 | |
---|
1201 | clusters[x][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
1202 | clusters[x+1][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
1203 | clusters[x][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
1204 | clusters[x+1][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
1205 | clusters[x][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
1206 | clusters[x+1][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
1207 | clusters[x][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
1208 | clusters[x+1][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
1209 | } |
---|
1210 | } |
---|
1211 | } |
---|
1212 | |
---|
1213 | std::cout << std::endl << "Horizontal connections established" << std::endl; |
---|
1214 | |
---|
1215 | // Inter Clusters vertical connections |
---|
1216 | if (YMAX > 1) |
---|
1217 | { |
---|
1218 | for (size_t y = 0; y < (YMAX-1); y++) |
---|
1219 | { |
---|
1220 | for (size_t x = 0; x < XMAX; x++) |
---|
1221 | { |
---|
1222 | for (size_t k = 0; k < 3; k++) |
---|
1223 | { |
---|
1224 | clusters[x][y]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
1225 | clusters[x][y+1]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
1226 | clusters[x][y]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
1227 | clusters[x][y+1]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
1228 | } |
---|
1229 | |
---|
1230 | for (size_t k = 0; k < 2; k++) |
---|
1231 | { |
---|
1232 | clusters[x][y]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
1233 | clusters[x][y+1]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
1234 | clusters[x][y]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
1235 | clusters[x][y+1]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
1236 | } |
---|
1237 | |
---|
1238 | clusters[x][y]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
1239 | clusters[x][y+1]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
1240 | clusters[x][y]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
1241 | clusters[x][y+1]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
1242 | clusters[x][y]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
1243 | clusters[x][y+1]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
1244 | clusters[x][y]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
1245 | clusters[x][y+1]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
1246 | } |
---|
1247 | } |
---|
1248 | } |
---|
1249 | |
---|
1250 | std::cout << "Vertical connections established" << std::endl; |
---|
1251 | |
---|
1252 | // East & West boundary cluster connections |
---|
1253 | for (size_t y = 0; y < YMAX; y++) |
---|
1254 | { |
---|
1255 | for (size_t k = 0; k < 3; k++) |
---|
1256 | { |
---|
1257 | clusters[0][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_false_int_cmd_in[0][y][WEST][k]); |
---|
1258 | clusters[0][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_false_int_cmd_out[0][y][WEST][k]); |
---|
1259 | clusters[XMAX-1][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_false_int_cmd_in[XMAX-1][y][EAST][k]); |
---|
1260 | clusters[XMAX-1][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_false_int_cmd_out[XMAX-1][y][EAST][k]); |
---|
1261 | } |
---|
1262 | |
---|
1263 | for (size_t k = 0; k < 2; k++) |
---|
1264 | { |
---|
1265 | clusters[0][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_false_int_rsp_in[0][y][WEST][k]); |
---|
1266 | clusters[0][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_false_int_rsp_out[0][y][WEST][k]); |
---|
1267 | clusters[XMAX-1][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_false_int_rsp_in[XMAX-1][y][EAST][k]); |
---|
1268 | clusters[XMAX-1][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_false_int_rsp_out[XMAX-1][y][EAST][k]); |
---|
1269 | } |
---|
1270 | |
---|
1271 | if( y == 0 ) // handling IOB to RAM network connection in cluster_iob0 |
---|
1272 | { |
---|
1273 | (*clusters[0][0]->p_dspin_iob_cmd_out) (signal_dspin_cmd_iob0_loopback); |
---|
1274 | clusters[0][0]->p_dspin_ram_cmd_in[WEST] (signal_dspin_cmd_iob0_loopback); |
---|
1275 | |
---|
1276 | clusters[0][0]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][0][WEST]); |
---|
1277 | clusters[0][0]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][0][WEST]); |
---|
1278 | |
---|
1279 | clusters[0][0]->p_dspin_ram_rsp_out[WEST] (signal_dspin_rsp_iob0_loopback); |
---|
1280 | (*clusters[0][0]->p_dspin_iob_rsp_in) (signal_dspin_rsp_iob0_loopback); |
---|
1281 | |
---|
1282 | } |
---|
1283 | else |
---|
1284 | { |
---|
1285 | clusters[0][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_false_ram_cmd_in[0][y][WEST]); |
---|
1286 | clusters[0][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][y][WEST]); |
---|
1287 | clusters[0][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][y][WEST]); |
---|
1288 | clusters[0][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_false_ram_rsp_out[0][y][WEST]); |
---|
1289 | } |
---|
1290 | |
---|
1291 | if( y == YMAX-1 ) // handling IOB to RAM network connection in cluster_iob1 |
---|
1292 | { |
---|
1293 | (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_cmd_out) (signal_dspin_cmd_iob1_loopback); |
---|
1294 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_in[EAST] (signal_dspin_cmd_iob1_loopback); |
---|
1295 | |
---|
1296 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][YMAX-1][EAST]); |
---|
1297 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][YMAX-1][EAST]); |
---|
1298 | |
---|
1299 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_out[EAST] (signal_dspin_rsp_iob1_loopback); |
---|
1300 | (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_rsp_in) (signal_dspin_rsp_iob1_loopback); |
---|
1301 | } |
---|
1302 | else |
---|
1303 | { |
---|
1304 | clusters[XMAX-1][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_false_ram_cmd_in[XMAX-1][y][EAST]); |
---|
1305 | clusters[XMAX-1][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][y][EAST]); |
---|
1306 | clusters[XMAX-1][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][y][EAST]); |
---|
1307 | clusters[XMAX-1][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_false_ram_rsp_out[XMAX-1][y][EAST]); |
---|
1308 | } |
---|
1309 | } |
---|
1310 | |
---|
1311 | std::cout << "East & West boundaries established" << std::endl; |
---|
1312 | |
---|
1313 | // North & South boundary clusters connections |
---|
1314 | for (size_t x = 0; x < XMAX; x++) |
---|
1315 | { |
---|
1316 | for (size_t k = 0; k < 3; k++) |
---|
1317 | { |
---|
1318 | clusters[x][0]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_false_int_cmd_in[x][0][SOUTH][k]); |
---|
1319 | clusters[x][0]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_false_int_cmd_out[x][0][SOUTH][k]); |
---|
1320 | clusters[x][YMAX-1]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_false_int_cmd_in[x][YMAX-1][NORTH][k]); |
---|
1321 | clusters[x][YMAX-1]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_false_int_cmd_out[x][YMAX-1][NORTH][k]); |
---|
1322 | } |
---|
1323 | |
---|
1324 | for (size_t k = 0; k < 2; k++) |
---|
1325 | { |
---|
1326 | clusters[x][0]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_false_int_rsp_in[x][0][SOUTH][k]); |
---|
1327 | clusters[x][0]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_false_int_rsp_out[x][0][SOUTH][k]); |
---|
1328 | clusters[x][YMAX-1]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_false_int_rsp_in[x][YMAX-1][NORTH][k]); |
---|
1329 | clusters[x][YMAX-1]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_false_int_rsp_out[x][YMAX-1][NORTH][k]); |
---|
1330 | } |
---|
1331 | |
---|
1332 | clusters[x][0]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_false_ram_cmd_in[x][0][SOUTH]); |
---|
1333 | clusters[x][0]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_false_ram_cmd_out[x][0][SOUTH]); |
---|
1334 | clusters[x][0]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_false_ram_rsp_in[x][0][SOUTH]); |
---|
1335 | clusters[x][0]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_false_ram_rsp_out[x][0][SOUTH]); |
---|
1336 | |
---|
1337 | clusters[x][YMAX-1]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_false_ram_cmd_in[x][YMAX-1][NORTH]); |
---|
1338 | clusters[x][YMAX-1]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_false_ram_cmd_out[x][YMAX-1][NORTH]); |
---|
1339 | clusters[x][YMAX-1]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_false_ram_rsp_in[x][YMAX-1][NORTH]); |
---|
1340 | clusters[x][YMAX-1]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_false_ram_rsp_out[x][YMAX-1][NORTH]); |
---|
1341 | } |
---|
1342 | |
---|
1343 | std::cout << "North & South boundaries established" << std::endl << std::endl; |
---|
1344 | |
---|
1345 | //////////////////////////////////////////////////////// |
---|
1346 | // Simulation |
---|
1347 | /////////////////////////////////////////////////////// |
---|
1348 | |
---|
1349 | sc_start(sc_core::sc_time(0, SC_NS)); |
---|
1350 | |
---|
1351 | signal_resetn = false; |
---|
1352 | |
---|
1353 | signal_irq_false = false; |
---|
1354 | |
---|
1355 | // network boundaries signals |
---|
1356 | for (size_t x = 0; x < XMAX ; x++) |
---|
1357 | { |
---|
1358 | for (size_t y = 0; y < YMAX ; y++) |
---|
1359 | { |
---|
1360 | for (size_t a = 0; a < 4; a++) |
---|
1361 | { |
---|
1362 | for (size_t k = 0; k < 3; k++) |
---|
1363 | { |
---|
1364 | signal_dspin_false_int_cmd_in[x][y][a][k].write = false; |
---|
1365 | signal_dspin_false_int_cmd_in[x][y][a][k].read = true; |
---|
1366 | signal_dspin_false_int_cmd_out[x][y][a][k].write = false; |
---|
1367 | signal_dspin_false_int_cmd_out[x][y][a][k].read = true; |
---|
1368 | } |
---|
1369 | |
---|
1370 | for (size_t k = 0; k < 2; k++) |
---|
1371 | { |
---|
1372 | signal_dspin_false_int_rsp_in[x][y][a][k].write = false; |
---|
1373 | signal_dspin_false_int_rsp_in[x][y][a][k].read = true; |
---|
1374 | signal_dspin_false_int_rsp_out[x][y][a][k].write = false; |
---|
1375 | signal_dspin_false_int_rsp_out[x][y][a][k].read = true; |
---|
1376 | } |
---|
1377 | |
---|
1378 | signal_dspin_false_ram_cmd_in[x][y][a].write = false; |
---|
1379 | signal_dspin_false_ram_cmd_in[x][y][a].read = true; |
---|
1380 | signal_dspin_false_ram_cmd_out[x][y][a].write = false; |
---|
1381 | signal_dspin_false_ram_cmd_out[x][y][a].read = true; |
---|
1382 | |
---|
1383 | signal_dspin_false_ram_rsp_in[x][y][a].write = false; |
---|
1384 | signal_dspin_false_ram_rsp_in[x][y][a].read = true; |
---|
1385 | signal_dspin_false_ram_rsp_out[x][y][a].write = false; |
---|
1386 | signal_dspin_false_ram_rsp_out[x][y][a].read = true; |
---|
1387 | } |
---|
1388 | } |
---|
1389 | } |
---|
1390 | |
---|
1391 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
1392 | signal_resetn = true; |
---|
1393 | |
---|
1394 | for (size_t n = 1; n < ncycles; n++) |
---|
1395 | { |
---|
1396 | // Monitor a specific address for L1 and/or L2 caches |
---|
1397 | // clusters[1][1]->proc[0]->cache_monitor(0x50090ULL); |
---|
1398 | // clusters[0][0]->memc->cache_monitor( 0x50090ULL); |
---|
1399 | |
---|
1400 | if (debug_ok and (n > debug_from) and (n % debug_period == 0)) |
---|
1401 | { |
---|
1402 | std::cout << "****************** cycle " << std::dec << n ; |
---|
1403 | std::cout << " ************************************************" << std::endl; |
---|
1404 | |
---|
1405 | |
---|
1406 | // trace proc[debug_proc_id] ... or several procs |
---|
1407 | // for( debug_proc_id = 0 ; debug_proc_id < 2 ; debug_proc_id++ ) |
---|
1408 | |
---|
1409 | if ( debug_proc_id < XMAX*YMAX*NB_PROCS_MAX ) |
---|
1410 | { |
---|
1411 | size_t l = debug_proc_id % NB_PROCS_MAX ; |
---|
1412 | size_t y = (debug_proc_id / NB_PROCS_MAX) % YMAX ; |
---|
1413 | size_t x = debug_proc_id / (YMAX * NB_PROCS_MAX) ; |
---|
1414 | |
---|
1415 | clusters[x][y]->proc[l]->print_trace(1); |
---|
1416 | |
---|
1417 | std::ostringstream proc_signame; |
---|
1418 | proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; |
---|
1419 | clusters[x][y]->signal_int_vci_ini_proc[l].print_trace(proc_signame.str()); |
---|
1420 | |
---|
1421 | clusters[x][y]->xicu->print_trace(l); |
---|
1422 | |
---|
1423 | std::ostringstream xicu_signame; |
---|
1424 | xicu_signame << "[SIG]XICU_" << x << "_" << y; |
---|
1425 | clusters[x][y]->signal_int_vci_tgt_xicu.print_trace(xicu_signame.str()); |
---|
1426 | |
---|
1427 | if( clusters[x][y]->signal_proc_it[0].read() ) |
---|
1428 | std::cout << "### IRQ_PROC_" << std::dec |
---|
1429 | << x << "_" << y << " ACTIVE" << std::endl; |
---|
1430 | |
---|
1431 | // std::ostringstream p2m_signame; |
---|
1432 | // p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " P2M" ; |
---|
1433 | // clusters[x][y]->signal_int_dspin_p2m_proc[l].print_trace(p2m_signame.str()); |
---|
1434 | |
---|
1435 | // std::ostringstream m2p_signame; |
---|
1436 | // m2p_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " M2P" ; |
---|
1437 | // clusters[x][y]->signal_int_dspin_m2p_proc[l].print_trace(m2p_signame.str()); |
---|
1438 | |
---|
1439 | // std::ostringstream p_cmd_signame; |
---|
1440 | // p_cmd_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " CMD" ; |
---|
1441 | // clusters[x][y]->signal_int_dspin_cmd_proc_i[l].print_trace(p_cmd_signame.str()); |
---|
1442 | |
---|
1443 | // std::ostringstream p_rsp_signame; |
---|
1444 | // p_rsp_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " RSP" ; |
---|
1445 | // clusters[x][y]->signal_int_dspin_rsp_proc_i[l].print_trace(p_rsp_signame.str()); |
---|
1446 | |
---|
1447 | } |
---|
1448 | |
---|
1449 | // trace INT_CMD_D xbar and router in 1_0 |
---|
1450 | // clusters[1][0]->int_xbar_cmd_d->print_trace(); |
---|
1451 | // clusters[1][0]->int_xbar_rsp_d->print_trace(); |
---|
1452 | |
---|
1453 | // clusters[1][0]->signal_int_dspin_cmd_l2g_d.print_trace("[SIG] INT_CMD_L2G_D_1_0"); |
---|
1454 | // clusters[1][0]->signal_int_dspin_rsp_g2l_d.print_trace("[SIG] INT_RSP_G2L_D_1_0"); |
---|
1455 | |
---|
1456 | // clusters[1][0]->int_router_cmd->print_trace(0); |
---|
1457 | // clusters[1][0]->int_router_rsp->print_trace(0); |
---|
1458 | |
---|
1459 | // trace INT_CMD_D xbar and router in 0_0 |
---|
1460 | // clusters[0][0]->int_xbar_cmd_d->print_trace(); |
---|
1461 | // clusters[0][0]->int_xbar_rsp_d->print_trace(); |
---|
1462 | |
---|
1463 | // clusters[0][0]->signal_int_dspin_cmd_g2l_d.print_trace("[SIG] INT_CMD_G2L_D_0_0"); |
---|
1464 | // clusters[0][0]->signal_int_dspin_rsp_l2g_d.print_trace("[SIG] INT_RSP_L2G_D_0_0"); |
---|
1465 | |
---|
1466 | // clusters[0][0]->int_router_cmd->print_trace(0); |
---|
1467 | // clusters[0][0]->int_router_rsp->print_trace(0); |
---|
1468 | |
---|
1469 | // trace memc[debug_memc_id] and xram[debug_memc_id] |
---|
1470 | if ( debug_memc_id < XMAX*YMAX ) |
---|
1471 | { |
---|
1472 | size_t x = debug_memc_id / YMAX; |
---|
1473 | size_t y = debug_memc_id % YMAX; |
---|
1474 | clusters[x][y]->memc->print_trace(0); |
---|
1475 | std::ostringstream smemc_tgt; |
---|
1476 | smemc_tgt << "[SIG]MEMC_TGT_" << x << "_" << y; |
---|
1477 | clusters[x][y]->signal_int_vci_tgt_memc.print_trace(smemc_tgt.str()); |
---|
1478 | std::ostringstream smemc_ini; |
---|
1479 | smemc_ini << "[SIG]MEMC_INI_" << x << "_" << y; |
---|
1480 | clusters[x][y]->signal_ram_vci_ini_memc.print_trace(smemc_ini.str()); |
---|
1481 | clusters[x][y]->xram->print_trace(); |
---|
1482 | std::ostringstream sxram_tgt; |
---|
1483 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; |
---|
1484 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); |
---|
1485 | } |
---|
1486 | |
---|
1487 | // trace RAM network routers |
---|
1488 | // for( size_t cluster = 0 ; cluster < XMAX*YMAX ; cluster++ ) |
---|
1489 | // { |
---|
1490 | // size_t x = cluster / YMAX; |
---|
1491 | // size_t y = cluster % YMAX; |
---|
1492 | // clusters[x][y]->ram_router_cmd->print_trace(); |
---|
1493 | // clusters[x][y]->ram_router_rsp->print_trace(); |
---|
1494 | // } |
---|
1495 | |
---|
1496 | // trace iob, iox and external peripherals |
---|
1497 | if ( debug_iob ) |
---|
1498 | { |
---|
1499 | clusters[0][0]->iob->print_trace(); |
---|
1500 | clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT"); |
---|
1501 | clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI"); |
---|
1502 | clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( "[SIG]IOB0_RAM_INI"); |
---|
1503 | |
---|
1504 | signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI"); |
---|
1505 | signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT"); |
---|
1506 | |
---|
1507 | // signal_dspin_cmd_iob0_loopback.print_trace("[SIG]IOB0_CMD_LOOPBACK"); |
---|
1508 | // signal_dspin_rsp_iob0_loopback.print_trace("[SIG]IOB0_RSP_LOOPBACK"); |
---|
1509 | |
---|
1510 | // cdma->print_trace(); |
---|
1511 | // signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT"); |
---|
1512 | // signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI"); |
---|
1513 | |
---|
1514 | brom->print_trace(); |
---|
1515 | signal_vci_tgt_brom.print_trace("[SIG]IOX_BROM_TGT"); |
---|
1516 | |
---|
1517 | // mtty->print_trace(); |
---|
1518 | // signal_vci_tgt_mtty.print_trace("[SIG]IOX_MTTY_TGT"); |
---|
1519 | |
---|
1520 | bdev->print_trace(); |
---|
1521 | signal_vci_tgt_bdev.print_trace("[SIG]IOX_BDEV_TGT"); |
---|
1522 | signal_vci_ini_bdev.print_trace("[SIG]IOX_BDEV_INI"); |
---|
1523 | |
---|
1524 | // fbuf->print_trace(); |
---|
1525 | // signal_vci_tgt_fbuf.print_trace("[SIG]FBUF"); |
---|
1526 | |
---|
1527 | iox_network->print_trace(); |
---|
1528 | |
---|
1529 | // interrupts |
---|
1530 | if (signal_irq_bdev) std::cout << "### IRQ_BDEV ACTIVATED" << std::endl; |
---|
1531 | } |
---|
1532 | } |
---|
1533 | |
---|
1534 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
1535 | } |
---|
1536 | return EXIT_SUCCESS; |
---|
1537 | } |
---|
1538 | |
---|
1539 | int sc_main (int argc, char *argv[]) |
---|
1540 | { |
---|
1541 | try { |
---|
1542 | return _main(argc, argv); |
---|
1543 | } catch (std::exception &e) { |
---|
1544 | std::cout << e.what() << std::endl; |
---|
1545 | } catch (...) { |
---|
1546 | std::cout << "Unknown exception occured" << std::endl; |
---|
1547 | throw; |
---|
1548 | } |
---|
1549 | return 1; |
---|
1550 | } |
---|
1551 | |
---|
1552 | |
---|
1553 | // Local Variables: |
---|
1554 | // tab-width: 3 |
---|
1555 | // c-basic-offset: 3 |
---|
1556 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
1557 | // indent-tabs-mode: nil |
---|
1558 | // End: |
---|
1559 | |
---|
1560 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 |
---|
1561 | |
---|
1562 | |
---|
1563 | |
---|