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