source: trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp @ 548

Last change on this file since 548 was 548, checked in by meunier, 10 years ago

Last commit contained unwanted local modifications; reverting them.

File size: 38.7 KB
RevLine 
[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]28namespace soclib {
29namespace caba  {
30
[396]31////////////////////////////////////////////////////////////////////////////////////
[428]32template<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,
68         size_t                             xram_latency,
69         bool                               io,
70         size_t                             xfb,
71         size_t                             yfb,
72         char*                              disk_name,
73         size_t                             block_size,
74         size_t                             nic_channels,
75         char*                              nic_rx_name,
76         char*                              nic_tx_name,
77         uint32_t                           nic_timeout,
[485]78         size_t                             chbufdma_channels,
[345]79         const Loader                      &loader,
80         uint32_t                           frozen_cycles,
81         uint32_t                           debug_start_cycle,
82         bool                               memc_debug_ok,
83         bool                               proc_debug_ok)
84            : soclib::caba::BaseModule(insname),
85            p_clk("clk"),
86            p_resetn("resetn")
87
88{
[508]89
90    n_procs = nb_procs;
91
[345]92    // Vectors of ports definition
[508]93    p_cmd_in  = alloc_elems<DspinInput<dspin_cmd_width> >  ("p_cmd_in",  4, 3);
94    p_cmd_out = alloc_elems<DspinOutput<dspin_cmd_width> > ("p_cmd_out", 4, 3);
95    p_rsp_in  = alloc_elems<DspinInput<dspin_rsp_width> >  ("p_rsp_in",  4, 2);
96    p_rsp_out = alloc_elems<DspinOutput<dspin_rsp_width> > ("p_rsp_out", 4, 2);
[345]97
[396]98    /////////////////////////////////////////////////////////////////////////////
[428]99    // Components definition
[345]100    /////////////////////////////////////////////////////////////////////////////
101
102    for (size_t p = 0; p < nb_procs; p++)
[428]103    {
[345]104        std::ostringstream sproc;
[396]105        sproc << "proc_" << x_id << "_" << y_id << "_" << p;
106        proc[p] = new VciCcVCacheWrapper<vci_param_int,
107                                         dspin_cmd_width,
[428]108                                         dspin_rsp_width,
[396]109                                         GdbServer<Mips32ElIss> >(
[345]110                      sproc.str().c_str(),
[508]111                      cluster_id * nb_procs + p,      // GLOBAL PROC_ID
[428]112                      mtd,                            // Mapping Table
[345]113                      IntTab(cluster_id,p),           // SRCID
114                      (cluster_id << l_width) + p,    // CC_GLOBAL_ID
115                      8,                              // ITLB ways
116                      8,                              // ITLB sets
117                      8,                              // DTLB ways
118                      8,                              // DTLB sets
[508]119                      l1_i_ways,l1_i_sets, 16,        // ICACHE size
120                      l1_d_ways,l1_d_sets, 16,        // DCACHE size
[345]121                      4,                              // WBUF nlines
122                      4,                              // WBUF nwords
123                      x_width,
124                      y_width,
125                      frozen_cycles,                  // max frozen cycles
126                      debug_start_cycle,
127                      proc_debug_ok);
128
129        std::ostringstream swip;
[435]130        swip << "wi_proc_" << x_id << "_" << y_id << "_" << p;
[396]131        wi_proc[p] = new VciDspinInitiatorWrapper<vci_param_int,
132                                                  dspin_cmd_width,
133                                                  dspin_rsp_width>(
[351]134                     swip.str().c_str(),
[363]135                     x_width + y_width + l_width);
[345]136    }
137
138    /////////////////////////////////////////////////////////////////////////////
[396]139    std::ostringstream smemc;
140    smemc << "memc_" << x_id << "_" << y_id;
141    memc = new VciMemCache<vci_param_int,
142                           vci_param_ext,
143                           dspin_rsp_width,
144                           dspin_cmd_width>(
145                     smemc.str().c_str(),
[345]146                     mtd,                                // Mapping Table direct space
147                     mtx,                                // Mapping Table external space
148                     IntTab(cluster_id),                 // SRCID external space
149                     IntTab(cluster_id, tgtid_memc),     // TGTID direct space
150                     (cluster_id << l_width) + nb_procs, // CC_GLOBAL_ID
[504]151                     x_width,                            // Number of x bits in platform
152                     y_width,                            // Number of y bits in platform
[345]153                     memc_ways, memc_sets, 16,           // CACHE SIZE
154                     3,                                  // MAX NUMBER OF COPIES
155                     4096,                               // HEAP SIZE
156                     8,                                  // TRANSACTION TABLE DEPTH
157                     8,                                  // UPDATE TABLE DEPTH
[468]158                     8,                                  // INVALIDATE TABLE DEPTH
[345]159                     debug_start_cycle,
[508]160                     memc_debug_ok);
[345]161
[396]162    wt_memc = new VciDspinTargetWrapper<vci_param_int,
163                                        dspin_cmd_width,
164                                        dspin_rsp_width>(
[379]165                     "wt_memc",
[363]166                     x_width + y_width + l_width);
[345]167
168    /////////////////////////////////////////////////////////////////////////////
[396]169    std::ostringstream sxram;
170    sxram << "xram_" << x_id << "_" << y_id;
171    xram = new VciSimpleRam<vci_param_ext>(
172                     sxram.str().c_str(),
[345]173                     IntTab(cluster_id),
174                     mtx,
175                     loader,
176                     xram_latency);
[379]177
[345]178    /////////////////////////////////////////////////////////////////////////////
[396]179    std::ostringstream sxicu;
180    sxicu << "xicu_" << x_id << "_" << y_id;
181    xicu = new VciXicu<vci_param_int>(
182                     sxicu.str().c_str(),
[345]183                     mtd,                               // mapping table
184                     IntTab(cluster_id, tgtid_xicu),    // TGTID_D
185                     nb_procs,                          // number of timer IRQs
186                     32,                                // number of hard IRQs
[389]187                     32,                                // number of soft IRQs
[345]188                     nb_procs);                         // number of output IRQs
189
[396]190    wt_xicu = new VciDspinTargetWrapper<vci_param_int,
191                                        dspin_cmd_width,
192                                        dspin_rsp_width>(
[379]193                     "wt_xicu",
[363]194                     x_width + y_width + l_width);
[345]195
196    /////////////////////////////////////////////////////////////////////////////
[396]197    std::ostringstream smdma;
198    smdma << "mdma_" << x_id << "_" << y_id;
199    mdma = new VciMultiDma<vci_param_int>(
200                     smdma.str().c_str(),
[345]201                     mtd,
202                     IntTab(cluster_id, nb_procs),        // SRCID
203                     IntTab(cluster_id, tgtid_mdma),      // TGTID
204                     64,                                  // burst size
[379]205                     nb_dmas);                            // number of IRQs
[345]206
[396]207    wt_mdma = new VciDspinTargetWrapper<vci_param_int,
208                                        dspin_cmd_width,
209                                        dspin_rsp_width>(
[379]210                     "wt_mdma",
[363]211                     x_width + y_width + l_width);
[345]212
[396]213    wi_mdma = new VciDspinInitiatorWrapper<vci_param_int,
214                                           dspin_cmd_width,
215                                           dspin_rsp_width>(
[379]216                     "wi_mdma",
[363]217                     x_width + y_width + l_width);
[345]218
219    /////////////////////////////////////////////////////////////////////////////
220    size_t nb_direct_initiators      = nb_procs + 1;
221    size_t nb_direct_targets         = 3;
[508]222    if (io)
[345]223    {
[475]224        nb_direct_initiators         = nb_procs + 3;
[547]225        nb_direct_targets            = 10;
[345]226    }
227
[396]228    xbar_cmd_d = new DspinLocalCrossbar<dspin_cmd_width>(
[379]229                     "xbar_cmd_d",
[345]230                     mtd,                          // mapping table
231                     x_id, y_id,                   // cluster coordinates
232                     x_width, y_width, l_width,
233                     nb_direct_initiators,         // number of local of sources
[435]234                     nb_direct_targets,            // number of local dests
235                     2, 2,                         // fifo depths 
236                     true,                         // CMD
237                     true,                         // use local routing table
238                     false );                      // no broadcast
[345]239
240    /////////////////////////////////////////////////////////////////////////////
[396]241    xbar_rsp_d = new DspinLocalCrossbar<dspin_rsp_width>(
[379]242                     "xbar_rsp_d",
[345]243                     mtd,                          // mapping table
244                     x_id, y_id,                   // cluster coordinates
245                     x_width, y_width, l_width,
[428]246                     nb_direct_targets,            // number of local sources
[345]247                     nb_direct_initiators,         // number of local dests
[435]248                     2, 2,                         // fifo depths 
249                     false,                        // RSP
250                     false,                        // don't use local routing table
251                     false );                      // no broadcast
[345]252
253    /////////////////////////////////////////////////////////////////////////////
[396]254    xbar_m2p_c = new DspinLocalCrossbar<dspin_cmd_width>(
[379]255                     "xbar_m2p_c",
[345]256                     mtd,                          // mapping table
257                     x_id, y_id,                   // cluster coordinates
258                     x_width, y_width, l_width,
259                     1,                            // number of local sources
[435]260                     nb_procs,                     // number of local targets
[428]261                     2, 2,                         // fifo depths
[435]262                     true,                         // CMD
[345]263                     false,                        // don't use local routing table
[435]264                     true );                       // broadcast
[345]265
266    /////////////////////////////////////////////////////////////////////////////
[396]267    xbar_p2m_c = new DspinLocalCrossbar<dspin_rsp_width>(
[379]268                     "xbar_p2m_c",
[345]269                     mtd,                          // mapping table
270                     x_id, y_id,                   // cluster coordinates
[379]271                     x_width, y_width, 0,          // l_width unused on p2m network
[345]272                     nb_procs,                     // number of local sources
273                     1,                            // number of local dests
[428]274                     2, 2,                         // fifo depths
[435]275                     false,                        // RSP
[345]276                     false,                        // don't use local routing table
[435]277                     false );                      // no broadcast
[345]278
279    /////////////////////////////////////////////////////////////////////////////
[468]280    xbar_clack_c = new DspinLocalCrossbar<dspin_cmd_width>(
281                     "xbar_clack_c",
282                     mtd,                          // mapping table
283                     x_id, y_id,                   // cluster coordinates
284                     x_width, y_width, l_width,
285                     1,                            // number of local sources
286                     nb_procs,                     // number of local targets
287                     1, 1,                         // fifo depths
288                     true,                         // CMD
289                     false,                        // don't use local routing table
290                     false);                       // broadcast
291
292    /////////////////////////////////////////////////////////////////////////////
[396]293    router_cmd = new VirtualDspinRouter<dspin_cmd_width>(
[379]294                     "router_cmd",
[345]295                     x_id,y_id,                    // coordinate in the mesh
296                     x_width, y_width,             // x & y fields width
[468]297                     3,                            // nb virtual channels
[345]298                     4,4);                         // input & output fifo depths
299
300    /////////////////////////////////////////////////////////////////////////////
[396]301    router_rsp = new VirtualDspinRouter<dspin_rsp_width>(
[379]302                     "router_rsp",
[345]303                     x_id,y_id,                    // coordinates in mesh
304                     x_width, y_width,             // x & y fields width
[465]305                     2,                            // nb virtual channels
[345]306                     4,4);                         // input & output fifo depths
307
308    // IO cluster components
[508]309    if (io)
[345]310    {
311        /////////////////////////////////////////////
[435]312        brom = new VciSimpleRom<vci_param_int>(
[396]313                     "brom",
314                     IntTab(cluster_id, tgtid_brom),
315                     mtd,
316                     loader);
[345]317
[396]318        wt_brom = new VciDspinTargetWrapper<vci_param_int,
319                                            dspin_cmd_width,
320                                            dspin_rsp_width>(
321                     "wt_brom",
[363]322                     x_width + y_width + l_width);
[345]323
324        /////////////////////////////////////////////
[396]325        fbuf = new VciFrameBuffer<vci_param_int>(
326                     "fbuf",
327                     IntTab(cluster_id, tgtid_fbuf),
328                     mtd,
[428]329                     xfb, yfb);
[345]330
[396]331        wt_fbuf = new VciDspinTargetWrapper<vci_param_int,
332                                            dspin_cmd_width,
333                                            dspin_rsp_width>(
334                     "wt_fbuf",
[363]335                     x_width + y_width + l_width);
[345]336
337        /////////////////////////////////////////////
[396]338        bdev = new VciBlockDeviceTsar<vci_param_int>(
339                     "bdev",
340                     mtd,
[508]341                     IntTab(cluster_id, nb_procs + 1),
[396]342                     IntTab(cluster_id, tgtid_bdev),
343                     disk_name,
344                     block_size,
345                     64);            // burst size
[345]346
[396]347        wt_bdev = new VciDspinTargetWrapper<vci_param_int,
348                                            dspin_cmd_width,
349                                            dspin_rsp_width>(
350                     "wt_bdev",
[363]351                     x_width + y_width + l_width);
[396]352
353        wi_bdev = new VciDspinInitiatorWrapper<vci_param_int,
354                                               dspin_cmd_width,
355                                               dspin_rsp_width>(
356                     "wi_bdev",
[363]357                     x_width + y_width + l_width);
[345]358
[548]359        int mac = 0xBEEF0000;
360        mnic = new VciMultiNic<vci_param_int>(
361                     "mnic",
362                     IntTab(cluster_id, tgtid_mnic),
363                     mtd,
364                     nic_channels,
365                     nic_rx_name,
366                     nic_tx_name,
367                     mac,             // mac_4 address
368                     0xBABE );           // mac_2 address
[345]369
[396]370        wt_mnic = new VciDspinTargetWrapper<vci_param_int,
371                                            dspin_cmd_width,
372                                            dspin_rsp_width>(
373                     "wt_mnic",
[363]374                     x_width + y_width + l_width);
[345]375
376        /////////////////////////////////////////////
[475]377        chbuf = new VciChbufDma<vci_param_int>(
378                     "chbuf_dma",
379                     mtd,
380                     IntTab(cluster_id, nb_procs + 2),
381                     IntTab(cluster_id, tgtid_chbuf),
382                     64,
[485]383                     chbufdma_channels); 
[475]384
385        wt_chbuf = new VciDspinTargetWrapper<vci_param_int,
386                                            dspin_cmd_width,
387                                            dspin_rsp_width>(
388                     "wt_chbuf",
389                     x_width + y_width + l_width);
390
391        wi_chbuf = new VciDspinInitiatorWrapper<vci_param_int,
392                                            dspin_cmd_width,
393                                            dspin_rsp_width>(
394                     "wi_chbuf",
395                     x_width + y_width + l_width);
396
397        /////////////////////////////////////////////
[345]398        std::vector<std::string> vect_names;
[508]399        for (size_t tid = 0; tid < nb_ttys; tid++)
[345]400        {
401            std::ostringstream term_name;
402            term_name <<  "term" << tid;
403            vect_names.push_back(term_name.str().c_str());
404        }
[396]405        mtty = new VciMultiTty<vci_param_int>(
406                     "mtty",
407                     IntTab(cluster_id, tgtid_mtty),
[428]408                     mtd,
[396]409                     vect_names);
[345]410
[396]411        wt_mtty = new VciDspinTargetWrapper<vci_param_int,
412                                            dspin_cmd_width,
413                                            dspin_rsp_width>(
414                     "wt_mtty",
[363]415                     x_width + y_width + l_width);
[547]416
417        simhelper = new VciSimhelper<vci_param_int>(
418                     "sim_helper",
419                     IntTab(cluster_id, tgtid_simh),
420                     mtd);
421
422        wt_simhelper = new VciDspinTargetWrapper<vci_param_int,
423                                                 dspin_cmd_width,
424                                                 dspin_rsp_width>(
425                     "wt_simhelper",
426                     x_width + y_width + l_width);
[345]427    }
428
429    ////////////////////////////////////
430    // Connections are defined here
431    ////////////////////////////////////
432
433    //////////////////////// CMD ROUTER and RSP ROUTER
434    router_cmd->p_clk                        (this->p_clk);
435    router_cmd->p_resetn                     (this->p_resetn);
436    router_rsp->p_clk                        (this->p_clk);
437    router_rsp->p_resetn                     (this->p_resetn);
[465]438
[508]439    for (int i = 0; i < 4; i++)
[345]440    {
[468]441        for (int k = 0; k < 3; k++)
[345]442        {
[465]443            router_cmd->p_out[i][k]          (this->p_cmd_out[i][k]);
444            router_cmd->p_in[i][k]           (this->p_cmd_in[i][k]);
[468]445        }
446
447        for (int k = 0; k < 2; k++)
448        {
[465]449            router_rsp->p_out[i][k]          (this->p_rsp_out[i][k]);
450            router_rsp->p_in[i][k]           (this->p_rsp_in[i][k]);
[345]451        }
452    }
453
[465]454    router_cmd->p_out[4][0]                  (signal_dspin_cmd_g2l_d);
455    router_cmd->p_out[4][1]                  (signal_dspin_m2p_g2l_c);
[468]456    router_cmd->p_out[4][2]                  (signal_dspin_clack_g2l_c);
[465]457    router_cmd->p_in[4][0]                   (signal_dspin_cmd_l2g_d);
458    router_cmd->p_in[4][1]                   (signal_dspin_m2p_l2g_c);
[468]459    router_cmd->p_in[4][2]                   (signal_dspin_clack_l2g_c);
[345]460
[465]461    router_rsp->p_out[4][0]                  (signal_dspin_rsp_g2l_d);
462    router_rsp->p_out[4][1]                  (signal_dspin_p2m_g2l_c);
463    router_rsp->p_in[4][0]                   (signal_dspin_rsp_l2g_d);
464    router_rsp->p_in[4][1]                   (signal_dspin_p2m_l2g_c);
[345]465
[468]466
[345]467    std::cout << "  - CMD & RSP routers connected" << std::endl;
468
469    ///////////////////// CMD DSPIN  local crossbar direct
470    xbar_cmd_d->p_clk                            (this->p_clk);
471    xbar_cmd_d->p_resetn                         (this->p_resetn);
472    xbar_cmd_d->p_global_out                     (signal_dspin_cmd_l2g_d);
473    xbar_cmd_d->p_global_in                      (signal_dspin_cmd_g2l_d);
474
475    xbar_cmd_d->p_local_out[tgtid_memc]          (signal_dspin_cmd_memc_t);
476    xbar_cmd_d->p_local_out[tgtid_xicu]          (signal_dspin_cmd_xicu_t);
477    xbar_cmd_d->p_local_out[tgtid_mdma]          (signal_dspin_cmd_mdma_t);
478
479    xbar_cmd_d->p_local_in[nb_procs]             (signal_dspin_cmd_mdma_i);
480
481    for (size_t p = 0; p < nb_procs; p++)
482        xbar_cmd_d->p_local_in[p]                (signal_dspin_cmd_proc_i[p]);
483
[508]484    if (io)
[345]485    {
486        xbar_cmd_d->p_local_out[tgtid_mtty]      (signal_dspin_cmd_mtty_t);
487        xbar_cmd_d->p_local_out[tgtid_brom]      (signal_dspin_cmd_brom_t);
488        xbar_cmd_d->p_local_out[tgtid_bdev]      (signal_dspin_cmd_bdev_t);
489        xbar_cmd_d->p_local_out[tgtid_fbuf]      (signal_dspin_cmd_fbuf_t);
490        xbar_cmd_d->p_local_out[tgtid_mnic]      (signal_dspin_cmd_mnic_t);
[508]491        xbar_cmd_d->p_local_out[tgtid_chbuf]     (signal_dspin_cmd_chbuf_t);
[547]492        xbar_cmd_d->p_local_out[tgtid_simh]      (signal_dspin_cmd_simh_t);
[345]493
[508]494        xbar_cmd_d->p_local_in[nb_procs + 1]     (signal_dspin_cmd_bdev_i);
495        xbar_cmd_d->p_local_in[nb_procs + 2]     (signal_dspin_cmd_chbuf_i);
[345]496    }
497
498    std::cout << "  - Command Direct crossbar connected" << std::endl;
499
500    //////////////////////// RSP DSPIN  local crossbar direct
501    xbar_rsp_d->p_clk                            (this->p_clk);
502    xbar_rsp_d->p_resetn                         (this->p_resetn);
503    xbar_rsp_d->p_global_out                     (signal_dspin_rsp_l2g_d);
504    xbar_rsp_d->p_global_in                      (signal_dspin_rsp_g2l_d);
505
506    xbar_rsp_d->p_local_in[tgtid_memc]           (signal_dspin_rsp_memc_t);
507    xbar_rsp_d->p_local_in[tgtid_xicu]           (signal_dspin_rsp_xicu_t);
508    xbar_rsp_d->p_local_in[tgtid_mdma]           (signal_dspin_rsp_mdma_t);
509
510    xbar_rsp_d->p_local_out[nb_procs]            (signal_dspin_rsp_mdma_i);
511
512    for (size_t p = 0; p < nb_procs; p++)
513        xbar_rsp_d->p_local_out[p]               (signal_dspin_rsp_proc_i[p]);
514
[508]515    if (io)
[345]516    {
517        xbar_rsp_d->p_local_in[tgtid_mtty]       (signal_dspin_rsp_mtty_t);
518        xbar_rsp_d->p_local_in[tgtid_brom]       (signal_dspin_rsp_brom_t);
519        xbar_rsp_d->p_local_in[tgtid_bdev]       (signal_dspin_rsp_bdev_t);
520        xbar_rsp_d->p_local_in[tgtid_fbuf]       (signal_dspin_rsp_fbuf_t);
521        xbar_rsp_d->p_local_in[tgtid_mnic]       (signal_dspin_rsp_mnic_t);
[508]522        xbar_rsp_d->p_local_in[tgtid_chbuf]      (signal_dspin_rsp_chbuf_t);
[547]523        xbar_rsp_d->p_local_in[tgtid_simh]       (signal_dspin_rsp_simh_t);
[345]524
[508]525        xbar_rsp_d->p_local_out[nb_procs + 1]    (signal_dspin_rsp_bdev_i);
526        xbar_rsp_d->p_local_out[nb_procs + 2]    (signal_dspin_rsp_chbuf_i);
[345]527    }
528
529    std::cout << "  - Response Direct crossbar connected" << std::endl;
530
531    ////////////////////// M2P DSPIN local crossbar coherence
532    xbar_m2p_c->p_clk                            (this->p_clk);
533    xbar_m2p_c->p_resetn                         (this->p_resetn);
534    xbar_m2p_c->p_global_out                     (signal_dspin_m2p_l2g_c);
535    xbar_m2p_c->p_global_in                      (signal_dspin_m2p_g2l_c);
[360]536    xbar_m2p_c->p_local_in[0]                    (signal_dspin_m2p_memc);
[428]537    for (size_t p = 0; p < nb_procs; p++)
[345]538        xbar_m2p_c->p_local_out[p]               (signal_dspin_m2p_proc[p]);
539
540    std::cout << "  - M2P Coherence crossbar connected" << std::endl;
541
[468]542    ////////////////////// CLACK DSPIN local crossbar coherence
543    xbar_clack_c->p_clk                          (this->p_clk);
544    xbar_clack_c->p_resetn                       (this->p_resetn);
545    xbar_clack_c->p_global_out                   (signal_dspin_clack_l2g_c);
546    xbar_clack_c->p_global_in                    (signal_dspin_clack_g2l_c);
547    xbar_clack_c->p_local_in[0]                  (signal_dspin_clack_memc);
548    for (size_t p = 0; p < nb_procs; p++)
[508]549        xbar_clack_c->p_local_out[p]             (signal_dspin_clack_proc[p]);
[468]550
551    std::cout << "  - Clack Coherence crossbar connected" << std::endl;
552
[345]553    ////////////////////////// P2M DSPIN local crossbar coherence
554    xbar_p2m_c->p_clk                            (this->p_clk);
555    xbar_p2m_c->p_resetn                         (this->p_resetn);
556    xbar_p2m_c->p_global_out                     (signal_dspin_p2m_l2g_c);
557    xbar_p2m_c->p_global_in                      (signal_dspin_p2m_g2l_c);
[360]558    xbar_p2m_c->p_local_out[0]                   (signal_dspin_p2m_memc);
[428]559    for (size_t p = 0; p < nb_procs; p++)
[345]560        xbar_p2m_c->p_local_in[p]                (signal_dspin_p2m_proc[p]);
561
562    std::cout << "  - P2M Coherence crossbar connected" << std::endl;
563
564
565    //////////////////////////////////// Processors
566    for (size_t p = 0; p < nb_procs; p++)
567    {
568        proc[p]->p_clk                      (this->p_clk);
569        proc[p]->p_resetn                   (this->p_resetn);
570        proc[p]->p_vci                      (signal_vci_ini_proc[p]);
[468]571        proc[p]->p_dspin_m2p                (signal_dspin_m2p_proc[p]);
572        proc[p]->p_dspin_p2m                (signal_dspin_p2m_proc[p]);
573        proc[p]->p_dspin_clack              (signal_dspin_clack_proc[p]);
[345]574        proc[p]->p_irq[0]                   (signal_proc_it[p]);
575        for ( size_t j = 1 ; j < 6 ; j++)
576        {
577            proc[p]->p_irq[j]               (signal_false);
578        }
579
580        wi_proc[p]->p_clk                   (this->p_clk);
581        wi_proc[p]->p_resetn                (this->p_resetn);
582        wi_proc[p]->p_dspin_cmd             (signal_dspin_cmd_proc_i[p]);
583        wi_proc[p]->p_dspin_rsp             (signal_dspin_rsp_proc_i[p]);
584        wi_proc[p]->p_vci                   (signal_vci_ini_proc[p]);
585    }
586
587    std::cout << "  - Processors connected" << std::endl;
588
589    ///////////////////////////////////// XICU
[428]590    xicu->p_clk                        (this->p_clk);
591    xicu->p_resetn                     (this->p_resetn);
592    xicu->p_vci                        (signal_vci_tgt_xicu);
[508]593    for (size_t p = 0; p < nb_procs; p++)
[345]594    {
[428]595        xicu->p_irq[p]                 (signal_proc_it[p]);
[345]596    }
[508]597    for (size_t i = 0; i < 32; i++)
[345]598    {
[508]599        if (io) // I/O cluster
[345]600        {
601            if      (i < 8)                  xicu->p_hwi[i] (signal_false);
[508]602            else if (i < (8 + nb_dmas))      xicu->p_hwi[i] (signal_irq_mdma[i - 8]);
[345]603            else if (i < 16)                 xicu->p_hwi[i] (signal_false);
[508]604            else if (i < (16 + nb_ttys))     xicu->p_hwi[i] (signal_irq_mtty[i - 16]);
[428]605            else if (i < 31)                 xicu->p_hwi[i] (signal_false);
[345]606            else                             xicu->p_hwi[i] (signal_irq_bdev);
607        }
608        else      // other clusters
609        {
610            if      (i < 8)                  xicu->p_hwi[i] (signal_false);
[508]611            else if (i < (8 + nb_dmas))      xicu->p_hwi[i] (signal_irq_mdma[i - 8]);
[428]612            else                             xicu->p_hwi[i] (signal_false);
[345]613        }
614    }
615
616    // wrapper XICU
[360]617    wt_xicu->p_clk                     (this->p_clk);
618    wt_xicu->p_resetn                  (this->p_resetn);
619    wt_xicu->p_dspin_cmd               (signal_dspin_cmd_xicu_t);
620    wt_xicu->p_dspin_rsp               (signal_dspin_rsp_xicu_t);
621    wt_xicu->p_vci                     (signal_vci_tgt_xicu);
[345]622
623    std::cout << "  - XICU connected" << std::endl;
624
625    //////////////////////////////////////////////// MEMC
[428]626    memc->p_clk                        (this->p_clk);
627    memc->p_resetn                     (this->p_resetn);
628    memc->p_vci_ixr                    (signal_vci_xram);
629    memc->p_vci_tgt                    (signal_vci_tgt_memc);
[468]630    memc->p_dspin_p2m                  (signal_dspin_p2m_memc);
631    memc->p_dspin_m2p                  (signal_dspin_m2p_memc);
632    memc->p_dspin_clack                (signal_dspin_clack_memc);
[345]633
634    // wrapper MEMC
[360]635    wt_memc->p_clk                     (this->p_clk);
636    wt_memc->p_resetn                  (this->p_resetn);
637    wt_memc->p_dspin_cmd               (signal_dspin_cmd_memc_t);
638    wt_memc->p_dspin_rsp               (signal_dspin_rsp_memc_t);
639    wt_memc->p_vci                     (signal_vci_tgt_memc);
[345]640
641    std::cout << "  - MEMC connected" << std::endl;
642
643    /////////////////////////////////////////////// XRAM
[428]644    xram->p_clk                        (this->p_clk);
645    xram->p_resetn                     (this->p_resetn);
646    xram->p_vci                        (signal_vci_xram);
[345]647
648    std::cout << "  - XRAM connected" << std::endl;
649
[360]650    ////////////////////////////////////////////// MDMA
[428]651    mdma->p_clk                        (this->p_clk);
652    mdma->p_resetn                     (this->p_resetn);
653    mdma->p_vci_target                 (signal_vci_tgt_mdma);
654    mdma->p_vci_initiator              (signal_vci_ini_mdma);
[508]655    for (size_t i = 0; i < nb_dmas; i++)
[345]656        mdma->p_irq[i]                 (signal_irq_mdma[i]);
657
[360]658    // wrapper tgt MDMA
659    wt_mdma->p_clk                     (this->p_clk);
660    wt_mdma->p_resetn                  (this->p_resetn);
661    wt_mdma->p_dspin_cmd               (signal_dspin_cmd_mdma_t);
662    wt_mdma->p_dspin_rsp               (signal_dspin_rsp_mdma_t);
663    wt_mdma->p_vci                     (signal_vci_tgt_mdma);
664
665    // wrapper ini MDMA
666    wi_mdma->p_clk                     (this->p_clk);
667    wi_mdma->p_resetn                  (this->p_resetn);
668    wi_mdma->p_dspin_cmd               (signal_dspin_cmd_mdma_i);
669    wi_mdma->p_dspin_rsp               (signal_dspin_rsp_mdma_i);
670    wi_mdma->p_vci                     (signal_vci_ini_mdma);
671
[345]672    std::cout << "  - MDMA connected" << std::endl;
673
[428]674    /////////////////////////////// Components in I/O cluster
[345]675
[508]676    if (io)
[428]677    {
678        // BDEV
679        bdev->p_clk                    (this->p_clk);
[345]680        bdev->p_resetn                 (this->p_resetn);
681        bdev->p_irq                    (signal_irq_bdev);
682        bdev->p_vci_target             (signal_vci_tgt_bdev);
683        bdev->p_vci_initiator          (signal_vci_ini_bdev);
684
[360]685        // wrapper tgt BDEV
686        wt_bdev->p_clk                 (this->p_clk);
687        wt_bdev->p_resetn              (this->p_resetn);
688        wt_bdev->p_dspin_cmd           (signal_dspin_cmd_bdev_t);
689        wt_bdev->p_dspin_rsp           (signal_dspin_rsp_bdev_t);
690        wt_bdev->p_vci                 (signal_vci_tgt_bdev);
691
692        // wrapper ini BDEV
693        wi_bdev->p_clk                 (this->p_clk);
694        wi_bdev->p_resetn              (this->p_resetn);
695        wi_bdev->p_dspin_cmd           (signal_dspin_cmd_bdev_i);
696        wi_bdev->p_dspin_rsp           (signal_dspin_rsp_bdev_i);
697        wi_bdev->p_vci                 (signal_vci_ini_bdev);
698
[345]699        std::cout << "  - BDEV connected" << std::endl;
700
701        // FBUF
702        fbuf->p_clk                    (this->p_clk);
703        fbuf->p_resetn                 (this->p_resetn);
704        fbuf->p_vci                    (signal_vci_tgt_fbuf);
705
[360]706        // wrapper tgt FBUF
707        wt_fbuf->p_clk                 (this->p_clk);
708        wt_fbuf->p_resetn              (this->p_resetn);
709        wt_fbuf->p_dspin_cmd           (signal_dspin_cmd_fbuf_t);
710        wt_fbuf->p_dspin_rsp           (signal_dspin_rsp_fbuf_t);
711        wt_fbuf->p_vci                 (signal_vci_tgt_fbuf);
712
[345]713        std::cout << "  - FBUF connected" << std::endl;
714
715        // MNIC
716        mnic->p_clk                    (this->p_clk);
717        mnic->p_resetn                 (this->p_resetn);
718        mnic->p_vci                    (signal_vci_tgt_mnic);
[508]719        for (size_t i = 0; i < nic_channels; i++)
[345]720        {
[548]721            mnic->p_rx_irq[i]          (signal_irq_mnic_rx[i]);
722            mnic->p_tx_irq[i]          (signal_irq_mnic_tx[i]);
[345]723        }
724
[360]725        // wrapper tgt MNIC
726        wt_mnic->p_clk                 (this->p_clk);
727        wt_mnic->p_resetn              (this->p_resetn);
728        wt_mnic->p_dspin_cmd           (signal_dspin_cmd_mnic_t);
729        wt_mnic->p_dspin_rsp           (signal_dspin_rsp_mnic_t);
730        wt_mnic->p_vci                 (signal_vci_tgt_mnic);
731
[345]732        std::cout << "  - MNIC connected" << std::endl;
733
[475]734        // CHBUF
735        chbuf->p_clk                    (this->p_clk);
736        chbuf->p_resetn                 (this->p_resetn);
737        chbuf->p_vci_target             (signal_vci_tgt_chbuf);
738        chbuf->p_vci_initiator          (signal_vci_ini_chbuf);
[508]739        for (size_t i = 0; i < chbufdma_channels; i++)
[475]740        {
741            chbuf->p_irq[i]          (signal_irq_chbuf[i]);
742        }
743
744        // wrapper tgt CHBUF
745        wt_chbuf->p_clk                 (this->p_clk);
746        wt_chbuf->p_resetn              (this->p_resetn);
747        wt_chbuf->p_dspin_cmd           (signal_dspin_cmd_chbuf_t);
748        wt_chbuf->p_dspin_rsp           (signal_dspin_rsp_chbuf_t);
749        wt_chbuf->p_vci                 (signal_vci_tgt_chbuf);
750
751        // wrapper ini CHBUF
752        wi_chbuf->p_clk                 (this->p_clk);
753        wi_chbuf->p_resetn              (this->p_resetn);
754        wi_chbuf->p_dspin_cmd           (signal_dspin_cmd_chbuf_i);
755        wi_chbuf->p_dspin_rsp           (signal_dspin_rsp_chbuf_i);
756        wi_chbuf->p_vci                 (signal_vci_ini_chbuf);
757
758        std::cout << "  - CHBUF connected" << std::endl;
759
[345]760        // BROM
761        brom->p_clk                    (this->p_clk);
762        brom->p_resetn                 (this->p_resetn);
763        brom->p_vci                    (signal_vci_tgt_brom);
764
[360]765        // wrapper tgt BROM
766        wt_brom->p_clk                 (this->p_clk);
767        wt_brom->p_resetn              (this->p_resetn);
768        wt_brom->p_dspin_cmd           (signal_dspin_cmd_brom_t);
769        wt_brom->p_dspin_rsp           (signal_dspin_rsp_brom_t);
770        wt_brom->p_vci                 (signal_vci_tgt_brom);
771
[345]772        std::cout << "  - BROM connected" << std::endl;
773
774        // MTTY
775        mtty->p_clk                    (this->p_clk);
776        mtty->p_resetn                 (this->p_resetn);
777        mtty->p_vci                    (signal_vci_tgt_mtty);
[508]778        for (size_t i = 0; i < nb_ttys; i++)
[345]779        {
[428]780            mtty->p_irq[i]             (signal_irq_mtty[i]);
[345]781        }
782
[360]783        // wrapper tgt MTTY
784        wt_mtty->p_clk                 (this->p_clk);
785        wt_mtty->p_resetn              (this->p_resetn);
786        wt_mtty->p_dspin_cmd           (signal_dspin_cmd_mtty_t);
787        wt_mtty->p_dspin_rsp           (signal_dspin_rsp_mtty_t);
788        wt_mtty->p_vci                 (signal_vci_tgt_mtty);
789
[547]790
791        // Sim Helper
792        simhelper->p_clk               (this->p_clk);
793        simhelper->p_resetn            (this->p_resetn);
794        simhelper->p_vci               (signal_vci_tgt_simh);
795       
796        // wrapper tgt Sim Helper
797        wt_simhelper->p_clk            (this->p_clk);
798        wt_simhelper->p_resetn         (this->p_resetn);
799        wt_simhelper->p_dspin_cmd      (signal_dspin_cmd_simh_t);
800        wt_simhelper->p_dspin_rsp      (signal_dspin_rsp_simh_t);
801        wt_simhelper->p_vci            (signal_vci_tgt_simh);
802
[345]803        std::cout << "  - MTTY connected" << std::endl;
804   }
805} // end constructor
806
[508]807
808
809template<size_t dspin_cmd_width,
810         size_t dspin_rsp_width,
811         typename vci_param_int,
812         typename vci_param_ext> TsarXbarCluster<dspin_cmd_width,
813                                                 dspin_rsp_width,
814                                                 vci_param_int,
815                                                 vci_param_ext>::~TsarXbarCluster() {
816
[512]817    dealloc_elems<DspinInput<dspin_cmd_width> > (p_cmd_in, 4, 3);
818    dealloc_elems<DspinOutput<dspin_cmd_width> >(p_cmd_out, 4, 3);
819    dealloc_elems<DspinInput<dspin_rsp_width> > (p_rsp_in, 4, 2);
820    dealloc_elems<DspinOutput<dspin_rsp_width> >(p_rsp_out, 4, 2);
821
[508]822    for (size_t p = 0; p < n_procs; p++)
823    {
824        delete proc[p];
825        delete wi_proc[p];
826    }
827
828    delete memc;
829    delete wt_memc;
830    delete xram;
831    delete xicu;
832    delete wt_xicu;
833    delete mdma;
834    delete wt_mdma;
835    delete wi_mdma;
836    delete xbar_cmd_d;
837    delete xbar_rsp_d;
838    delete xbar_m2p_c;
839    delete xbar_p2m_c;
840    delete xbar_clack_c;
841    delete router_cmd;
842    delete router_rsp;
843    if (brom != NULL)
844    {
845        delete brom;
846        delete wt_brom;
847        delete fbuf;
848        delete wt_fbuf;
849        delete bdev;
850        delete wt_bdev;
851        delete wi_bdev;
852        delete mnic;
853        delete wt_mnic;
854        delete chbuf;
855        delete wt_chbuf;
856        delete wi_chbuf;
857        delete mtty;
858        delete wt_mtty;
[547]859        delete simhelper;
860        delete wt_simhelper;
[508]861    }
862}
863
864
[396]865}}
[345]866
867// Local Variables:
[508]868// tab-width: 4
869// c-basic-offset: 4
[345]870// c-file-offsets:((innamespace . 0)(inline-open . 0))
871// indent-tabs-mode: nil
872// End:
873
[508]874// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
[345]875
876
877
Note: See TracBrowser for help on using the repository browser.