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