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 (up to 16) |
---|
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 | size_t x = debug_memc_id >> 4; |
---|
418 | size_t y = debug_memc_id & 0xF; |
---|
419 | if( (x>=XMAX) || (y>=YMAX) ) |
---|
420 | { |
---|
421 | std::cout << "MEMCID parameter does'nt fit XMAX/YMAX" << std::endl; |
---|
422 | exit(0); |
---|
423 | } |
---|
424 | } |
---|
425 | else if ((strcmp(argv[n],"-XRAMID") == 0) && (n+1<argc) ) |
---|
426 | { |
---|
427 | debug_xram_id = atoi(argv[n+1]); |
---|
428 | size_t x = debug_xram_id >> 4; |
---|
429 | size_t y = debug_xram_id & 0xF; |
---|
430 | if( (x>=XMAX) || (y>=YMAX) ) |
---|
431 | { |
---|
432 | std::cout << "XRAMID parameter does'nt fit XMAX/YMAX" << std::endl; |
---|
433 | exit(0); |
---|
434 | } |
---|
435 | } |
---|
436 | else if ((strcmp(argv[n],"-IOB") == 0) && (n+1<argc) ) |
---|
437 | { |
---|
438 | debug_iob = atoi(argv[n+1]); |
---|
439 | } |
---|
440 | else if ((strcmp(argv[n],"-PROCID") == 0) && (n+1<argc) ) |
---|
441 | { |
---|
442 | debug_proc_id = atoi(argv[n+1]); |
---|
443 | size_t cluster_xy = debug_proc_id / NB_PROCS_MAX ; |
---|
444 | size_t x = cluster_xy >> 4; |
---|
445 | size_t y = cluster_xy & 0xF; |
---|
446 | if( (x>=XMAX) || (y>=YMAX) ) |
---|
447 | { |
---|
448 | std::cout << "PROCID parameter does'nt fit XMAX/YMAX" << std::endl; |
---|
449 | exit(0); |
---|
450 | } |
---|
451 | } |
---|
452 | else if ((strcmp(argv[n], "-THREADS") == 0) && ((n+1) < argc)) |
---|
453 | { |
---|
454 | threads_nr = atoi(argv[n+1]); |
---|
455 | threads_nr = (threads_nr < 1) ? 1 : threads_nr; |
---|
456 | } |
---|
457 | else if ((strcmp(argv[n], "-FROZEN") == 0) && (n+1 < argc)) |
---|
458 | { |
---|
459 | frozen_cycles = atoi(argv[n+1]); |
---|
460 | } |
---|
461 | else if ((strcmp(argv[n], "-PERIOD") == 0) && (n+1 < argc)) |
---|
462 | { |
---|
463 | debug_period = atoi(argv[n+1]); |
---|
464 | } |
---|
465 | else |
---|
466 | { |
---|
467 | std::cout << " Arguments are (key,value) couples." << std::endl; |
---|
468 | std::cout << " The order is not important." << std::endl; |
---|
469 | std::cout << " Accepted arguments are :" << std::endl << std::endl; |
---|
470 | std::cout << " -SOFT pathname_for_embedded_soft" << std::endl; |
---|
471 | std::cout << " -DISK pathname_for_disk_image" << std::endl; |
---|
472 | std::cout << " -NCYCLES number_of_simulated_cycles" << std::endl; |
---|
473 | std::cout << " -DEBUG debug_start_cycle" << std::endl; |
---|
474 | std::cout << " -THREADS simulator's threads number" << std::endl; |
---|
475 | std::cout << " -FROZEN max_number_of_lines" << std::endl; |
---|
476 | std::cout << " -PERIOD number_of_cycles between trace" << std::endl; |
---|
477 | std::cout << " -MEMCID index_memc_to_be_traced" << std::endl; |
---|
478 | std::cout << " -XRAMID index_xram_to_be_traced" << std::endl; |
---|
479 | std::cout << " -PROCID index_proc_to_be_traced" << std::endl; |
---|
480 | std::cout << " -IOB non_zero_value" << std::endl; |
---|
481 | exit(0); |
---|
482 | } |
---|
483 | } |
---|
484 | } |
---|
485 | |
---|
486 | // checking hardware parameters |
---|
487 | assert( (XMAX <= 16) and |
---|
488 | "The XMAX parameter cannot be larger than 16" ); |
---|
489 | |
---|
490 | assert( (YMAX <= 16) and |
---|
491 | "The YMAX parameter cannot be larger than 16" ); |
---|
492 | |
---|
493 | assert( (NB_PROCS_MAX <= 8) and |
---|
494 | "The NB_PROCS_MAX parameter cannot be larger than 8" ); |
---|
495 | |
---|
496 | assert( (NB_DMA_CHANNELS <= 4) and |
---|
497 | "The NB_DMA_CHANNELS parameter cannot be larger than 4" ); |
---|
498 | |
---|
499 | assert( (NB_TTY_CHANNELS < 16) and |
---|
500 | "The NB_TTY_CHANNELS parameter must be smaller than 16" ); |
---|
501 | |
---|
502 | assert( (NB_NIC_CHANNELS == 2) and |
---|
503 | "The NB_NIC_CHANNELS parameter must be 2" ); |
---|
504 | |
---|
505 | std::cout << std::endl << std::dec |
---|
506 | << " - XMAX = " << XMAX << std::endl |
---|
507 | << " - YMAX = " << YMAX << std::endl |
---|
508 | << " - NB_PROCS_MAX = " << NB_PROCS_MAX << std::endl |
---|
509 | << " - NB_DMA_CHANNELS = " << NB_DMA_CHANNELS << std::endl |
---|
510 | << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl |
---|
511 | << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl |
---|
512 | << " - MEMC_WAYS = " << MEMC_WAYS << std::endl |
---|
513 | << " - MEMC_SETS = " << MEMC_SETS << std::endl |
---|
514 | << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl |
---|
515 | << " - MAX_FROZEN = " << frozen_cycles << std::endl |
---|
516 | << " - DEBUG_PROCID = " << debug_proc_id << std::endl |
---|
517 | << " - DEBUG_MEMCID = " << debug_memc_id << std::endl |
---|
518 | << " - DEBUG_XRAMID = " << debug_xram_id << std::endl; |
---|
519 | |
---|
520 | std::cout << std::endl; |
---|
521 | |
---|
522 | #if USE_OPENMP |
---|
523 | omp_set_dynamic(false); |
---|
524 | omp_set_num_threads(threads_nr); |
---|
525 | std::cerr << "Built with openmp version " << _OPENMP << std::endl; |
---|
526 | #endif |
---|
527 | |
---|
528 | // Define VciParams objects |
---|
529 | typedef soclib::caba::VciParams<vci_cell_width_int, |
---|
530 | vci_plen_width, |
---|
531 | vci_address_width, |
---|
532 | vci_rerror_width, |
---|
533 | vci_clen_width, |
---|
534 | vci_rflag_width, |
---|
535 | vci_srcid_width, |
---|
536 | vci_pktid_width, |
---|
537 | vci_trdid_width, |
---|
538 | vci_wrplen_width> vci_param_int; |
---|
539 | |
---|
540 | typedef soclib::caba::VciParams<vci_cell_width_ext, |
---|
541 | vci_plen_width, |
---|
542 | vci_address_width, |
---|
543 | vci_rerror_width, |
---|
544 | vci_clen_width, |
---|
545 | vci_rflag_width, |
---|
546 | vci_srcid_width, |
---|
547 | vci_pktid_width, |
---|
548 | vci_trdid_width, |
---|
549 | vci_wrplen_width> vci_param_ext; |
---|
550 | |
---|
551 | ///////////////////////////////////////////////////////////////////// |
---|
552 | // INT network mapping table |
---|
553 | // - two levels address decoding for commands |
---|
554 | // - two levels srcid decoding for responses |
---|
555 | // - NB_PROCS_MAX + 2 (MDMA, IOBX) local initiators per cluster |
---|
556 | // - 4 local targets (MEMC, XICU, MDMA, IOBX) per cluster |
---|
557 | ///////////////////////////////////////////////////////////////////// |
---|
558 | MappingTable maptab_int( vci_address_width, |
---|
559 | IntTab(x_width + y_width, 16 - x_width - y_width), |
---|
560 | IntTab(x_width + y_width, vci_srcid_width - x_width - y_width), |
---|
561 | 0x00FF000000); |
---|
562 | |
---|
563 | for (size_t x = 0; x < XMAX; x++) |
---|
564 | { |
---|
565 | for (size_t y = 0; y < YMAX; y++) |
---|
566 | { |
---|
567 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
568 | << (vci_address_width-x_width-y_width); |
---|
569 | bool config = true; |
---|
570 | bool cacheable = true; |
---|
571 | |
---|
572 | // the four following segments are defined in all clusters |
---|
573 | |
---|
574 | std::ostringstream smemc_conf; |
---|
575 | smemc_conf << "int_seg_memc_conf_" << x << "_" << y; |
---|
576 | maptab_int.add(Segment(smemc_conf.str(), MEMC_BASE+offset, MEMC_SIZE, |
---|
577 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), not cacheable, config )); |
---|
578 | |
---|
579 | std::ostringstream smemc_xram; |
---|
580 | smemc_xram << "int_seg_memc_xram_" << x << "_" << y; |
---|
581 | maptab_int.add(Segment(smemc_xram.str(), XRAM_BASE+offset, XRAM_SIZE, |
---|
582 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), cacheable)); |
---|
583 | |
---|
584 | std::ostringstream sxicu; |
---|
585 | sxicu << "int_seg_xicu_" << x << "_" << y; |
---|
586 | maptab_int.add(Segment(sxicu.str(), XICU_BASE+offset, XICU_SIZE, |
---|
587 | IntTab(cluster(x,y),INT_XICU_TGT_ID), not cacheable)); |
---|
588 | |
---|
589 | std::ostringstream smdma; |
---|
590 | smdma << "int_seg_mdma_" << x << "_" << y; |
---|
591 | maptab_int.add(Segment(smdma.str(), MDMA_BASE+offset, MDMA_SIZE, |
---|
592 | IntTab(cluster(x,y),INT_MDMA_TGT_ID), not cacheable)); |
---|
593 | |
---|
594 | // the following segments are only defined in cluster_iob0 or in cluster_iob1 |
---|
595 | |
---|
596 | if ( (cluster(x,y) == cluster_iob0) or (cluster(x,y) == cluster_iob1) ) |
---|
597 | { |
---|
598 | std::ostringstream siobx; |
---|
599 | siobx << "int_seg_iobx_" << x << "_" << y; |
---|
600 | maptab_int.add(Segment(siobx.str(), IOBX_BASE+offset, IOBX_SIZE, |
---|
601 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable, config )); |
---|
602 | |
---|
603 | std::ostringstream stty; |
---|
604 | stty << "int_seg_mtty_" << x << "_" << y; |
---|
605 | maptab_int.add(Segment(stty.str(), MTTY_BASE+offset, MTTY_SIZE, |
---|
606 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
607 | |
---|
608 | std::ostringstream sfbf; |
---|
609 | sfbf << "int_seg_fbuf_" << x << "_" << y; |
---|
610 | maptab_int.add(Segment(sfbf.str(), FBUF_BASE+offset, FBUF_SIZE, |
---|
611 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
612 | |
---|
613 | std::ostringstream sbdv; |
---|
614 | sbdv << "int_seg_bdev_" << x << "_" << y; |
---|
615 | maptab_int.add(Segment(sbdv.str(), BDEV_BASE+offset, BDEV_SIZE, |
---|
616 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
617 | |
---|
618 | std::ostringstream snic; |
---|
619 | snic << "int_seg_mnic_" << x << "_" << y; |
---|
620 | maptab_int.add(Segment(snic.str(), MNIC_BASE+offset, MNIC_SIZE, |
---|
621 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
622 | |
---|
623 | std::ostringstream srom; |
---|
624 | srom << "int_seg_brom_" << x << "_" << y; |
---|
625 | maptab_int.add(Segment(srom.str(), BROM_BASE+offset, BROM_SIZE, |
---|
626 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), cacheable )); |
---|
627 | |
---|
628 | std::ostringstream sdma; |
---|
629 | sdma << "int_seg_cdma_" << x << "_" << y; |
---|
630 | maptab_int.add(Segment(sdma.str(), CDMA_BASE+offset, CDMA_SIZE, |
---|
631 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
632 | |
---|
633 | std::ostringstream spic; |
---|
634 | spic << "int_seg_iopi_" << x << "_" << y; |
---|
635 | maptab_int.add(Segment(spic.str(), IOPI_BASE+offset, IOPI_SIZE, |
---|
636 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
637 | } |
---|
638 | |
---|
639 | // This define the mapping between the SRCIDs |
---|
640 | // and the port index on the local interconnect. |
---|
641 | |
---|
642 | maptab_int.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
643 | IntTab( cluster(x,y), INT_MDMA_INI_ID ) ); |
---|
644 | |
---|
645 | maptab_int.srcid_map( IntTab( cluster(x,y), IOBX_LOCAL_SRCID ), |
---|
646 | IntTab( cluster(x,y), INT_IOBX_INI_ID ) ); |
---|
647 | |
---|
648 | maptab_int.srcid_map( IntTab( cluster(x,y), IOPI_LOCAL_SRCID ), |
---|
649 | IntTab( cluster(x,y), INT_IOBX_INI_ID ) ); |
---|
650 | |
---|
651 | for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ ) |
---|
652 | maptab_int.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+p ), |
---|
653 | IntTab( cluster(x,y), INT_PROC_INI_ID+p ) ); |
---|
654 | } |
---|
655 | } |
---|
656 | std::cout << "INT network " << maptab_int << std::endl; |
---|
657 | |
---|
658 | ///////////////////////////////////////////////////////////////////////// |
---|
659 | // RAM network mapping table |
---|
660 | // - two levels address decoding for commands |
---|
661 | // - two levels srcid decoding for responses |
---|
662 | // - 2 local initiators (MEMC, IOBX) per cluster |
---|
663 | // (IOBX component only in cluster_iob0 and cluster_iob1) |
---|
664 | // - 1 local target (XRAM) per cluster |
---|
665 | //////////////////////////////////////////////////////////////////////// |
---|
666 | MappingTable maptab_ram( vci_address_width, |
---|
667 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
668 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
669 | 0x00FF000000); |
---|
670 | |
---|
671 | for (size_t x = 0; x < XMAX; x++) |
---|
672 | { |
---|
673 | for (size_t y = 0; y < YMAX ; y++) |
---|
674 | { |
---|
675 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
676 | << (vci_address_width-x_width-y_width); |
---|
677 | |
---|
678 | std::ostringstream sxram; |
---|
679 | sxram << "ext_seg_xram_" << x << "_" << y; |
---|
680 | maptab_ram.add(Segment(sxram.str(), XRAM_BASE+offset, |
---|
681 | XRAM_SIZE, IntTab(cluster(x,y), 0), false)); |
---|
682 | } |
---|
683 | } |
---|
684 | |
---|
685 | // This define the mapping between the initiators SRCID |
---|
686 | // and the port index on the RAM local interconnect. |
---|
687 | // External initiator have two alias SRCID (iob0 / iob1) |
---|
688 | |
---|
689 | maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), |
---|
690 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); |
---|
691 | |
---|
692 | maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), |
---|
693 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); |
---|
694 | |
---|
695 | maptab_ram.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), |
---|
696 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); |
---|
697 | |
---|
698 | maptab_ram.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
699 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); |
---|
700 | |
---|
701 | maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ), |
---|
702 | IntTab( cluster_iob1, RAM_MEMC_INI_ID ) ); |
---|
703 | |
---|
704 | std::cout << "RAM network " << maptab_ram << std::endl; |
---|
705 | |
---|
706 | /////////////////////////////////////////////////////////////////////// |
---|
707 | // IOX network mapping table |
---|
708 | // - two levels address decoding for commands |
---|
709 | // - two levels srcid decoding for responses |
---|
710 | // - 5 initiators (IOB0, IOB1, BDEV, CDMA, IOPI) |
---|
711 | // - 9 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, BROM, MNIC, IOPI) |
---|
712 | /////////////////////////////////////////////////////////////////////// |
---|
713 | MappingTable maptab_iox( vci_address_width, |
---|
714 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
715 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
716 | 0x00FF000000); |
---|
717 | |
---|
718 | // compute base addresses for cluster_iob0 and cluster_iob1 |
---|
719 | uint64_t iob0_base = ((uint64_t)cluster_iob0) << (vci_address_width - x_width - y_width); |
---|
720 | uint64_t iob1_base = ((uint64_t)cluster_iob1) << (vci_address_width - x_width - y_width); |
---|
721 | |
---|
722 | // External peripherals segments |
---|
723 | // WHen there is more than one cluster, external peripherals can be accessed |
---|
724 | // through two segments, depending on the used IOB (IOB0 or IOB1). |
---|
725 | maptab_iox.add(Segment("iox_seg_mtty_0", MTTY_BASE + iob0_base, MTTY_SIZE, |
---|
726 | IntTab(cluster_iob0,IOX_MTTY_TGT_ID), false)); |
---|
727 | maptab_iox.add(Segment("iox_seg_fbuf_0", FBUF_BASE + iob0_base, FBUF_SIZE, |
---|
728 | IntTab(cluster_iob0,IOX_FBUF_TGT_ID), false)); |
---|
729 | maptab_iox.add(Segment("iox_seg_bdev_0", BDEV_BASE + iob0_base, BDEV_SIZE, |
---|
730 | IntTab(cluster_iob0,IOX_BDEV_TGT_ID), false)); |
---|
731 | maptab_iox.add(Segment("iox_seg_mnic_0", MNIC_BASE + iob0_base, MNIC_SIZE, |
---|
732 | IntTab(cluster_iob0,IOX_MNIC_TGT_ID), false)); |
---|
733 | maptab_iox.add(Segment("iox_seg_cdma_0", CDMA_BASE + iob0_base, CDMA_SIZE, |
---|
734 | IntTab(cluster_iob0,IOX_CDMA_TGT_ID), false)); |
---|
735 | maptab_iox.add(Segment("iox_seg_brom_0", BROM_BASE + iob0_base, BROM_SIZE, |
---|
736 | IntTab(cluster_iob0,IOX_BROM_TGT_ID), false)); |
---|
737 | maptab_iox.add(Segment("iox_seg_iopi_0", IOPI_BASE + iob0_base, IOPI_SIZE, |
---|
738 | IntTab(cluster_iob0,IOX_IOPI_TGT_ID), false)); |
---|
739 | |
---|
740 | if ( cluster_iob0 != cluster_iob1 ) |
---|
741 | { |
---|
742 | maptab_iox.add(Segment("iox_seg_mtty_1", MTTY_BASE + iob1_base, MTTY_SIZE, |
---|
743 | IntTab(cluster_iob1,IOX_MTTY_TGT_ID), false)); |
---|
744 | maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, FBUF_SIZE, |
---|
745 | IntTab(cluster_iob1,IOX_FBUF_TGT_ID), false)); |
---|
746 | maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, BDEV_SIZE, |
---|
747 | IntTab(cluster_iob1,IOX_BDEV_TGT_ID), false)); |
---|
748 | maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, MNIC_SIZE, |
---|
749 | IntTab(cluster_iob1,IOX_MNIC_TGT_ID), false)); |
---|
750 | maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, CDMA_SIZE, |
---|
751 | IntTab(cluster_iob1,IOX_CDMA_TGT_ID), false)); |
---|
752 | maptab_iox.add(Segment("iox_seg_brom_1", BROM_BASE + iob1_base, BROM_SIZE, |
---|
753 | IntTab(cluster_iob1,IOX_BROM_TGT_ID), false)); |
---|
754 | maptab_iox.add(Segment("iox_seg_iopi_1", IOPI_BASE + iob1_base, IOPI_SIZE, |
---|
755 | IntTab(cluster_iob1,IOX_IOPI_TGT_ID), false)); |
---|
756 | } |
---|
757 | |
---|
758 | // If there is more than one cluster, external peripherals |
---|
759 | // can access RAM through two segments (IOB0 / IOB1). |
---|
760 | // As IOMMU is not activated, addresses are 40 bits (physical addresses), |
---|
761 | // and the choice depends on address bit A[39]. |
---|
762 | for (size_t x = 0; x < XMAX; x++) |
---|
763 | { |
---|
764 | for (size_t y = 0; y < YMAX ; y++) |
---|
765 | { |
---|
766 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
767 | << (vci_address_width-x_width-y_width); |
---|
768 | |
---|
769 | if ( (cluster_iob0 != cluster_iob1) and (x >= (XMAX/2)) ) // use IOB1 |
---|
770 | { |
---|
771 | std::ostringstream siob1; |
---|
772 | siob1 << "iox_seg_xram_" << x << "_" << y; |
---|
773 | maptab_iox.add(Segment(siob1.str(), offset, XRAM_SIZE, |
---|
774 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
775 | } |
---|
776 | else // USE IOB0 |
---|
777 | { |
---|
778 | std::ostringstream siob0; |
---|
779 | siob0 << "iox_seg_xram_" << x << "_" << y; |
---|
780 | maptab_iox.add(Segment(siob0.str(), offset, XRAM_SIZE, |
---|
781 | IntTab(cluster_iob0,IOX_IOB0_TGT_ID), false)); |
---|
782 | } |
---|
783 | } |
---|
784 | } |
---|
785 | |
---|
786 | // This define the mapping between the external initiators (SRCID) |
---|
787 | // and the port index on the IOX local interconnect. |
---|
788 | // If there is more than one cluster, external initiators |
---|
789 | // have two alias SRCID (iob0 / iob1 access) |
---|
790 | maptab_iox.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), |
---|
791 | IntTab( cluster_iob0, IOX_CDMA_INI_ID ) ); |
---|
792 | maptab_iox.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), |
---|
793 | IntTab( cluster_iob0, IOX_BDEV_INI_ID ) ); |
---|
794 | maptab_iox.srcid_map( IntTab( cluster_iob0, IOPI_LOCAL_SRCID ), |
---|
795 | IntTab( cluster_iob0, IOX_IOPI_INI_ID ) ); |
---|
796 | |
---|
797 | if ( cluster_iob0 != cluster_iob1 ) |
---|
798 | { |
---|
799 | maptab_iox.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), |
---|
800 | IntTab( cluster_iob1, IOX_CDMA_INI_ID ) ); |
---|
801 | maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
802 | IntTab( cluster_iob1, IOX_BDEV_INI_ID ) ); |
---|
803 | maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
804 | IntTab( cluster_iob1, IOX_IOPI_INI_ID ) ); |
---|
805 | } |
---|
806 | |
---|
807 | // This define the mapping between the internal initiators (SRCID) |
---|
808 | // and the port index on the IOX local interconnect. |
---|
809 | // If there is more than one cluster, external initiators |
---|
810 | |
---|
811 | for (size_t x = 0; x < XMAX; x++) |
---|
812 | { |
---|
813 | for (size_t y = 0; y < YMAX ; y++) |
---|
814 | { |
---|
815 | if ( (cluster_iob0 != cluster_iob1) and (x >= (XMAX/2)) ) // use IOB1 |
---|
816 | { |
---|
817 | for (size_t p = 0 ; p < NB_PROCS_MAX ; p++) |
---|
818 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID + p ), |
---|
819 | IntTab( cluster_iob1, IOX_IOB1_INI_ID ) ); |
---|
820 | |
---|
821 | maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
822 | IntTab( cluster_iob1, IOX_IOB1_INI_ID ) ); |
---|
823 | } |
---|
824 | else // USE IOB0 |
---|
825 | { |
---|
826 | for (size_t p = 0 ; p < NB_PROCS_MAX ; p++) |
---|
827 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID + p ), |
---|
828 | IntTab( cluster_iob0, IOX_IOB0_INI_ID ) ); |
---|
829 | |
---|
830 | maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
831 | IntTab( cluster_iob0, IOX_IOB0_INI_ID ) ); |
---|
832 | } |
---|
833 | } |
---|
834 | } |
---|
835 | |
---|
836 | std::cout << "IOX network " << maptab_iox << std::endl; |
---|
837 | |
---|
838 | //////////////////// |
---|
839 | // Signals |
---|
840 | /////////////////// |
---|
841 | |
---|
842 | sc_clock signal_clk("clk"); |
---|
843 | sc_signal<bool> signal_resetn("resetn"); |
---|
844 | |
---|
845 | sc_signal<bool> signal_irq_false; |
---|
846 | sc_signal<bool> signal_irq_bdev; |
---|
847 | sc_signal<bool> signal_irq_mnic_rx[NB_NIC_CHANNELS]; |
---|
848 | sc_signal<bool> signal_irq_mnic_tx[NB_NIC_CHANNELS]; |
---|
849 | sc_signal<bool> signal_irq_mtty_rx[NB_TTY_CHANNELS]; |
---|
850 | // sc_signal<bool> signal_irq_mtty_tx[NB_TTY_CHANNELS]; |
---|
851 | sc_signal<bool> signal_irq_cdma[NB_CMA_CHANNELS]; |
---|
852 | |
---|
853 | // DSPIN signals for loopback in cluster_iob0 & cluster_iob1 |
---|
854 | DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob0_loopback; |
---|
855 | DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob0_loopback; |
---|
856 | DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob1_loopback; |
---|
857 | DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob1_loopback; |
---|
858 | |
---|
859 | // VCI signals for IOX network |
---|
860 | VciSignals<vci_param_ext> signal_vci_ini_iob0("signal_vci_ini_iob0"); |
---|
861 | VciSignals<vci_param_ext> signal_vci_ini_iob1("signal_vci_ini_iob1"); |
---|
862 | VciSignals<vci_param_ext> signal_vci_ini_bdev("signal_vci_ini_bdev"); |
---|
863 | VciSignals<vci_param_ext> signal_vci_ini_cdma("signal_vci_ini_cdma"); |
---|
864 | VciSignals<vci_param_ext> signal_vci_ini_iopi("signal_vci_ini_iopi"); |
---|
865 | |
---|
866 | VciSignals<vci_param_ext> signal_vci_tgt_iob0("signal_vci_tgt_iob0"); |
---|
867 | VciSignals<vci_param_ext> signal_vci_tgt_iob1("signal_vci_tgt_iob1"); |
---|
868 | VciSignals<vci_param_ext> signal_vci_tgt_mtty("signal_vci_tgt_mtty"); |
---|
869 | VciSignals<vci_param_ext> signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); |
---|
870 | VciSignals<vci_param_ext> signal_vci_tgt_mnic("signal_vci_tgt_mnic"); |
---|
871 | VciSignals<vci_param_ext> signal_vci_tgt_brom("signal_vci_tgt_brom"); |
---|
872 | VciSignals<vci_param_ext> signal_vci_tgt_bdev("signal_vci_tgt_bdev"); |
---|
873 | VciSignals<vci_param_ext> signal_vci_tgt_cdma("signal_vci_tgt_cdma"); |
---|
874 | VciSignals<vci_param_ext> signal_vci_tgt_iopi("signal_vci_ini_iopi"); |
---|
875 | |
---|
876 | // Horizontal inter-clusters INT network DSPIN |
---|
877 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_inc = |
---|
878 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_inc", XMAX-1, YMAX, 3); |
---|
879 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_dec = |
---|
880 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_dec", XMAX-1, YMAX, 3); |
---|
881 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_inc = |
---|
882 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_inc", XMAX-1, YMAX, 2); |
---|
883 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_dec = |
---|
884 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_dec", XMAX-1, YMAX, 2); |
---|
885 | |
---|
886 | // Vertical inter-clusters INT network DSPIN |
---|
887 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_inc = |
---|
888 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_inc", XMAX, YMAX-1, 3); |
---|
889 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_dec = |
---|
890 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_dec", XMAX, YMAX-1, 3); |
---|
891 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_inc = |
---|
892 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_inc", XMAX, YMAX-1, 2); |
---|
893 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_dec = |
---|
894 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_dec", XMAX, YMAX-1, 2); |
---|
895 | |
---|
896 | // Mesh boundaries INT network DSPIN |
---|
897 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_in = |
---|
898 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_in", XMAX, YMAX, 4, 3); |
---|
899 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_out = |
---|
900 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_out", XMAX, YMAX, 4, 3); |
---|
901 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_in = |
---|
902 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_in", XMAX, YMAX, 4, 2); |
---|
903 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_out = |
---|
904 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_out", XMAX, YMAX, 4, 2); |
---|
905 | |
---|
906 | |
---|
907 | // Horizontal inter-clusters RAM network DSPIN |
---|
908 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_inc = |
---|
909 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_inc", XMAX-1, YMAX); |
---|
910 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_dec = |
---|
911 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_dec", XMAX-1, YMAX); |
---|
912 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_inc = |
---|
913 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_inc", XMAX-1, YMAX); |
---|
914 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_dec = |
---|
915 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_dec", XMAX-1, YMAX); |
---|
916 | |
---|
917 | // Vertical inter-clusters RAM network DSPIN |
---|
918 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_inc = |
---|
919 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_inc", XMAX, YMAX-1); |
---|
920 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_dec = |
---|
921 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_dec", XMAX, YMAX-1); |
---|
922 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_inc = |
---|
923 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_inc", XMAX, YMAX-1); |
---|
924 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_dec = |
---|
925 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_dec", XMAX, YMAX-1); |
---|
926 | |
---|
927 | // Mesh boundaries RAM network DSPIN |
---|
928 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_in = |
---|
929 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_in", XMAX, YMAX, 4); |
---|
930 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_out = |
---|
931 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_out", XMAX, YMAX, 4); |
---|
932 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_in = |
---|
933 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_in", XMAX, YMAX, 4); |
---|
934 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_out = |
---|
935 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_out", XMAX, YMAX, 4); |
---|
936 | |
---|
937 | //////////////////////////// |
---|
938 | // Loader |
---|
939 | //////////////////////////// |
---|
940 | |
---|
941 | #if USE_ALMOS |
---|
942 | soclib::common::Loader loader(almos_bootloader_pathname, |
---|
943 | almos_archinfo_pathname, |
---|
944 | almos_kernel_pathname); |
---|
945 | #else |
---|
946 | soclib::common::Loader loader(soft_name); |
---|
947 | #endif |
---|
948 | |
---|
949 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; |
---|
950 | proc_iss::set_loader(loader); |
---|
951 | |
---|
952 | //////////////////////////////////////// |
---|
953 | // Instanciated Hardware Components |
---|
954 | //////////////////////////////////////// |
---|
955 | |
---|
956 | std::cout << std::endl << "External Bus and Peripherals" << std::endl << std::endl; |
---|
957 | |
---|
958 | // IOX network |
---|
959 | VciIoxNetwork<vci_param_ext>* iox_network; |
---|
960 | iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network", |
---|
961 | maptab_iox, |
---|
962 | 9, // number of targets |
---|
963 | 5 ); // number of initiators |
---|
964 | // boot ROM |
---|
965 | VciSimpleRom<vci_param_ext>* brom; |
---|
966 | brom = new VciSimpleRom<vci_param_ext>( "brom", |
---|
967 | IntTab(0, IOX_BROM_TGT_ID), |
---|
968 | maptab_iox, |
---|
969 | loader ); |
---|
970 | // Network Controller |
---|
971 | VciMultiNic<vci_param_ext>* mnic; |
---|
972 | mnic = new VciMultiNic<vci_param_ext>( "mnic", |
---|
973 | IntTab(0, IOX_MNIC_TGT_ID), |
---|
974 | maptab_iox, |
---|
975 | NB_NIC_CHANNELS, |
---|
976 | 0, // mac_4 address |
---|
977 | 0, // mac_2 address |
---|
978 | nic_rx_name, |
---|
979 | nic_tx_name); |
---|
980 | |
---|
981 | // Frame Buffer |
---|
982 | VciFrameBuffer<vci_param_ext>* fbuf; |
---|
983 | fbuf = new VciFrameBuffer<vci_param_ext>( "fbuf", |
---|
984 | IntTab(0, IOX_FBUF_TGT_ID), |
---|
985 | maptab_iox, |
---|
986 | FBUF_X_SIZE, FBUF_Y_SIZE ); |
---|
987 | |
---|
988 | // Block Device |
---|
989 | // for AHCI |
---|
990 | // std::vector<std::string> filenames; |
---|
991 | // filenames.push_back(disk_name); // one single disk |
---|
992 | VciBlockDeviceTsar<vci_param_ext>* bdev; |
---|
993 | bdev = new VciBlockDeviceTsar<vci_param_ext>( "bdev", |
---|
994 | maptab_iox, |
---|
995 | IntTab(0, BDEV_LOCAL_SRCID), |
---|
996 | IntTab(0, IOX_BDEV_TGT_ID), |
---|
997 | disk_name, |
---|
998 | block_size, |
---|
999 | 64, // burst size (bytes) |
---|
1000 | 0 ); // disk latency |
---|
1001 | |
---|
1002 | // Chained Buffer DMA controller |
---|
1003 | VciChbufDma<vci_param_ext>* cdma; |
---|
1004 | cdma = new VciChbufDma<vci_param_ext>( "cdma", |
---|
1005 | maptab_iox, |
---|
1006 | IntTab(0, CDMA_LOCAL_SRCID), |
---|
1007 | IntTab(0, IOX_CDMA_TGT_ID), |
---|
1008 | 64, // burst size (bytes) |
---|
1009 | 2*NB_NIC_CHANNELS ); |
---|
1010 | // Multi-TTY controller |
---|
1011 | std::vector<std::string> vect_names; |
---|
1012 | for( size_t tid = 0 ; tid < NB_TTY_CHANNELS ; tid++ ) |
---|
1013 | { |
---|
1014 | std::ostringstream term_name; |
---|
1015 | term_name << "term" << tid; |
---|
1016 | vect_names.push_back(term_name.str().c_str()); |
---|
1017 | } |
---|
1018 | VciMultiTty<vci_param_ext>* mtty; |
---|
1019 | mtty = new VciMultiTty<vci_param_ext>( "mtty", |
---|
1020 | IntTab(0, IOX_MTTY_TGT_ID), |
---|
1021 | maptab_iox, |
---|
1022 | vect_names); |
---|
1023 | |
---|
1024 | // IOPIC |
---|
1025 | VciIopic<vci_param_ext>* iopi; |
---|
1026 | iopi = new VciIopic<vci_param_ext>( "iopi", |
---|
1027 | maptab_iox, |
---|
1028 | IntTab(0, IOPI_LOCAL_SRCID), |
---|
1029 | IntTab(0, IOX_IOPI_TGT_ID), |
---|
1030 | 32, // number of input HWI |
---|
1031 | 5000 ); // period between WTI |
---|
1032 | // Clusters |
---|
1033 | TsarIobCluster<vci_param_int, |
---|
1034 | vci_param_ext, |
---|
1035 | dspin_int_cmd_width, |
---|
1036 | dspin_int_rsp_width, |
---|
1037 | dspin_ram_cmd_width, |
---|
1038 | dspin_ram_rsp_width>* clusters[XMAX][YMAX]; |
---|
1039 | |
---|
1040 | #if USE_OPENMP |
---|
1041 | #pragma omp parallel |
---|
1042 | { |
---|
1043 | #pragma omp for |
---|
1044 | #endif |
---|
1045 | for(size_t i = 0; i < (XMAX * YMAX); i++) |
---|
1046 | { |
---|
1047 | size_t x = i / YMAX; |
---|
1048 | size_t y = i % YMAX; |
---|
1049 | |
---|
1050 | #if USE_OPENMP |
---|
1051 | #pragma omp critical |
---|
1052 | { |
---|
1053 | #endif |
---|
1054 | std::cout << std::endl; |
---|
1055 | std::cout << "Cluster_" << std::dec << x << "_" << y << std::endl; |
---|
1056 | std::cout << std::endl; |
---|
1057 | |
---|
1058 | std::ostringstream sc; |
---|
1059 | sc << "cluster_" << x << "_" << y; |
---|
1060 | clusters[x][y] = new TsarIobCluster<vci_param_int, |
---|
1061 | vci_param_ext, |
---|
1062 | dspin_int_cmd_width, |
---|
1063 | dspin_int_rsp_width, |
---|
1064 | dspin_ram_cmd_width, |
---|
1065 | dspin_ram_rsp_width> |
---|
1066 | ( |
---|
1067 | sc.str().c_str(), |
---|
1068 | NB_PROCS_MAX, |
---|
1069 | NB_DMA_CHANNELS, |
---|
1070 | x, |
---|
1071 | y, |
---|
1072 | XMAX, |
---|
1073 | YMAX, |
---|
1074 | |
---|
1075 | maptab_int, |
---|
1076 | maptab_ram, |
---|
1077 | maptab_iox, |
---|
1078 | |
---|
1079 | x_width, |
---|
1080 | y_width, |
---|
1081 | vci_srcid_width - x_width - y_width, // l_id width, |
---|
1082 | |
---|
1083 | INT_MEMC_TGT_ID, |
---|
1084 | INT_XICU_TGT_ID, |
---|
1085 | INT_MDMA_TGT_ID, |
---|
1086 | INT_IOBX_TGT_ID, |
---|
1087 | |
---|
1088 | INT_PROC_INI_ID, |
---|
1089 | INT_MDMA_INI_ID, |
---|
1090 | INT_IOBX_INI_ID, |
---|
1091 | |
---|
1092 | RAM_XRAM_TGT_ID, |
---|
1093 | |
---|
1094 | RAM_MEMC_INI_ID, |
---|
1095 | RAM_IOBX_INI_ID, |
---|
1096 | |
---|
1097 | MEMC_WAYS, |
---|
1098 | MEMC_SETS, |
---|
1099 | L1_IWAYS, |
---|
1100 | L1_ISETS, |
---|
1101 | L1_DWAYS, |
---|
1102 | L1_DSETS, |
---|
1103 | XRAM_LATENCY, |
---|
1104 | |
---|
1105 | loader, |
---|
1106 | |
---|
1107 | frozen_cycles, |
---|
1108 | debug_from, |
---|
1109 | debug_ok and (cluster(x,y) == debug_memc_id), |
---|
1110 | debug_ok and (cluster(x,y) == debug_proc_id), |
---|
1111 | debug_ok and debug_iob |
---|
1112 | ); |
---|
1113 | |
---|
1114 | #if USE_OPENMP |
---|
1115 | } // end critical |
---|
1116 | #endif |
---|
1117 | } // end for |
---|
1118 | #if USE_OPENMP |
---|
1119 | } |
---|
1120 | #endif |
---|
1121 | |
---|
1122 | std::cout << std::endl; |
---|
1123 | |
---|
1124 | /////////////////////////////////////////////////////////////////////////////// |
---|
1125 | // Net-list |
---|
1126 | /////////////////////////////////////////////////////////////////////////////// |
---|
1127 | |
---|
1128 | // IOX network connexion |
---|
1129 | iox_network->p_clk (signal_clk); |
---|
1130 | iox_network->p_resetn (signal_resetn); |
---|
1131 | iox_network->p_to_ini[IOX_IOB0_INI_ID] (signal_vci_ini_iob0); |
---|
1132 | iox_network->p_to_ini[IOX_IOB1_INI_ID] (signal_vci_ini_iob1); |
---|
1133 | iox_network->p_to_ini[IOX_BDEV_INI_ID] (signal_vci_ini_bdev); |
---|
1134 | iox_network->p_to_ini[IOX_CDMA_INI_ID] (signal_vci_ini_cdma); |
---|
1135 | iox_network->p_to_ini[IOX_IOPI_INI_ID] (signal_vci_ini_iopi); |
---|
1136 | |
---|
1137 | iox_network->p_to_tgt[IOX_IOB0_TGT_ID] (signal_vci_tgt_iob0); |
---|
1138 | iox_network->p_to_tgt[IOX_IOB1_TGT_ID] (signal_vci_tgt_iob1); |
---|
1139 | iox_network->p_to_tgt[IOX_MTTY_TGT_ID] (signal_vci_tgt_mtty); |
---|
1140 | iox_network->p_to_tgt[IOX_FBUF_TGT_ID] (signal_vci_tgt_fbuf); |
---|
1141 | iox_network->p_to_tgt[IOX_MNIC_TGT_ID] (signal_vci_tgt_mnic); |
---|
1142 | iox_network->p_to_tgt[IOX_BROM_TGT_ID] (signal_vci_tgt_brom); |
---|
1143 | iox_network->p_to_tgt[IOX_BDEV_TGT_ID] (signal_vci_tgt_bdev); |
---|
1144 | iox_network->p_to_tgt[IOX_CDMA_TGT_ID] (signal_vci_tgt_cdma); |
---|
1145 | iox_network->p_to_tgt[IOX_IOPI_TGT_ID] (signal_vci_tgt_iopi); |
---|
1146 | |
---|
1147 | // BDEV connexion |
---|
1148 | bdev->p_clk (signal_clk); |
---|
1149 | bdev->p_resetn (signal_resetn); |
---|
1150 | bdev->p_irq (signal_irq_bdev); |
---|
1151 | |
---|
1152 | // For AHCI |
---|
1153 | // bdev->p_channel_irq[0] (signal_irq_bdev); |
---|
1154 | |
---|
1155 | bdev->p_vci_target (signal_vci_tgt_bdev); |
---|
1156 | bdev->p_vci_initiator (signal_vci_ini_bdev); |
---|
1157 | |
---|
1158 | std::cout << " - BDEV connected" << std::endl; |
---|
1159 | |
---|
1160 | // FBUF connexion |
---|
1161 | fbuf->p_clk (signal_clk); |
---|
1162 | fbuf->p_resetn (signal_resetn); |
---|
1163 | fbuf->p_vci (signal_vci_tgt_fbuf); |
---|
1164 | |
---|
1165 | std::cout << " - FBUF connected" << std::endl; |
---|
1166 | |
---|
1167 | // MNIC connexion |
---|
1168 | mnic->p_clk (signal_clk); |
---|
1169 | mnic->p_resetn (signal_resetn); |
---|
1170 | mnic->p_vci (signal_vci_tgt_mnic); |
---|
1171 | for ( size_t i=0 ; i<NB_NIC_CHANNELS ; i++ ) |
---|
1172 | { |
---|
1173 | mnic->p_rx_irq[i] (signal_irq_mnic_rx[i]); |
---|
1174 | mnic->p_tx_irq[i] (signal_irq_mnic_tx[i]); |
---|
1175 | } |
---|
1176 | |
---|
1177 | std::cout << " - MNIC connected" << std::endl; |
---|
1178 | |
---|
1179 | // BROM connexion |
---|
1180 | brom->p_clk (signal_clk); |
---|
1181 | brom->p_resetn (signal_resetn); |
---|
1182 | brom->p_vci (signal_vci_tgt_brom); |
---|
1183 | |
---|
1184 | std::cout << " - BROM connected" << std::endl; |
---|
1185 | |
---|
1186 | // MTTY connexion |
---|
1187 | mtty->p_clk (signal_clk); |
---|
1188 | mtty->p_resetn (signal_resetn); |
---|
1189 | mtty->p_vci (signal_vci_tgt_mtty); |
---|
1190 | for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ ) |
---|
1191 | { |
---|
1192 | mtty->p_irq[i] (signal_irq_mtty_rx[i]); |
---|
1193 | } |
---|
1194 | |
---|
1195 | std::cout << " - MTTY connected" << std::endl; |
---|
1196 | |
---|
1197 | // CDMA connexion |
---|
1198 | cdma->p_clk (signal_clk); |
---|
1199 | cdma->p_resetn (signal_resetn); |
---|
1200 | cdma->p_vci_target (signal_vci_tgt_cdma); |
---|
1201 | cdma->p_vci_initiator (signal_vci_ini_cdma); |
---|
1202 | for ( size_t i=0 ; i<(NB_NIC_CHANNELS*2) ; i++) |
---|
1203 | { |
---|
1204 | cdma->p_irq[i] (signal_irq_cdma[i]); |
---|
1205 | } |
---|
1206 | |
---|
1207 | std::cout << " - CDMA connected" << std::endl; |
---|
1208 | |
---|
1209 | // IOPI connexion |
---|
1210 | iopi->p_clk (signal_clk); |
---|
1211 | iopi->p_resetn (signal_resetn); |
---|
1212 | iopi->p_vci_target (signal_vci_tgt_iopi); |
---|
1213 | iopi->p_vci_initiator (signal_vci_ini_iopi); |
---|
1214 | for ( size_t i=0 ; i<32 ; i++) |
---|
1215 | { |
---|
1216 | if (i < NB_NIC_CHANNELS) iopi->p_hwi[i] (signal_irq_mnic_rx[i]); |
---|
1217 | else if(i < 2 ) iopi->p_hwi[i] (signal_irq_false); |
---|
1218 | else if(i < 2+NB_NIC_CHANNELS) iopi->p_hwi[i] (signal_irq_mnic_tx[i-2]); |
---|
1219 | else if(i < 4 ) iopi->p_hwi[i] (signal_irq_false); |
---|
1220 | else if(i < 4+NB_CMA_CHANNELS) iopi->p_hwi[i] (signal_irq_cdma[i-4]); |
---|
1221 | else if(i < 8) iopi->p_hwi[i] (signal_irq_false); |
---|
1222 | else if(i == 8) iopi->p_hwi[i] (signal_irq_bdev); |
---|
1223 | else if(i < 16) iopi->p_hwi[i] (signal_irq_false); |
---|
1224 | else if(i < 16+NB_TTY_CHANNELS) iopi->p_hwi[i] (signal_irq_mtty_rx[i-16]); |
---|
1225 | else if(i < 24) iopi->p_hwi[i] (signal_irq_false); |
---|
1226 | else if(i < 24+NB_TTY_CHANNELS) iopi->p_hwi[i] (signal_irq_false); |
---|
1227 | // else if(i < 24+NB_TTY_CHANNELS) iopi->p_hwi[i] (signal_irq_mtty_tx[i-24]); |
---|
1228 | else iopi->p_hwi[i] (signal_irq_false); |
---|
1229 | } |
---|
1230 | |
---|
1231 | std::cout << " - IOPIC connected" << std::endl; |
---|
1232 | |
---|
1233 | |
---|
1234 | // IOB0 cluster connexion to IOX network |
---|
1235 | (*clusters[0][0]->p_vci_iob_iox_ini) (signal_vci_ini_iob0); |
---|
1236 | (*clusters[0][0]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob0); |
---|
1237 | |
---|
1238 | // IOB1 cluster connexion to IOX network |
---|
1239 | // (only when there is more than 1 cluster) |
---|
1240 | if ( cluster_iob0 != cluster_iob1 ) |
---|
1241 | { |
---|
1242 | (*clusters[XMAX-1][YMAX-1]->p_vci_iob_iox_ini) (signal_vci_ini_iob1); |
---|
1243 | (*clusters[XMAX-1][YMAX-1]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob1); |
---|
1244 | } |
---|
1245 | |
---|
1246 | // All clusters Clock & RESET connexions |
---|
1247 | for ( size_t x = 0; x < (XMAX); x++ ) |
---|
1248 | { |
---|
1249 | for (size_t y = 0; y < YMAX; y++) |
---|
1250 | { |
---|
1251 | clusters[x][y]->p_clk (signal_clk); |
---|
1252 | clusters[x][y]->p_resetn (signal_resetn); |
---|
1253 | } |
---|
1254 | } |
---|
1255 | |
---|
1256 | // Inter Clusters horizontal connections |
---|
1257 | if (XMAX > 1) |
---|
1258 | { |
---|
1259 | for (size_t x = 0; x < (XMAX-1); x++) |
---|
1260 | { |
---|
1261 | for (size_t y = 0; y < YMAX; y++) |
---|
1262 | { |
---|
1263 | for (size_t k = 0; k < 3; k++) |
---|
1264 | { |
---|
1265 | clusters[x][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
1266 | clusters[x+1][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
1267 | clusters[x][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
1268 | clusters[x+1][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
1269 | } |
---|
1270 | |
---|
1271 | for (size_t k = 0; k < 2; k++) |
---|
1272 | { |
---|
1273 | clusters[x][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
1274 | clusters[x+1][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
1275 | clusters[x][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
1276 | clusters[x+1][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
1277 | } |
---|
1278 | |
---|
1279 | clusters[x][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
1280 | clusters[x+1][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
1281 | clusters[x][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
1282 | clusters[x+1][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
1283 | clusters[x][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
1284 | clusters[x+1][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
1285 | clusters[x][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
1286 | clusters[x+1][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
1287 | } |
---|
1288 | } |
---|
1289 | } |
---|
1290 | |
---|
1291 | std::cout << std::endl << "Horizontal connections established" << std::endl; |
---|
1292 | |
---|
1293 | // Inter Clusters vertical connections |
---|
1294 | if (YMAX > 1) |
---|
1295 | { |
---|
1296 | for (size_t y = 0; y < (YMAX-1); y++) |
---|
1297 | { |
---|
1298 | for (size_t x = 0; x < XMAX; x++) |
---|
1299 | { |
---|
1300 | for (size_t k = 0; k < 3; k++) |
---|
1301 | { |
---|
1302 | clusters[x][y]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
1303 | clusters[x][y+1]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
1304 | clusters[x][y]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
1305 | clusters[x][y+1]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
1306 | } |
---|
1307 | |
---|
1308 | for (size_t k = 0; k < 2; k++) |
---|
1309 | { |
---|
1310 | clusters[x][y]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
1311 | clusters[x][y+1]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
1312 | clusters[x][y]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
1313 | clusters[x][y+1]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
1314 | } |
---|
1315 | |
---|
1316 | clusters[x][y]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
1317 | clusters[x][y+1]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
1318 | clusters[x][y]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
1319 | clusters[x][y+1]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
1320 | clusters[x][y]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
1321 | clusters[x][y+1]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
1322 | clusters[x][y]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
1323 | clusters[x][y+1]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
1324 | } |
---|
1325 | } |
---|
1326 | } |
---|
1327 | |
---|
1328 | std::cout << "Vertical connections established" << std::endl; |
---|
1329 | |
---|
1330 | // East & West boundary cluster connections |
---|
1331 | for (size_t y = 0; y < YMAX; y++) |
---|
1332 | { |
---|
1333 | for (size_t k = 0; k < 3; k++) |
---|
1334 | { |
---|
1335 | clusters[0][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_false_int_cmd_in[0][y][WEST][k]); |
---|
1336 | clusters[0][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_false_int_cmd_out[0][y][WEST][k]); |
---|
1337 | clusters[XMAX-1][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_false_int_cmd_in[XMAX-1][y][EAST][k]); |
---|
1338 | clusters[XMAX-1][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_false_int_cmd_out[XMAX-1][y][EAST][k]); |
---|
1339 | } |
---|
1340 | |
---|
1341 | for (size_t k = 0; k < 2; k++) |
---|
1342 | { |
---|
1343 | clusters[0][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_false_int_rsp_in[0][y][WEST][k]); |
---|
1344 | clusters[0][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_false_int_rsp_out[0][y][WEST][k]); |
---|
1345 | clusters[XMAX-1][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_false_int_rsp_in[XMAX-1][y][EAST][k]); |
---|
1346 | clusters[XMAX-1][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_false_int_rsp_out[XMAX-1][y][EAST][k]); |
---|
1347 | } |
---|
1348 | |
---|
1349 | if( y == 0 ) // handling IOB to RAM network connection in cluster_iob0 |
---|
1350 | { |
---|
1351 | (*clusters[0][0]->p_dspin_iob_cmd_out) (signal_dspin_cmd_iob0_loopback); |
---|
1352 | clusters[0][0]->p_dspin_ram_cmd_in[WEST] (signal_dspin_cmd_iob0_loopback); |
---|
1353 | |
---|
1354 | clusters[0][0]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][0][WEST]); |
---|
1355 | clusters[0][0]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][0][WEST]); |
---|
1356 | |
---|
1357 | clusters[0][0]->p_dspin_ram_rsp_out[WEST] (signal_dspin_rsp_iob0_loopback); |
---|
1358 | (*clusters[0][0]->p_dspin_iob_rsp_in) (signal_dspin_rsp_iob0_loopback); |
---|
1359 | |
---|
1360 | } |
---|
1361 | else |
---|
1362 | { |
---|
1363 | clusters[0][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_false_ram_cmd_in[0][y][WEST]); |
---|
1364 | clusters[0][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][y][WEST]); |
---|
1365 | clusters[0][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][y][WEST]); |
---|
1366 | clusters[0][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_false_ram_rsp_out[0][y][WEST]); |
---|
1367 | } |
---|
1368 | |
---|
1369 | if( (y == YMAX-1) and (cluster_iob0 != cluster_iob1) ) // handling IOB to RAM network connection in cluster_iob1 |
---|
1370 | { |
---|
1371 | (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_cmd_out) (signal_dspin_cmd_iob1_loopback); |
---|
1372 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_in[EAST] (signal_dspin_cmd_iob1_loopback); |
---|
1373 | |
---|
1374 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][YMAX-1][EAST]); |
---|
1375 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][YMAX-1][EAST]); |
---|
1376 | |
---|
1377 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_out[EAST] (signal_dspin_rsp_iob1_loopback); |
---|
1378 | (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_rsp_in) (signal_dspin_rsp_iob1_loopback); |
---|
1379 | } |
---|
1380 | else |
---|
1381 | { |
---|
1382 | clusters[XMAX-1][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_false_ram_cmd_in[XMAX-1][y][EAST]); |
---|
1383 | clusters[XMAX-1][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][y][EAST]); |
---|
1384 | clusters[XMAX-1][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][y][EAST]); |
---|
1385 | clusters[XMAX-1][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_false_ram_rsp_out[XMAX-1][y][EAST]); |
---|
1386 | } |
---|
1387 | } |
---|
1388 | |
---|
1389 | std::cout << "East & West boundaries established" << std::endl; |
---|
1390 | |
---|
1391 | // North & South boundary clusters connections |
---|
1392 | for (size_t x = 0; x < XMAX; x++) |
---|
1393 | { |
---|
1394 | for (size_t k = 0; k < 3; k++) |
---|
1395 | { |
---|
1396 | clusters[x][0]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_false_int_cmd_in[x][0][SOUTH][k]); |
---|
1397 | clusters[x][0]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_false_int_cmd_out[x][0][SOUTH][k]); |
---|
1398 | clusters[x][YMAX-1]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_false_int_cmd_in[x][YMAX-1][NORTH][k]); |
---|
1399 | clusters[x][YMAX-1]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_false_int_cmd_out[x][YMAX-1][NORTH][k]); |
---|
1400 | } |
---|
1401 | |
---|
1402 | for (size_t k = 0; k < 2; k++) |
---|
1403 | { |
---|
1404 | clusters[x][0]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_false_int_rsp_in[x][0][SOUTH][k]); |
---|
1405 | clusters[x][0]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_false_int_rsp_out[x][0][SOUTH][k]); |
---|
1406 | clusters[x][YMAX-1]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_false_int_rsp_in[x][YMAX-1][NORTH][k]); |
---|
1407 | clusters[x][YMAX-1]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_false_int_rsp_out[x][YMAX-1][NORTH][k]); |
---|
1408 | } |
---|
1409 | |
---|
1410 | clusters[x][0]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_false_ram_cmd_in[x][0][SOUTH]); |
---|
1411 | clusters[x][0]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_false_ram_cmd_out[x][0][SOUTH]); |
---|
1412 | clusters[x][0]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_false_ram_rsp_in[x][0][SOUTH]); |
---|
1413 | clusters[x][0]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_false_ram_rsp_out[x][0][SOUTH]); |
---|
1414 | |
---|
1415 | clusters[x][YMAX-1]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_false_ram_cmd_in[x][YMAX-1][NORTH]); |
---|
1416 | clusters[x][YMAX-1]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_false_ram_cmd_out[x][YMAX-1][NORTH]); |
---|
1417 | clusters[x][YMAX-1]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_false_ram_rsp_in[x][YMAX-1][NORTH]); |
---|
1418 | clusters[x][YMAX-1]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_false_ram_rsp_out[x][YMAX-1][NORTH]); |
---|
1419 | } |
---|
1420 | |
---|
1421 | std::cout << "North & South boundaries established" << std::endl << std::endl; |
---|
1422 | |
---|
1423 | //////////////////////////////////////////////////////// |
---|
1424 | // Simulation |
---|
1425 | /////////////////////////////////////////////////////// |
---|
1426 | |
---|
1427 | sc_start(sc_core::sc_time(0, SC_NS)); |
---|
1428 | |
---|
1429 | signal_resetn = false; |
---|
1430 | |
---|
1431 | signal_irq_false = false; |
---|
1432 | |
---|
1433 | // only one cluster case: |
---|
1434 | if ( cluster_iob0 == cluster_iob1 ) |
---|
1435 | { |
---|
1436 | signal_vci_ini_iob1.cmdval = false; |
---|
1437 | signal_vci_ini_iob1.rspack = true; |
---|
1438 | signal_vci_tgt_iob1.cmdack = true; |
---|
1439 | signal_vci_tgt_iob1.rspval = false; |
---|
1440 | } |
---|
1441 | |
---|
1442 | // network boundaries signals |
---|
1443 | for (size_t x = 0; x < XMAX ; x++) |
---|
1444 | { |
---|
1445 | for (size_t y = 0; y < YMAX ; y++) |
---|
1446 | { |
---|
1447 | for (size_t a = 0; a < 4; a++) |
---|
1448 | { |
---|
1449 | for (size_t k = 0; k < 3; k++) |
---|
1450 | { |
---|
1451 | signal_dspin_false_int_cmd_in[x][y][a][k].write = false; |
---|
1452 | signal_dspin_false_int_cmd_in[x][y][a][k].read = true; |
---|
1453 | signal_dspin_false_int_cmd_out[x][y][a][k].write = false; |
---|
1454 | signal_dspin_false_int_cmd_out[x][y][a][k].read = true; |
---|
1455 | } |
---|
1456 | |
---|
1457 | for (size_t k = 0; k < 2; k++) |
---|
1458 | { |
---|
1459 | signal_dspin_false_int_rsp_in[x][y][a][k].write = false; |
---|
1460 | signal_dspin_false_int_rsp_in[x][y][a][k].read = true; |
---|
1461 | signal_dspin_false_int_rsp_out[x][y][a][k].write = false; |
---|
1462 | signal_dspin_false_int_rsp_out[x][y][a][k].read = true; |
---|
1463 | } |
---|
1464 | |
---|
1465 | signal_dspin_false_ram_cmd_in[x][y][a].write = false; |
---|
1466 | signal_dspin_false_ram_cmd_in[x][y][a].read = true; |
---|
1467 | signal_dspin_false_ram_cmd_out[x][y][a].write = false; |
---|
1468 | signal_dspin_false_ram_cmd_out[x][y][a].read = true; |
---|
1469 | |
---|
1470 | signal_dspin_false_ram_rsp_in[x][y][a].write = false; |
---|
1471 | signal_dspin_false_ram_rsp_in[x][y][a].read = true; |
---|
1472 | signal_dspin_false_ram_rsp_out[x][y][a].write = false; |
---|
1473 | signal_dspin_false_ram_rsp_out[x][y][a].read = true; |
---|
1474 | } |
---|
1475 | } |
---|
1476 | } |
---|
1477 | |
---|
1478 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
1479 | signal_resetn = true; |
---|
1480 | |
---|
1481 | |
---|
1482 | // simulation loop |
---|
1483 | struct timeval t1,t2; |
---|
1484 | gettimeofday(&t1, NULL); |
---|
1485 | |
---|
1486 | for (size_t n = 1; n < ncycles; n++) |
---|
1487 | { |
---|
1488 | // stats display |
---|
1489 | if( (n % 5000000) == 0) |
---|
1490 | { |
---|
1491 | gettimeofday(&t2, NULL); |
---|
1492 | |
---|
1493 | uint64_t ms1 = (uint64_t) t1.tv_sec * 1000ULL + |
---|
1494 | (uint64_t) t1.tv_usec / 1000; |
---|
1495 | uint64_t ms2 = (uint64_t) t2.tv_sec * 1000ULL + |
---|
1496 | (uint64_t) t2.tv_usec / 1000; |
---|
1497 | std::cerr << "platform clock frequency " |
---|
1498 | << (double) 5000000 / (double) (ms2 - ms1) << "Khz" |
---|
1499 | << std::endl; |
---|
1500 | |
---|
1501 | gettimeofday(&t1, NULL); |
---|
1502 | } |
---|
1503 | |
---|
1504 | // Monitor a specific address for one L1 cache |
---|
1505 | // clusters[1][1]->proc[0]->cache_monitor(0x50090ULL); |
---|
1506 | |
---|
1507 | // Monitor a specific address for one L2 cache |
---|
1508 | // clusters[0][0]->memc->cache_monitor( 0x170000ULL); |
---|
1509 | |
---|
1510 | // Monitor a specific address for one XRAM |
---|
1511 | // if (n == 3000000) clusters[0][0]->xram->start_monitor( 0x170000ULL , 64); |
---|
1512 | |
---|
1513 | if (debug_ok and (n > debug_from) and (n % debug_period == 0)) |
---|
1514 | { |
---|
1515 | std::cout << "****************** cycle " << std::dec << n ; |
---|
1516 | std::cout << " ************************************************" << std::endl; |
---|
1517 | |
---|
1518 | // trace proc[debug_proc_id] |
---|
1519 | if ( debug_proc_id != 0xFFFFFFFF ) |
---|
1520 | { |
---|
1521 | size_t l = debug_proc_id % NB_PROCS_MAX ; |
---|
1522 | size_t cluster_xy = debug_proc_id / NB_PROCS_MAX ; |
---|
1523 | size_t x = cluster_xy >> 4; |
---|
1524 | size_t y = cluster_xy & 0xF; |
---|
1525 | |
---|
1526 | clusters[x][y]->proc[l]->print_trace(1); |
---|
1527 | |
---|
1528 | std::ostringstream proc_signame; |
---|
1529 | proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; |
---|
1530 | clusters[x][y]->signal_int_vci_ini_proc[l].print_trace(proc_signame.str()); |
---|
1531 | |
---|
1532 | clusters[x][y]->xicu->print_trace(l); |
---|
1533 | |
---|
1534 | std::ostringstream xicu_signame; |
---|
1535 | xicu_signame << "[SIG]XICU_" << x << "_" << y; |
---|
1536 | clusters[x][y]->signal_int_vci_tgt_xicu.print_trace(xicu_signame.str()); |
---|
1537 | |
---|
1538 | if( clusters[x][y]->signal_proc_it[l].read() ) |
---|
1539 | std::cout << "### IRQ_PROC_" << std::dec |
---|
1540 | << x << "_" << y << "_" << l << " ACTIVE" << std::endl; |
---|
1541 | } |
---|
1542 | |
---|
1543 | // trace INT network |
---|
1544 | // clusters[0][0]->int_xbar_cmd_d->print_trace(); |
---|
1545 | // clusters[0][0]->int_xbar_rsp_d->print_trace(); |
---|
1546 | |
---|
1547 | // clusters[0][0]->signal_int_dspin_cmd_l2g_d.print_trace("[SIG] INT_CMD_L2G_D_0_0"); |
---|
1548 | // clusters[0][0]->signal_int_dspin_rsp_g2l_d.print_trace("[SIG] INT_RSP_G2L_D_0_0"); |
---|
1549 | |
---|
1550 | // clusters[0][0]->int_router_cmd->print_trace(0); |
---|
1551 | // clusters[0][0]->int_router_rsp->print_trace(0); |
---|
1552 | |
---|
1553 | // trace INT_CMD_D xbar and router in cluster 0_1 |
---|
1554 | // clusters[0][1]->int_router_cmd->print_trace(0); |
---|
1555 | // clusters[0][1]->int_router_rsp->print_trace(0); |
---|
1556 | |
---|
1557 | // clusters[0][1]->signal_int_dspin_cmd_g2l_d.print_trace("[SIG] INT_CMD_G2L_D_0_0"); |
---|
1558 | // clusters[0][1]->signal_int_dspin_rsp_l2g_d.print_trace("[SIG] INT_RSP_L2G_D_0_0"); |
---|
1559 | |
---|
1560 | // clusters[0][1]->int_xbar_cmd_d->print_trace(); |
---|
1561 | // clusters[0][1]->int_xbar_rsp_d->print_trace(); |
---|
1562 | |
---|
1563 | // trace memc[debug_memc_id] |
---|
1564 | if ( debug_memc_id != 0xFFFFFFFF ) |
---|
1565 | { |
---|
1566 | size_t x = debug_memc_id >> 4; |
---|
1567 | size_t y = debug_memc_id & 0xF; |
---|
1568 | |
---|
1569 | clusters[x][y]->memc->print_trace(0); |
---|
1570 | std::ostringstream smemc_tgt; |
---|
1571 | smemc_tgt << "[SIG]MEMC_TGT_" << x << "_" << y; |
---|
1572 | clusters[x][y]->signal_int_vci_tgt_memc.print_trace(smemc_tgt.str()); |
---|
1573 | std::ostringstream smemc_ini; |
---|
1574 | smemc_ini << "[SIG]MEMC_INI_" << x << "_" << y; |
---|
1575 | clusters[x][y]->signal_ram_vci_ini_memc.print_trace(smemc_ini.str()); |
---|
1576 | |
---|
1577 | clusters[x][y]->xram->print_trace(); |
---|
1578 | std::ostringstream sxram_tgt; |
---|
1579 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; |
---|
1580 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); |
---|
1581 | } |
---|
1582 | |
---|
1583 | |
---|
1584 | // trace XRAM and XRAM network routers in cluster[debug_xram_id] |
---|
1585 | if ( debug_xram_id != 0xFFFFFFFF ) |
---|
1586 | { |
---|
1587 | size_t x = debug_xram_id >> 4; |
---|
1588 | size_t y = debug_xram_id & 0xF; |
---|
1589 | |
---|
1590 | clusters[x][y]->xram->print_trace(); |
---|
1591 | std::ostringstream sxram_tgt; |
---|
1592 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; |
---|
1593 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); |
---|
1594 | |
---|
1595 | clusters[x][y]->ram_router_cmd->print_trace(); |
---|
1596 | clusters[x][y]->ram_router_rsp->print_trace(); |
---|
1597 | } |
---|
1598 | |
---|
1599 | // trace iob, iox and external peripherals |
---|
1600 | if ( debug_iob ) |
---|
1601 | { |
---|
1602 | clusters[0][0]->iob->print_trace(); |
---|
1603 | clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT"); |
---|
1604 | clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI"); |
---|
1605 | clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( "[SIG]IOB0_RAM_INI"); |
---|
1606 | |
---|
1607 | signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI"); |
---|
1608 | signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT"); |
---|
1609 | |
---|
1610 | // signal_dspin_cmd_iob0_loopback.print_trace("[SIG]IOB0_CMD_LOOPBACK"); |
---|
1611 | // signal_dspin_rsp_iob0_loopback.print_trace("[SIG]IOB0_RSP_LOOPBACK"); |
---|
1612 | |
---|
1613 | // cdma->print_trace(); |
---|
1614 | // signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT"); |
---|
1615 | // signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI"); |
---|
1616 | |
---|
1617 | brom->print_trace(); |
---|
1618 | signal_vci_tgt_brom.print_trace("[SIG]IOX_BROM_TGT"); |
---|
1619 | |
---|
1620 | // mtty->print_trace(); |
---|
1621 | // signal_vci_tgt_mtty.print_trace("[SIG]IOX_MTTY_TGT"); |
---|
1622 | |
---|
1623 | bdev->print_trace(); |
---|
1624 | signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT"); |
---|
1625 | signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI"); |
---|
1626 | |
---|
1627 | // fbuf->print_trace(); |
---|
1628 | // signal_vci_tgt_fbuf.print_trace("[SIG]FBUF"); |
---|
1629 | |
---|
1630 | iopi->print_trace(); |
---|
1631 | signal_vci_ini_iopi.print_trace("[SIG]IOPI_INI"); |
---|
1632 | signal_vci_tgt_iopi.print_trace("[SIG]IOPI_TGT"); |
---|
1633 | iox_network->print_trace(); |
---|
1634 | |
---|
1635 | // interrupts |
---|
1636 | if (signal_irq_bdev) std::cout << "### IRQ_BDEV ACTIVE" << std::endl; |
---|
1637 | if (signal_irq_mtty_rx[0]) std::cout << "### IRQ_MTTY ACTIVE" << std::endl; |
---|
1638 | } |
---|
1639 | } |
---|
1640 | |
---|
1641 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
1642 | } |
---|
1643 | return EXIT_SUCCESS; |
---|
1644 | } |
---|
1645 | |
---|
1646 | int sc_main (int argc, char *argv[]) |
---|
1647 | { |
---|
1648 | try { |
---|
1649 | return _main(argc, argv); |
---|
1650 | } catch (std::exception &e) { |
---|
1651 | std::cout << e.what() << std::endl; |
---|
1652 | } catch (...) { |
---|
1653 | std::cout << "Unknown exception occured" << std::endl; |
---|
1654 | throw; |
---|
1655 | } |
---|
1656 | return 1; |
---|
1657 | } |
---|
1658 | |
---|
1659 | |
---|
1660 | // Local Variables: |
---|
1661 | // tab-width: 3 |
---|
1662 | // c-basic-offset: 3 |
---|
1663 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
1664 | // indent-tabs-mode: nil |
---|
1665 | // End: |
---|
1666 | |
---|
1667 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 |
---|
1668 | |
---|
1669 | |
---|
1670 | |
---|