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