source: trunk/platforms/tsar_generic_leti/tsar_leti_cluster/caba/source/src/tsar_leti_cluster.cpp @ 621

Last change on this file since 621 was 621, checked in by alain, 10 years ago

Introducing a new generic platform compliant with
the LETI specifications: No boot ROM, and fixed format
for clusters indexes.

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