[345] | 1 | ////////////////////////////////////////////////////////////////////////////// |
---|
[378] | 2 | // File: tsar_xbar_cluster.cpp |
---|
[428] | 3 | // Author: Alain Greiner |
---|
[345] | 4 | // Copyright: UPMC/LIP6 |
---|
| 5 | // Date : march 2011 |
---|
| 6 | // This program is released under the GNU public license |
---|
| 7 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 8 | // This file define a TSAR cluster architecture with virtual memory: |
---|
[428] | 9 | // - It uses two virtual_dspin_router as distributed global interconnect |
---|
| 10 | // - It uses four dspin_local_crossbar as local interconnect |
---|
[345] | 11 | // - It uses the vci_cc_vcache_wrapper |
---|
| 12 | // - It uses the vci_mem_cache |
---|
| 13 | // - It contains a private RAM with a variable latency to emulate the L3 cache |
---|
| 14 | // - It can contains 1, 2 or 4 processors |
---|
| 15 | // - Each processor has a private dma channel (vci_multi_dma) |
---|
| 16 | // - It uses the vci_xicu interrupt controller |
---|
[396] | 17 | // - The peripherals MTTY, BDEV, FBUF, MNIC and BROM are in cluster (0,0) |
---|
[428] | 18 | // - The Multi-TTY component controls up to 15 terminals. |
---|
[345] | 19 | // - Each Multi-DMA component controls up to 8 DMA channels. |
---|
| 20 | // - The DMA IRQs are connected to IRQ_IN[8]...IRQ_IN[15] |
---|
| 21 | // - The TTY IRQs are connected to IRQ_IN[16]...IRQ_IN[30] |
---|
| 22 | // - The BDEV IRQ is connected to IRQ_IN[31] |
---|
[428] | 23 | ////////////////////////////////////////////////////////////////////////////////// |
---|
[345] | 24 | |
---|
[378] | 25 | #include "../include/tsar_xbar_cluster.h" |
---|
[345] | 26 | |
---|
[389] | 27 | |
---|
[345] | 28 | namespace soclib { |
---|
| 29 | namespace caba { |
---|
| 30 | |
---|
[396] | 31 | //////////////////////////////////////////////////////////////////////////////////// |
---|
[428] | 32 | template<size_t dspin_cmd_width, |
---|
[396] | 33 | size_t dspin_rsp_width, |
---|
| 34 | typename vci_param_int, |
---|
| 35 | typename vci_param_ext> TsarXbarCluster<dspin_cmd_width, |
---|
| 36 | dspin_rsp_width, |
---|
| 37 | vci_param_int, |
---|
| 38 | vci_param_ext>::TsarXbarCluster( |
---|
| 39 | //////////////////////////////////////////////////////////////////////////////////// |
---|
[345] | 40 | sc_module_name insname, |
---|
| 41 | size_t nb_procs, |
---|
| 42 | size_t nb_ttys, |
---|
| 43 | size_t nb_dmas, |
---|
| 44 | size_t x_id, |
---|
| 45 | size_t y_id, |
---|
| 46 | size_t cluster_id, |
---|
| 47 | const soclib::common::MappingTable &mtd, |
---|
[428] | 48 | const soclib::common::MappingTable &mtx, |
---|
[345] | 49 | size_t x_width, |
---|
| 50 | size_t y_width, |
---|
| 51 | size_t l_width, |
---|
[1023] | 52 | size_t p_width, |
---|
[345] | 53 | size_t tgtid_memc, |
---|
| 54 | size_t tgtid_xicu, |
---|
| 55 | size_t tgtid_mdma, |
---|
| 56 | size_t tgtid_fbuf, |
---|
| 57 | size_t tgtid_mtty, |
---|
| 58 | size_t tgtid_brom, |
---|
| 59 | size_t tgtid_mnic, |
---|
[475] | 60 | size_t tgtid_chbuf, |
---|
[345] | 61 | size_t tgtid_bdev, |
---|
[547] | 62 | size_t tgtid_simh, |
---|
[345] | 63 | size_t memc_ways, |
---|
| 64 | size_t memc_sets, |
---|
| 65 | size_t l1_i_ways, |
---|
| 66 | size_t l1_i_sets, |
---|
| 67 | size_t l1_d_ways, |
---|
| 68 | size_t l1_d_sets, |
---|
[706] | 69 | size_t irq_per_processor, |
---|
[345] | 70 | size_t xram_latency, |
---|
| 71 | bool io, |
---|
| 72 | size_t xfb, |
---|
| 73 | size_t yfb, |
---|
| 74 | char* disk_name, |
---|
| 75 | size_t block_size, |
---|
| 76 | size_t nic_channels, |
---|
| 77 | char* nic_rx_name, |
---|
| 78 | char* nic_tx_name, |
---|
| 79 | uint32_t nic_timeout, |
---|
[485] | 80 | size_t chbufdma_channels, |
---|
[706] | 81 | const Loader & loader, |
---|
[345] | 82 | uint32_t frozen_cycles, |
---|
| 83 | uint32_t debug_start_cycle, |
---|
| 84 | bool memc_debug_ok, |
---|
| 85 | bool proc_debug_ok) |
---|
| 86 | : soclib::caba::BaseModule(insname), |
---|
| 87 | p_clk("clk"), |
---|
[1023] | 88 | p_resetn("resetn") { |
---|
[345] | 89 | |
---|
[508] | 90 | n_procs = nb_procs; |
---|
| 91 | |
---|
[885] | 92 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 93 | // Vectors of ports definition and allocation |
---|
| 94 | ///////////////////////////////////////////////////////////////////////////// |
---|
[345] | 95 | |
---|
[885] | 96 | p_cmd_in = alloc_elems<DspinInput<dspin_cmd_width> > ("p_cmd_in", 4); |
---|
| 97 | p_cmd_out = alloc_elems<DspinOutput<dspin_cmd_width> > ("p_cmd_out", 4); |
---|
| 98 | |
---|
| 99 | p_rsp_in = alloc_elems<DspinInput<dspin_rsp_width> > ("p_rsp_in", 4); |
---|
| 100 | p_rsp_out = alloc_elems<DspinOutput<dspin_rsp_width> > ("p_rsp_out", 4); |
---|
| 101 | |
---|
| 102 | p_m2p_in = alloc_elems<DspinInput<dspin_cmd_width> > ("p_m2p_in", 4); |
---|
| 103 | p_m2p_out = alloc_elems<DspinOutput<dspin_cmd_width> > ("p_m2p_out", 4); |
---|
| 104 | |
---|
| 105 | p_p2m_in = alloc_elems<DspinInput<dspin_rsp_width> > ("p_p2m_in", 4); |
---|
| 106 | p_p2m_out = alloc_elems<DspinOutput<dspin_rsp_width> > ("p_p2m_out", 4); |
---|
| 107 | |
---|
| 108 | p_cla_in = alloc_elems<DspinInput<dspin_cmd_width> > ("p_cla_in", 4); |
---|
| 109 | p_cla_out = alloc_elems<DspinOutput<dspin_cmd_width> > ("p_cla_out", 4); |
---|
| 110 | |
---|
[396] | 111 | ///////////////////////////////////////////////////////////////////////////// |
---|
[428] | 112 | // Components definition |
---|
[345] | 113 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 114 | |
---|
[1023] | 115 | for (size_t p = 0; p < nb_procs; p++) { |
---|
[345] | 116 | std::ostringstream sproc; |
---|
[396] | 117 | sproc << "proc_" << x_id << "_" << y_id << "_" << p; |
---|
| 118 | proc[p] = new VciCcVCacheWrapper<vci_param_int, |
---|
| 119 | dspin_cmd_width, |
---|
[428] | 120 | dspin_rsp_width, |
---|
[396] | 121 | GdbServer<Mips32ElIss> >( |
---|
[345] | 122 | sproc.str().c_str(), |
---|
[1023] | 123 | (cluster_id << p_width) + p, // GLOBAL PROC_ID |
---|
[428] | 124 | mtd, // Mapping Table |
---|
[1023] | 125 | IntTab(cluster_id, p), // SRCID |
---|
[345] | 126 | (cluster_id << l_width) + p, // CC_GLOBAL_ID |
---|
| 127 | 8, // ITLB ways |
---|
| 128 | 8, // ITLB sets |
---|
| 129 | 8, // DTLB ways |
---|
| 130 | 8, // DTLB sets |
---|
[508] | 131 | l1_i_ways,l1_i_sets, 16, // ICACHE size |
---|
| 132 | l1_d_ways,l1_d_sets, 16, // DCACHE size |
---|
[345] | 133 | 4, // WBUF nlines |
---|
| 134 | 4, // WBUF nwords |
---|
| 135 | x_width, |
---|
| 136 | y_width, |
---|
| 137 | frozen_cycles, // max frozen cycles |
---|
| 138 | debug_start_cycle, |
---|
| 139 | proc_debug_ok); |
---|
| 140 | |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | ///////////////////////////////////////////////////////////////////////////// |
---|
[396] | 144 | std::ostringstream smemc; |
---|
| 145 | smemc << "memc_" << x_id << "_" << y_id; |
---|
| 146 | memc = new VciMemCache<vci_param_int, |
---|
| 147 | vci_param_ext, |
---|
| 148 | dspin_rsp_width, |
---|
| 149 | dspin_cmd_width>( |
---|
| 150 | smemc.str().c_str(), |
---|
[345] | 151 | mtd, // Mapping Table direct space |
---|
| 152 | mtx, // Mapping Table external space |
---|
| 153 | IntTab(cluster_id), // SRCID external space |
---|
| 154 | IntTab(cluster_id, tgtid_memc), // TGTID direct space |
---|
[504] | 155 | x_width, // Number of x bits in platform |
---|
| 156 | y_width, // Number of y bits in platform |
---|
[345] | 157 | memc_ways, memc_sets, 16, // CACHE SIZE |
---|
| 158 | 3, // MAX NUMBER OF COPIES |
---|
| 159 | 4096, // HEAP SIZE |
---|
| 160 | 8, // TRANSACTION TABLE DEPTH |
---|
| 161 | 8, // UPDATE TABLE DEPTH |
---|
[468] | 162 | 8, // INVALIDATE TABLE DEPTH |
---|
[345] | 163 | debug_start_cycle, |
---|
[508] | 164 | memc_debug_ok); |
---|
[345] | 165 | |
---|
| 166 | |
---|
| 167 | ///////////////////////////////////////////////////////////////////////////// |
---|
[396] | 168 | std::ostringstream sxram; |
---|
| 169 | sxram << "xram_" << x_id << "_" << y_id; |
---|
| 170 | xram = new VciSimpleRam<vci_param_ext>( |
---|
| 171 | sxram.str().c_str(), |
---|
[345] | 172 | IntTab(cluster_id), |
---|
| 173 | mtx, |
---|
| 174 | loader, |
---|
| 175 | xram_latency); |
---|
[379] | 176 | |
---|
[345] | 177 | ///////////////////////////////////////////////////////////////////////////// |
---|
[396] | 178 | std::ostringstream sxicu; |
---|
| 179 | sxicu << "xicu_" << x_id << "_" << y_id; |
---|
| 180 | xicu = new VciXicu<vci_param_int>( |
---|
| 181 | sxicu.str().c_str(), |
---|
[345] | 182 | mtd, // mapping table |
---|
| 183 | IntTab(cluster_id, tgtid_xicu), // TGTID_D |
---|
[706] | 184 | nb_procs, // number of timer IRQs |
---|
[345] | 185 | 32, // number of hard IRQs |
---|
[389] | 186 | 32, // number of soft IRQs |
---|
[885] | 187 | nb_procs * irq_per_processor); // number of output IRQs |
---|
[345] | 188 | |
---|
| 189 | |
---|
| 190 | ///////////////////////////////////////////////////////////////////////////// |
---|
[396] | 191 | std::ostringstream smdma; |
---|
| 192 | smdma << "mdma_" << x_id << "_" << y_id; |
---|
| 193 | mdma = new VciMultiDma<vci_param_int>( |
---|
| 194 | smdma.str().c_str(), |
---|
[345] | 195 | mtd, |
---|
| 196 | IntTab(cluster_id, nb_procs), // SRCID |
---|
| 197 | IntTab(cluster_id, tgtid_mdma), // TGTID |
---|
| 198 | 64, // burst size |
---|
[379] | 199 | nb_dmas); // number of IRQs |
---|
[345] | 200 | |
---|
| 201 | |
---|
| 202 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 203 | size_t nb_direct_initiators = nb_procs + 1; |
---|
| 204 | size_t nb_direct_targets = 3; |
---|
[1023] | 205 | if (io) { |
---|
[475] | 206 | nb_direct_initiators = nb_procs + 3; |
---|
[547] | 207 | nb_direct_targets = 10; |
---|
[345] | 208 | } |
---|
| 209 | |
---|
[706] | 210 | std::ostringstream sxbar; |
---|
| 211 | sxbar << "xbar_" << x_id << "_" << y_id; |
---|
| 212 | xbar_d = new VciLocalCrossbar<vci_param_int>( |
---|
| 213 | sxbar.str().c_str(), |
---|
| 214 | mtd, // mapping table |
---|
| 215 | //x_id, y_id, // cluster coordinates |
---|
| 216 | cluster_id, |
---|
| 217 | nb_direct_initiators, // number of local of sources |
---|
| 218 | nb_direct_targets, // number of local dests |
---|
| 219 | tgtid_memc); // Default target |
---|
[345] | 220 | |
---|
[706] | 221 | ////////////// vci_dspin wrappers |
---|
| 222 | std::ostringstream swtxbar; |
---|
| 223 | swtxbar << "wt_xbar_" << x_id << "_" << y_id; |
---|
| 224 | wt_xbar_d = new VciDspinTargetWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>( |
---|
| 225 | swtxbar.str().c_str(), |
---|
[836] | 226 | x_width + y_width + l_width); |
---|
[345] | 227 | |
---|
[706] | 228 | std::ostringstream swixbar; |
---|
| 229 | swixbar << "wi_xbar_" << x_id << "_" << y_id; |
---|
| 230 | wi_xbar_d = new VciDspinInitiatorWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>( |
---|
| 231 | swixbar.str().c_str(), |
---|
| 232 | x_width + y_width + l_width ); |
---|
| 233 | |
---|
[345] | 234 | ///////////////////////////////////////////////////////////////////////////// |
---|
[396] | 235 | xbar_m2p_c = new DspinLocalCrossbar<dspin_cmd_width>( |
---|
[379] | 236 | "xbar_m2p_c", |
---|
[345] | 237 | mtd, // mapping table |
---|
| 238 | x_id, y_id, // cluster coordinates |
---|
| 239 | x_width, y_width, l_width, |
---|
| 240 | 1, // number of local sources |
---|
[435] | 241 | nb_procs, // number of local targets |
---|
[428] | 242 | 2, 2, // fifo depths |
---|
[435] | 243 | true, // CMD |
---|
[345] | 244 | false, // don't use local routing table |
---|
[435] | 245 | true ); // broadcast |
---|
[345] | 246 | |
---|
| 247 | ///////////////////////////////////////////////////////////////////////////// |
---|
[396] | 248 | xbar_p2m_c = new DspinLocalCrossbar<dspin_rsp_width>( |
---|
[379] | 249 | "xbar_p2m_c", |
---|
[345] | 250 | mtd, // mapping table |
---|
| 251 | x_id, y_id, // cluster coordinates |
---|
[379] | 252 | x_width, y_width, 0, // l_width unused on p2m network |
---|
[345] | 253 | nb_procs, // number of local sources |
---|
| 254 | 1, // number of local dests |
---|
[428] | 255 | 2, 2, // fifo depths |
---|
[435] | 256 | false, // RSP |
---|
[345] | 257 | false, // don't use local routing table |
---|
[435] | 258 | false ); // no broadcast |
---|
[345] | 259 | |
---|
| 260 | ///////////////////////////////////////////////////////////////////////////// |
---|
[468] | 261 | xbar_clack_c = new DspinLocalCrossbar<dspin_cmd_width>( |
---|
| 262 | "xbar_clack_c", |
---|
| 263 | mtd, // mapping table |
---|
| 264 | x_id, y_id, // cluster coordinates |
---|
| 265 | x_width, y_width, l_width, |
---|
| 266 | 1, // number of local sources |
---|
| 267 | nb_procs, // number of local targets |
---|
| 268 | 1, 1, // fifo depths |
---|
| 269 | true, // CMD |
---|
| 270 | false, // don't use local routing table |
---|
| 271 | false); // broadcast |
---|
| 272 | |
---|
| 273 | ///////////////////////////////////////////////////////////////////////////// |
---|
[885] | 274 | std::ostringstream s_router_cmd; |
---|
| 275 | s_router_cmd << "router_cmd_" << x_id << "_" << y_id; |
---|
| 276 | router_cmd = new DspinRouter<dspin_cmd_width>( |
---|
| 277 | s_router_cmd.str().c_str(), |
---|
[345] | 278 | x_id,y_id, // coordinate in the mesh |
---|
| 279 | x_width, y_width, // x & y fields width |
---|
| 280 | 4,4); // input & output fifo depths |
---|
| 281 | |
---|
| 282 | ///////////////////////////////////////////////////////////////////////////// |
---|
[885] | 283 | std::ostringstream s_router_rsp; |
---|
| 284 | s_router_rsp << "router_rsp_" << x_id << "_" << y_id; |
---|
| 285 | router_rsp = new DspinRouter<dspin_rsp_width>( |
---|
| 286 | s_router_rsp.str().c_str(), |
---|
[345] | 287 | x_id,y_id, // coordinates in mesh |
---|
| 288 | x_width, y_width, // x & y fields width |
---|
| 289 | 4,4); // input & output fifo depths |
---|
| 290 | |
---|
[885] | 291 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 292 | std::ostringstream s_router_m2p; |
---|
| 293 | s_router_m2p << "router_m2p_" << x_id << "_" << y_id; |
---|
| 294 | router_m2p = new DspinRouter<dspin_cmd_width>( |
---|
| 295 | s_router_m2p.str().c_str(), |
---|
| 296 | x_id,y_id, // coordinate in the mesh |
---|
| 297 | x_width, y_width, // x & y fields width |
---|
| 298 | 4,4, // input & output fifo depths |
---|
| 299 | true); // broadcast supported |
---|
| 300 | |
---|
| 301 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 302 | std::ostringstream s_router_p2m; |
---|
| 303 | s_router_p2m << "router_p2m_" << x_id << "_" << y_id; |
---|
| 304 | router_p2m = new DspinRouter<dspin_rsp_width>( |
---|
| 305 | s_router_p2m.str().c_str(), |
---|
| 306 | x_id,y_id, // coordinates in mesh |
---|
| 307 | x_width, y_width, // x & y fields width |
---|
| 308 | 4,4); // input & output fifo depths |
---|
| 309 | |
---|
| 310 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 311 | std::ostringstream s_router_cla; |
---|
| 312 | s_router_cla << "router_cla_" << x_id << "_" << y_id; |
---|
| 313 | router_cla = new DspinRouter<dspin_cmd_width>( |
---|
| 314 | s_router_cla.str().c_str(), |
---|
| 315 | x_id,y_id, // coordinate in the mesh |
---|
| 316 | x_width, y_width, // x & y fields width |
---|
| 317 | 4,4); // input & output fifo depths |
---|
| 318 | |
---|
[345] | 319 | // IO cluster components |
---|
[1023] | 320 | if (io) { |
---|
[345] | 321 | ///////////////////////////////////////////// |
---|
[435] | 322 | brom = new VciSimpleRom<vci_param_int>( |
---|
[396] | 323 | "brom", |
---|
| 324 | IntTab(cluster_id, tgtid_brom), |
---|
| 325 | mtd, |
---|
| 326 | loader); |
---|
[345] | 327 | |
---|
| 328 | ///////////////////////////////////////////// |
---|
[396] | 329 | fbuf = new VciFrameBuffer<vci_param_int>( |
---|
| 330 | "fbuf", |
---|
| 331 | IntTab(cluster_id, tgtid_fbuf), |
---|
| 332 | mtd, |
---|
[428] | 333 | xfb, yfb); |
---|
[345] | 334 | |
---|
| 335 | ///////////////////////////////////////////// |
---|
[396] | 336 | bdev = new VciBlockDeviceTsar<vci_param_int>( |
---|
| 337 | "bdev", |
---|
| 338 | mtd, |
---|
[508] | 339 | IntTab(cluster_id, nb_procs + 1), |
---|
[396] | 340 | IntTab(cluster_id, tgtid_bdev), |
---|
| 341 | disk_name, |
---|
| 342 | block_size, |
---|
| 343 | 64); // burst size |
---|
[345] | 344 | |
---|
[548] | 345 | int mac = 0xBEEF0000; |
---|
| 346 | mnic = new VciMultiNic<vci_param_int>( |
---|
| 347 | "mnic", |
---|
| 348 | IntTab(cluster_id, tgtid_mnic), |
---|
| 349 | mtd, |
---|
| 350 | nic_channels, |
---|
[619] | 351 | mac, // mac_4 address |
---|
| 352 | 0xBABE, // mac_2 address |
---|
[548] | 353 | nic_rx_name, |
---|
[619] | 354 | nic_tx_name); |
---|
[345] | 355 | |
---|
| 356 | |
---|
[706] | 357 | |
---|
[345] | 358 | ///////////////////////////////////////////// |
---|
[475] | 359 | chbuf = new VciChbufDma<vci_param_int>( |
---|
| 360 | "chbuf_dma", |
---|
| 361 | mtd, |
---|
| 362 | IntTab(cluster_id, nb_procs + 2), |
---|
| 363 | IntTab(cluster_id, tgtid_chbuf), |
---|
| 364 | 64, |
---|
[485] | 365 | chbufdma_channels); |
---|
[475] | 366 | |
---|
| 367 | ///////////////////////////////////////////// |
---|
[345] | 368 | std::vector<std::string> vect_names; |
---|
[1023] | 369 | for (size_t tid = 0; tid < nb_ttys; tid++) { |
---|
[345] | 370 | std::ostringstream term_name; |
---|
| 371 | term_name << "term" << tid; |
---|
| 372 | vect_names.push_back(term_name.str().c_str()); |
---|
| 373 | } |
---|
[396] | 374 | mtty = new VciMultiTty<vci_param_int>( |
---|
| 375 | "mtty", |
---|
| 376 | IntTab(cluster_id, tgtid_mtty), |
---|
[428] | 377 | mtd, |
---|
[396] | 378 | vect_names); |
---|
[345] | 379 | |
---|
[547] | 380 | simhelper = new VciSimhelper<vci_param_int>( |
---|
| 381 | "sim_helper", |
---|
| 382 | IntTab(cluster_id, tgtid_simh), |
---|
| 383 | mtd); |
---|
[345] | 384 | } |
---|
| 385 | |
---|
| 386 | //////////////////////////////////// |
---|
| 387 | // Connections are defined here |
---|
| 388 | //////////////////////////////////// |
---|
| 389 | |
---|
[885] | 390 | //////////////////////// ROUTERS |
---|
| 391 | router_cmd->p_clk (this->p_clk); |
---|
| 392 | router_cmd->p_resetn (this->p_resetn); |
---|
| 393 | router_rsp->p_clk (this->p_clk); |
---|
| 394 | router_rsp->p_resetn (this->p_resetn); |
---|
| 395 | router_m2p->p_clk (this->p_clk); |
---|
| 396 | router_m2p->p_resetn (this->p_resetn); |
---|
| 397 | router_p2m->p_clk (this->p_clk); |
---|
| 398 | router_p2m->p_resetn (this->p_resetn); |
---|
| 399 | router_cla->p_clk (this->p_clk); |
---|
| 400 | router_cla->p_resetn (this->p_resetn); |
---|
[465] | 401 | |
---|
[885] | 402 | // loop on N/S/E/W ports |
---|
[1023] | 403 | for (size_t i = 0; i < 4; i++) { |
---|
[885] | 404 | router_cmd->p_out[i] (this->p_cmd_out[i]); |
---|
| 405 | router_cmd->p_in[i] (this->p_cmd_in[i]); |
---|
[468] | 406 | |
---|
[885] | 407 | router_rsp->p_out[i] (this->p_rsp_out[i]); |
---|
| 408 | router_rsp->p_in[i] (this->p_rsp_in[i]); |
---|
| 409 | |
---|
| 410 | router_m2p->p_out[i] (this->p_m2p_out[i]); |
---|
| 411 | router_m2p->p_in[i] (this->p_m2p_in[i]); |
---|
| 412 | |
---|
| 413 | router_p2m->p_out[i] (this->p_p2m_out[i]); |
---|
| 414 | router_p2m->p_in[i] (this->p_p2m_in[i]); |
---|
| 415 | |
---|
| 416 | router_cla->p_out[i] (this->p_cla_out[i]); |
---|
| 417 | router_cla->p_in[i] (this->p_cla_in[i]); |
---|
[345] | 418 | } |
---|
| 419 | |
---|
[885] | 420 | router_cmd->p_out[4] (signal_dspin_cmd_g2l_d); |
---|
| 421 | router_cmd->p_in[4] (signal_dspin_cmd_l2g_d); |
---|
[345] | 422 | |
---|
[885] | 423 | router_rsp->p_out[4] (signal_dspin_rsp_g2l_d); |
---|
| 424 | router_rsp->p_in[4] (signal_dspin_rsp_l2g_d); |
---|
[345] | 425 | |
---|
[885] | 426 | router_m2p->p_out[4] (signal_dspin_m2p_g2l_c); |
---|
| 427 | router_m2p->p_in[4] (signal_dspin_m2p_l2g_c); |
---|
[468] | 428 | |
---|
[885] | 429 | router_p2m->p_out[4] (signal_dspin_p2m_g2l_c); |
---|
| 430 | router_p2m->p_in[4] (signal_dspin_p2m_l2g_c); |
---|
[345] | 431 | |
---|
[885] | 432 | router_cla->p_out[4] (signal_dspin_clack_g2l_c); |
---|
| 433 | router_cla->p_in[4] (signal_dspin_clack_l2g_c); |
---|
| 434 | |
---|
| 435 | std::cout << " - routers connected" << std::endl; |
---|
| 436 | |
---|
[706] | 437 | wi_xbar_d->p_clk (this->p_clk); |
---|
| 438 | wi_xbar_d->p_resetn (this->p_resetn); |
---|
| 439 | wi_xbar_d->p_vci (signal_vci_l2g_d); |
---|
| 440 | wi_xbar_d->p_dspin_cmd (signal_dspin_cmd_l2g_d); |
---|
| 441 | wi_xbar_d->p_dspin_rsp (signal_dspin_rsp_g2l_d); |
---|
[345] | 442 | |
---|
[706] | 443 | std::cout << " - Wrapper Ini VCI2DSPIN Direct connected" << std::endl; |
---|
[345] | 444 | |
---|
[706] | 445 | wt_xbar_d->p_clk (this->p_clk); |
---|
| 446 | wt_xbar_d->p_resetn (this->p_resetn); |
---|
| 447 | wt_xbar_d->p_vci (signal_vci_g2l_d); |
---|
| 448 | wt_xbar_d->p_dspin_cmd (signal_dspin_cmd_g2l_d); |
---|
| 449 | wt_xbar_d->p_dspin_rsp (signal_dspin_rsp_l2g_d); |
---|
[345] | 450 | |
---|
[706] | 451 | std::cout << " - Wrapper Tgt VCI2DSPIN Direct connected" << std::endl; |
---|
[345] | 452 | |
---|
[706] | 453 | ///////////////////// CMD VCI local crossbar direct |
---|
| 454 | xbar_d->p_clk (this->p_clk); |
---|
| 455 | xbar_d->p_resetn (this->p_resetn); |
---|
| 456 | xbar_d->p_target_to_up (signal_vci_g2l_d); |
---|
| 457 | xbar_d->p_initiator_to_up (signal_vci_l2g_d); |
---|
[345] | 458 | |
---|
[706] | 459 | xbar_d->p_to_target[tgtid_memc] (signal_vci_tgt_memc); |
---|
| 460 | xbar_d->p_to_target[tgtid_xicu] (signal_vci_tgt_xicu); |
---|
| 461 | xbar_d->p_to_target[tgtid_mdma] (signal_vci_tgt_mdma); |
---|
[345] | 462 | |
---|
[706] | 463 | xbar_d->p_to_initiator[nb_procs] (signal_vci_ini_mdma); |
---|
[345] | 464 | |
---|
[1023] | 465 | for (size_t p = 0; p < nb_procs; p++) { |
---|
[706] | 466 | xbar_d->p_to_initiator[p] (signal_vci_ini_proc[p]); |
---|
[1023] | 467 | } |
---|
[345] | 468 | |
---|
[1023] | 469 | if (io) { |
---|
[706] | 470 | xbar_d->p_to_target[tgtid_mtty] (signal_vci_tgt_mtty); |
---|
| 471 | xbar_d->p_to_target[tgtid_brom] (signal_vci_tgt_brom); |
---|
| 472 | xbar_d->p_to_target[tgtid_bdev] (signal_vci_tgt_bdev); |
---|
| 473 | xbar_d->p_to_target[tgtid_fbuf] (signal_vci_tgt_fbuf); |
---|
| 474 | xbar_d->p_to_target[tgtid_mnic] (signal_vci_tgt_mnic); |
---|
| 475 | xbar_d->p_to_target[tgtid_chbuf] (signal_vci_tgt_chbuf); |
---|
| 476 | xbar_d->p_to_target[tgtid_simh] (signal_vci_tgt_simh); |
---|
[345] | 477 | |
---|
[706] | 478 | xbar_d->p_to_initiator[nb_procs + 1] (signal_vci_ini_bdev); |
---|
| 479 | xbar_d->p_to_initiator[nb_procs + 2] (signal_vci_ini_chbuf); |
---|
[345] | 480 | } |
---|
| 481 | |
---|
[706] | 482 | std::cout << " - Direct crossbar connected" << std::endl; |
---|
[345] | 483 | |
---|
| 484 | ////////////////////// M2P DSPIN local crossbar coherence |
---|
| 485 | xbar_m2p_c->p_clk (this->p_clk); |
---|
| 486 | xbar_m2p_c->p_resetn (this->p_resetn); |
---|
| 487 | xbar_m2p_c->p_global_out (signal_dspin_m2p_l2g_c); |
---|
| 488 | xbar_m2p_c->p_global_in (signal_dspin_m2p_g2l_c); |
---|
[360] | 489 | xbar_m2p_c->p_local_in[0] (signal_dspin_m2p_memc); |
---|
[1023] | 490 | for (size_t p = 0; p < nb_procs; p++) { |
---|
[345] | 491 | xbar_m2p_c->p_local_out[p] (signal_dspin_m2p_proc[p]); |
---|
[1023] | 492 | } |
---|
[345] | 493 | |
---|
| 494 | std::cout << " - M2P Coherence crossbar connected" << std::endl; |
---|
| 495 | |
---|
[468] | 496 | ////////////////////// CLACK DSPIN local crossbar coherence |
---|
| 497 | xbar_clack_c->p_clk (this->p_clk); |
---|
| 498 | xbar_clack_c->p_resetn (this->p_resetn); |
---|
| 499 | xbar_clack_c->p_global_out (signal_dspin_clack_l2g_c); |
---|
| 500 | xbar_clack_c->p_global_in (signal_dspin_clack_g2l_c); |
---|
| 501 | xbar_clack_c->p_local_in[0] (signal_dspin_clack_memc); |
---|
[1023] | 502 | for (size_t p = 0; p < nb_procs; p++) { |
---|
[508] | 503 | xbar_clack_c->p_local_out[p] (signal_dspin_clack_proc[p]); |
---|
[1023] | 504 | } |
---|
[468] | 505 | |
---|
| 506 | std::cout << " - Clack Coherence crossbar connected" << std::endl; |
---|
| 507 | |
---|
[345] | 508 | ////////////////////////// P2M DSPIN local crossbar coherence |
---|
| 509 | xbar_p2m_c->p_clk (this->p_clk); |
---|
| 510 | xbar_p2m_c->p_resetn (this->p_resetn); |
---|
| 511 | xbar_p2m_c->p_global_out (signal_dspin_p2m_l2g_c); |
---|
| 512 | xbar_p2m_c->p_global_in (signal_dspin_p2m_g2l_c); |
---|
[360] | 513 | xbar_p2m_c->p_local_out[0] (signal_dspin_p2m_memc); |
---|
[1023] | 514 | for (size_t p = 0; p < nb_procs; p++) { |
---|
[345] | 515 | xbar_p2m_c->p_local_in[p] (signal_dspin_p2m_proc[p]); |
---|
[1023] | 516 | } |
---|
[345] | 517 | |
---|
| 518 | std::cout << " - P2M Coherence crossbar connected" << std::endl; |
---|
| 519 | |
---|
| 520 | |
---|
| 521 | //////////////////////////////////// Processors |
---|
[1023] | 522 | for (size_t p = 0; p < nb_procs; p++) { |
---|
[345] | 523 | proc[p]->p_clk (this->p_clk); |
---|
| 524 | proc[p]->p_resetn (this->p_resetn); |
---|
| 525 | proc[p]->p_vci (signal_vci_ini_proc[p]); |
---|
[468] | 526 | proc[p]->p_dspin_m2p (signal_dspin_m2p_proc[p]); |
---|
| 527 | proc[p]->p_dspin_p2m (signal_dspin_p2m_proc[p]); |
---|
| 528 | proc[p]->p_dspin_clack (signal_dspin_clack_proc[p]); |
---|
[624] | 529 | |
---|
[1023] | 530 | for ( size_t i = 0; i < irq_per_processor; i++) { |
---|
[706] | 531 | proc[p]->p_irq[i] (signal_proc_it[p*irq_per_processor + i]); |
---|
[624] | 532 | } |
---|
[1023] | 533 | for ( size_t j = irq_per_processor; j < 6; j++) { |
---|
| 534 | // 6 = number of irqs in the MIPS |
---|
[345] | 535 | proc[p]->p_irq[j] (signal_false); |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | } |
---|
| 539 | |
---|
| 540 | std::cout << " - Processors connected" << std::endl; |
---|
| 541 | |
---|
| 542 | ///////////////////////////////////// XICU |
---|
[428] | 543 | xicu->p_clk (this->p_clk); |
---|
| 544 | xicu->p_resetn (this->p_resetn); |
---|
| 545 | xicu->p_vci (signal_vci_tgt_xicu); |
---|
[1023] | 546 | for (size_t p = 0; p < nb_procs * irq_per_processor; p++) { |
---|
[706] | 547 | xicu->p_irq[p] (signal_proc_it[p]); |
---|
[345] | 548 | } |
---|
[1023] | 549 | for (size_t i = 0; i < 32; i++) { |
---|
| 550 | if (io) { |
---|
| 551 | // I/O cluster |
---|
[345] | 552 | if (i < 8) xicu->p_hwi[i] (signal_false); |
---|
[508] | 553 | else if (i < (8 + nb_dmas)) xicu->p_hwi[i] (signal_irq_mdma[i - 8]); |
---|
[345] | 554 | else if (i < 16) xicu->p_hwi[i] (signal_false); |
---|
[508] | 555 | else if (i < (16 + nb_ttys)) xicu->p_hwi[i] (signal_irq_mtty[i - 16]); |
---|
[602] | 556 | else if (i < 30) xicu->p_hwi[i] (signal_false); |
---|
| 557 | else if (i < 31) xicu->p_hwi[i] (signal_irq_memc); |
---|
[345] | 558 | else xicu->p_hwi[i] (signal_irq_bdev); |
---|
| 559 | } |
---|
[1023] | 560 | else { |
---|
| 561 | // other clusters |
---|
[345] | 562 | if (i < 8) xicu->p_hwi[i] (signal_false); |
---|
[508] | 563 | else if (i < (8 + nb_dmas)) xicu->p_hwi[i] (signal_irq_mdma[i - 8]); |
---|
[602] | 564 | else if (i < 30) xicu->p_hwi[i] (signal_false); |
---|
| 565 | else if (i < 31) xicu->p_hwi[i] (signal_irq_memc); |
---|
[428] | 566 | else xicu->p_hwi[i] (signal_false); |
---|
[345] | 567 | } |
---|
| 568 | } |
---|
| 569 | |
---|
| 570 | std::cout << " - XICU connected" << std::endl; |
---|
| 571 | |
---|
| 572 | //////////////////////////////////////////////// MEMC |
---|
[428] | 573 | memc->p_clk (this->p_clk); |
---|
| 574 | memc->p_resetn (this->p_resetn); |
---|
[602] | 575 | memc->p_irq (signal_irq_memc); |
---|
[428] | 576 | memc->p_vci_ixr (signal_vci_xram); |
---|
| 577 | memc->p_vci_tgt (signal_vci_tgt_memc); |
---|
[468] | 578 | memc->p_dspin_p2m (signal_dspin_p2m_memc); |
---|
| 579 | memc->p_dspin_m2p (signal_dspin_m2p_memc); |
---|
| 580 | memc->p_dspin_clack (signal_dspin_clack_memc); |
---|
[345] | 581 | |
---|
| 582 | std::cout << " - MEMC connected" << std::endl; |
---|
| 583 | |
---|
| 584 | /////////////////////////////////////////////// XRAM |
---|
[428] | 585 | xram->p_clk (this->p_clk); |
---|
| 586 | xram->p_resetn (this->p_resetn); |
---|
| 587 | xram->p_vci (signal_vci_xram); |
---|
[345] | 588 | |
---|
| 589 | std::cout << " - XRAM connected" << std::endl; |
---|
| 590 | |
---|
[360] | 591 | ////////////////////////////////////////////// MDMA |
---|
[428] | 592 | mdma->p_clk (this->p_clk); |
---|
| 593 | mdma->p_resetn (this->p_resetn); |
---|
| 594 | mdma->p_vci_target (signal_vci_tgt_mdma); |
---|
| 595 | mdma->p_vci_initiator (signal_vci_ini_mdma); |
---|
[1023] | 596 | for (size_t i = 0; i < nb_dmas; i++) { |
---|
[345] | 597 | mdma->p_irq[i] (signal_irq_mdma[i]); |
---|
[1023] | 598 | } |
---|
[345] | 599 | |
---|
| 600 | std::cout << " - MDMA connected" << std::endl; |
---|
| 601 | |
---|
[428] | 602 | /////////////////////////////// Components in I/O cluster |
---|
[345] | 603 | |
---|
[1023] | 604 | if (io) { |
---|
[428] | 605 | // BDEV |
---|
| 606 | bdev->p_clk (this->p_clk); |
---|
[345] | 607 | bdev->p_resetn (this->p_resetn); |
---|
| 608 | bdev->p_irq (signal_irq_bdev); |
---|
| 609 | bdev->p_vci_target (signal_vci_tgt_bdev); |
---|
| 610 | bdev->p_vci_initiator (signal_vci_ini_bdev); |
---|
| 611 | |
---|
| 612 | std::cout << " - BDEV connected" << std::endl; |
---|
| 613 | |
---|
| 614 | // FBUF |
---|
| 615 | fbuf->p_clk (this->p_clk); |
---|
| 616 | fbuf->p_resetn (this->p_resetn); |
---|
| 617 | fbuf->p_vci (signal_vci_tgt_fbuf); |
---|
| 618 | |
---|
| 619 | std::cout << " - FBUF connected" << std::endl; |
---|
| 620 | |
---|
| 621 | // MNIC |
---|
| 622 | mnic->p_clk (this->p_clk); |
---|
| 623 | mnic->p_resetn (this->p_resetn); |
---|
| 624 | mnic->p_vci (signal_vci_tgt_mnic); |
---|
[1023] | 625 | for (size_t i = 0; i < nic_channels; i++) { |
---|
[548] | 626 | mnic->p_rx_irq[i] (signal_irq_mnic_rx[i]); |
---|
| 627 | mnic->p_tx_irq[i] (signal_irq_mnic_tx[i]); |
---|
[345] | 628 | } |
---|
| 629 | |
---|
| 630 | std::cout << " - MNIC connected" << std::endl; |
---|
| 631 | |
---|
[475] | 632 | // CHBUF |
---|
| 633 | chbuf->p_clk (this->p_clk); |
---|
| 634 | chbuf->p_resetn (this->p_resetn); |
---|
| 635 | chbuf->p_vci_target (signal_vci_tgt_chbuf); |
---|
| 636 | chbuf->p_vci_initiator (signal_vci_ini_chbuf); |
---|
[1023] | 637 | for (size_t i = 0; i < chbufdma_channels; i++) { |
---|
[475] | 638 | chbuf->p_irq[i] (signal_irq_chbuf[i]); |
---|
| 639 | } |
---|
| 640 | |
---|
| 641 | std::cout << " - CHBUF connected" << std::endl; |
---|
| 642 | |
---|
[345] | 643 | // BROM |
---|
| 644 | brom->p_clk (this->p_clk); |
---|
| 645 | brom->p_resetn (this->p_resetn); |
---|
| 646 | brom->p_vci (signal_vci_tgt_brom); |
---|
| 647 | |
---|
| 648 | std::cout << " - BROM connected" << std::endl; |
---|
| 649 | |
---|
| 650 | // MTTY |
---|
| 651 | mtty->p_clk (this->p_clk); |
---|
| 652 | mtty->p_resetn (this->p_resetn); |
---|
| 653 | mtty->p_vci (signal_vci_tgt_mtty); |
---|
[1023] | 654 | for (size_t i = 0; i < nb_ttys; i++) { |
---|
[428] | 655 | mtty->p_irq[i] (signal_irq_mtty[i]); |
---|
[345] | 656 | } |
---|
| 657 | |
---|
[706] | 658 | std::cout << " - MTTY connected" << std::endl; |
---|
[360] | 659 | |
---|
[547] | 660 | |
---|
| 661 | // Sim Helper |
---|
| 662 | simhelper->p_clk (this->p_clk); |
---|
| 663 | simhelper->p_resetn (this->p_resetn); |
---|
| 664 | simhelper->p_vci (signal_vci_tgt_simh); |
---|
| 665 | |
---|
[706] | 666 | std::cout << " - SIMH connected" << std::endl; |
---|
[345] | 667 | } |
---|
| 668 | } // end constructor |
---|
| 669 | |
---|
[508] | 670 | |
---|
| 671 | |
---|
| 672 | template<size_t dspin_cmd_width, |
---|
| 673 | size_t dspin_rsp_width, |
---|
| 674 | typename vci_param_int, |
---|
| 675 | typename vci_param_ext> TsarXbarCluster<dspin_cmd_width, |
---|
| 676 | dspin_rsp_width, |
---|
| 677 | vci_param_int, |
---|
| 678 | vci_param_ext>::~TsarXbarCluster() { |
---|
| 679 | |
---|
[885] | 680 | dealloc_elems<DspinInput<dspin_cmd_width> > (p_cmd_in, 4); |
---|
| 681 | dealloc_elems<DspinOutput<dspin_cmd_width> >(p_cmd_out, 4); |
---|
[512] | 682 | |
---|
[885] | 683 | dealloc_elems<DspinInput<dspin_rsp_width> > (p_rsp_in, 4); |
---|
| 684 | dealloc_elems<DspinOutput<dspin_rsp_width> >(p_rsp_out, 4); |
---|
| 685 | |
---|
| 686 | dealloc_elems<DspinInput<dspin_cmd_width> > (p_m2p_in, 4); |
---|
| 687 | dealloc_elems<DspinOutput<dspin_cmd_width> >(p_m2p_out, 4); |
---|
| 688 | |
---|
| 689 | dealloc_elems<DspinInput<dspin_rsp_width> > (p_p2m_in, 4); |
---|
| 690 | dealloc_elems<DspinOutput<dspin_rsp_width> >(p_p2m_out, 4); |
---|
| 691 | |
---|
| 692 | dealloc_elems<DspinInput<dspin_cmd_width> > (p_cla_in, 4); |
---|
| 693 | dealloc_elems<DspinOutput<dspin_cmd_width> >(p_cla_out, 4); |
---|
| 694 | |
---|
[1023] | 695 | for (size_t p = 0; p < n_procs; p++) { |
---|
[508] | 696 | delete proc[p]; |
---|
| 697 | } |
---|
| 698 | |
---|
| 699 | delete memc; |
---|
| 700 | delete xram; |
---|
| 701 | delete xicu; |
---|
| 702 | delete mdma; |
---|
[706] | 703 | delete xbar_d; |
---|
| 704 | delete wt_xbar_d; |
---|
| 705 | delete wi_xbar_d; |
---|
[508] | 706 | delete xbar_m2p_c; |
---|
| 707 | delete xbar_p2m_c; |
---|
| 708 | delete xbar_clack_c; |
---|
| 709 | delete router_cmd; |
---|
| 710 | delete router_rsp; |
---|
[1023] | 711 | if (brom != NULL) { |
---|
[508] | 712 | delete brom; |
---|
| 713 | delete fbuf; |
---|
| 714 | delete bdev; |
---|
| 715 | delete mnic; |
---|
| 716 | delete chbuf; |
---|
| 717 | delete mtty; |
---|
[547] | 718 | delete simhelper; |
---|
[508] | 719 | } |
---|
| 720 | } |
---|
| 721 | |
---|
| 722 | |
---|
[752] | 723 | template<size_t dspin_cmd_width, |
---|
| 724 | size_t dspin_rsp_width, |
---|
| 725 | typename vci_param_int, |
---|
| 726 | typename vci_param_ext> |
---|
| 727 | void TsarXbarCluster<dspin_cmd_width, |
---|
| 728 | dspin_rsp_width, |
---|
| 729 | vci_param_int, |
---|
| 730 | vci_param_ext>::trace(sc_core::sc_trace_file * tf, const std::string & name) { |
---|
| 731 | |
---|
| 732 | #define __trace(x) sc_core::sc_trace(tf, x, name + "_" + #x) |
---|
| 733 | __trace(signal_vci_l2g_d); |
---|
| 734 | __trace(signal_vci_g2l_d); |
---|
| 735 | __trace(signal_vci_tgt_memc); |
---|
| 736 | __trace(signal_vci_tgt_xicu); |
---|
| 737 | __trace(signal_vci_tgt_mdma); |
---|
| 738 | __trace(signal_vci_ini_mdma); |
---|
| 739 | |
---|
| 740 | for (size_t p = 0; p < n_procs; p++) { |
---|
| 741 | std::ostringstream signame; |
---|
| 742 | signame << "vci_ini_proc_" << p; |
---|
| 743 | sc_core::sc_trace(tf, signal_vci_ini_proc[p], signame.str()); |
---|
| 744 | } |
---|
| 745 | __trace(signal_vci_tgt_mtty); |
---|
| 746 | __trace(signal_vci_tgt_brom); |
---|
| 747 | __trace(signal_vci_tgt_bdev); |
---|
| 748 | __trace(signal_vci_tgt_fbuf); |
---|
| 749 | __trace(signal_vci_tgt_simh); |
---|
| 750 | __trace(signal_vci_ini_bdev); |
---|
| 751 | __trace(signal_vci_tgt_memc); |
---|
| 752 | __trace(signal_vci_xram); |
---|
| 753 | #undef trace |
---|
| 754 | |
---|
| 755 | } |
---|
| 756 | |
---|
[396] | 757 | }} |
---|
[345] | 758 | |
---|
| 759 | // Local Variables: |
---|
[508] | 760 | // tab-width: 4 |
---|
| 761 | // c-basic-offset: 4 |
---|
[345] | 762 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 763 | // indent-tabs-mode: nil |
---|
| 764 | // End: |
---|
| 765 | |
---|
[508] | 766 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
[345] | 767 | |
---|