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

Last change on this file since 597 was 597, checked in by cfuguet, 10 years ago

Modifications in vci_mem_cache:

  • Bugfix in req_distance function used to compute manhattan distance between requests coordinates and self global coordinates.
  • New constructor parameters for vci_mem_cache:
    1. x_self : X self coordinate
    2. y_self : Y self coordinate


This parameter are used for instrumentation

  • Remove cc_global_id constructor parameter:

This parameter was the mem_cache coherence srcid. This srcid is not
used by the L1 caches because they take the mem cache global id from
the msb of nline to invalidate (CLEANUP) or to update (MULTIACK)

As the constructor parameters has been changed, the platform using the
mem cache must be changed accordingly. Therefore, the tsar_generic_xbar and
the tsar_generic_iob platforms were updated.

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