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