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