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