source: trunk/platforms/tsarv4_generic_mmu/tsarv4_cluster_mmu/caba/source/src/tsarv4_cluster_mmu.cpp @ 247

Last change on this file since 247 was 247, checked in by cfuguet, 12 years ago

Introducing new CLEANUP transaction address specification in the components:

  • vci_cc_vcache_wrapper_v4
  • vci_mem_cache_v4

The new specification uses the VCI WDATA and the VCI BE to send the cleanup
nline. The VCI ADDRESS is like follows:

  • NLINE MSb | Memory Cache local ID | 00....00

The platforms:

  • tsarv4_mono_mmu
  • tsarv4_generic_mmu

has been modified to use the modified components and the mapping table for the coherence
address space has been updated.

File size: 22.3 KB
RevLine 
[189]1#include "../include/tsarv4_cluster_mmu.h"
2
3namespace soclib {
4namespace caba  {
5
6//////////////////////////////////////////////////////////////////////////
7//                 Constructor
8//////////////////////////////////////////////////////////////////////////
9template<typename vci_param, typename iss_t, int cmd_width, int rsp_width>
10TsarV4ClusterMmu<vci_param, iss_t, cmd_width, rsp_width>::TsarV4ClusterMmu(
11                        sc_module_name  insname,
12                        size_t          nprocs,
13                        size_t          x_id,
14                        size_t          y_id,
15                        size_t          cluster_id,
[247]16                        const           soclib::common::MappingTable &mtd,
17                        const           soclib::common::MappingTable &mtc, 
18                        const           soclib::common::MappingTable &mtx, 
[189]19                        size_t          x_width,
20                        size_t          y_width,
[247]21                        size_t          tgtid_memc,
22                        size_t          tgtid_xicu,
23                        size_t          tgtid_fbuf,
24                        size_t          tgtid_mtty,
25                        size_t          tgtid_brom,
26                        size_t          tgtid_bdev,
27                        size_t          tgtid_mdma,
28                        size_t          memc_ways,
29                        size_t          memc_sets,
30                        size_t          l1_i_ways,
31                        size_t          l1_i_sets,
32                        size_t          l1_d_ways,
33                        size_t          l1_d_sets,
34                        size_t          xram_latency,
[189]35                        bool            io,
[247]36                        size_t          xfb,
37                        size_t          yfb,
38                        char*           disk_name,
39                        size_t          block_size,
[234]40                        const Loader   &loader,
[247]41                        uint32_t        frozen_cycles,
42                        uint32_t        debug_start_cycle,
[189]43                        bool            debug_ok)
44      : soclib::caba::BaseModule(insname),
45        p_clk("clk"),
46        p_resetn("resetn"),
47
48        signal_dspin_cmd_l2g_d("signal_dspin_cmd_l2g_d"),
49        signal_dspin_cmd_g2l_d("signal_dspin_cmd_g2l_d"),
50        signal_dspin_cmd_l2g_c("signal_dspin_cmd_l2g_c"),
51        signal_dspin_cmd_g2l_c("signal_dspin_cmd_g2l_c"),
52        signal_dspin_rsp_l2g_d("signal_dspin_rsp_l2g_d"),
53        signal_dspin_rsp_g2l_d("signal_dspin_rsp_g2l_d"),
54        signal_dspin_rsp_l2g_c("signal_dspin_rsp_l2g_c"),
55        signal_dspin_rsp_g2l_c("signal_dspin_rsp_g2l_c"),
56
[247]57        signal_vci_ini_d_bdev("signal_vci_ini_d_bdev"),
58        signal_vci_ini_d_mdma("signal_vci_ini_d_mdma"),
[189]59
60        signal_vci_tgt_d_memc("signal_vci_tgt_d_memc"),
61        signal_vci_tgt_d_mtty("signal_vci_tgt_d_mtty"),
62        signal_vci_tgt_d_xicu("signal_vci_tgt_d_xicu"),
63        signal_vci_tgt_d_bdev("signal_vci_tgt_d_bdev"),
64        signal_vci_tgt_d_mdma("signal_vci_tgt_d_mdma"),
65        signal_vci_tgt_d_brom("signal_vci_tgt_d_brom"),
66        signal_vci_tgt_d_fbuf("signal_vci_tgt_d_fbuf"),
67
68        signal_vci_ini_c_memc("signal_vci_ini_c_memc"), 
69        signal_vci_tgt_c_memc("signal_vci_tgt_c_memc"),
70
71        signal_vci_xram("signal_vci_xram")
72
73{
74        // Vectors of ports definition
75
76        p_cmd_in        = alloc_elems<DspinInput<cmd_width> >("p_cmd_in", 2, 4);
77        p_cmd_out       = alloc_elems<DspinOutput<cmd_width> >("p_cmd_out", 2, 4);
78        p_rsp_in        = alloc_elems<DspinInput<rsp_width> >("p_rsp_in", 2, 4);
79        p_rsp_out       = alloc_elems<DspinOutput<rsp_width> >("p_rsp_out", 2, 4);
80
81        // Components definition
82
83        // on direct network : local srcid[proc] in [0...nprocs-1]
84        // on direct network : local srcid[mdma] = nprocs
85        // on direct network : local srcid[bdev] = nprocs + 1
86
87        // on coherence network : local srcid[proc] in [0...nprocs-1]
[247]88        // on coherence network : local srcid[memc] = nprocs
[189]89
90std::cout << "  - building proc_" << x_id << "_" << y_id << "-*" << std::endl;
91
92        for ( size_t p=0 ; p<nprocs ; p++ )
93        { 
94            std::ostringstream sproc;
95            sproc << "proc_" << x_id << "_" << y_id << "_" << p;
96            proc[p] = new VciCcVCacheWrapperV4<vci_param, iss_t>(
97                sproc.str().c_str(),
98                cluster_id*nprocs + p,
[247]99                mtd,                            // Mapping Table Direct
100                mtc,                            // Mapping Table Coherence
101                IntTab(cluster_id,p),           // SRCID_D
102                IntTab(cluster_id,p),           // SRCID_C
103                IntTab(cluster_id,p),           // TGTID_C
104                8,                              // ITLB ways
105                8,                              // ITLB sets
106                8,                              // DTLB ways
107                8,                              // DTLB sets
108                l1_i_ways,l1_i_sets,16,         // ICACHE size
109                l1_d_ways,l1_d_sets,16,         // DCACHE size
110                4,                              // WBUF width
111                4,                              // WBUF depth
112                x_width,                        // X Width
113                y_width,                        // Y Width
114                nprocs,                         // Memory Cache Local Id (coherence)
115                frozen_cycles,                  // max frozen cycles
[189]116                debug_start_cycle,
117                debug_ok);
118        }
119
120std::cout << "  - building memc_" << x_id << "_" << y_id << std::endl;
121
122        std::ostringstream smemc;
123        smemc << "memc_" << x_id << "_" << y_id;
124        memc = new VciMemCacheV4<vci_param>(
125                   smemc.str().c_str(),
126                   mtd, mtc, mtx,
[247]127                   IntTab(cluster_id),                  // SRCID_X
128                   IntTab(cluster_id, nprocs),          // SRCID_C
129                   IntTab(cluster_id, tgtid_memc),      // TGTID_D
130                   IntTab(cluster_id, nprocs),          // TGTID_C
131                   memc_ways, memc_sets, 16,            // CACHE SIZE
132                   4096,                                // HEAP SIZE
133                   8,                                   // TRANSACTION TABLE DEPTH
134                   8,                                   // UPDATE TABLE DEPTH
[189]135                   debug_start_cycle,
136                   debug_ok);
137
138       
139std::cout << "  - building xram_" << x_id << "_" << y_id << std::endl;
140
141        std::ostringstream sxram;
142        sxram << "xram_" << x_id << "_" << y_id;
143        xram = new VciSimpleRam<vci_param>(
144                   sxram.str().c_str(),
145                   IntTab(cluster_id),
146                   mtx,
147                   loader,
148                   xram_latency);
149
150std::cout << "  - building xicu_" << x_id << "_" << y_id << std::endl;
151
[247]152        size_t  nhwi = 4;                               // always 4 (or 9) ports, even if
153        if( io == true ) nhwi = 9;                      // there if less than 4 processors
[189]154        std::ostringstream sicu;
155        sicu << "xicu_" << x_id << "_" << y_id;
156        xicu = new VciXicu<vci_param>(
157                  sicu.str().c_str(),
[247]158                  mtd,                                  // mapping table
159                  IntTab(cluster_id, tgtid_xicu),       // TGTID_D
160                  0,                                    // number of timer IRQs
161                  nhwi,                                 // number of hard IRQs
162                  0,                                    // number of soft IRQs
163                  nprocs);                              // number of output IRQs
[189]164
165std::cout << "  - building dma_" << x_id << "_" << y_id << std::endl;
166
167        // dma multi-canaux
168        std::ostringstream sdma;
169        sdma << "dma_" << x_id << "_" << y_id;
170        mdma = new VciMultiDma<vci_param>(
171                   sdma.str().c_str(),
172                   mtd,
[247]173                   IntTab(cluster_id, nprocs),          // SRCID
174                   IntTab(cluster_id, tgtid_mdma),      // TGTID
175                   64,                                  // burst size
176                   nprocs);                             // number of IRQs
[189]177
178std::cout << "  - building xbard_" << x_id << "_" << y_id << std::endl;
179
180        // direct local crossbar
181        size_t nb_direct_initiators      = nprocs + 1;
182        size_t nb_direct_targets         = 3;
183        if( io == true )
184        {
185            nb_direct_initiators         = nprocs + 2;
186            nb_direct_targets            = 7;
[247]187        }
[189]188        std::ostringstream sd;
189        sd << "xbard_" << x_id << "_" << y_id;
190        xbard = new VciLocalCrossbar<vci_param>(
191                    sd.str().c_str(),
192                    mtd,
[247]193                    IntTab(cluster_id),                 // cluster initiator index
194                    IntTab(cluster_id),                 // cluster target index
195                    nb_direct_initiators,               // number of initiators
196                    nb_direct_targets);                 // number of targets     
[189]197       
198std::cout << "  - building xbarc_" << x_id << "_" << y_id << std::endl;
199
200        // coherence local crossbar
201        std::ostringstream sc;
202        sc << "xbarc_" << x_id << "_" << y_id;
203        xbarc = new VciLocalCrossbar<vci_param>(
204                    sc.str().c_str(),
205                    mtc,
[247]206                    IntTab(cluster_id),                 // cluster initiator index
207                    IntTab(cluster_id),                 // cluster target index
208                    nprocs + 1,                         // number of initiators
209                    nprocs + 1);                        // number of targets
[189]210       
211std::cout << "  - building wrappers in cluster_" << x_id << "_" << y_id << std::endl;
212
213        // direct initiator wrapper
214        std::ostringstream wid;
215        wid << "iniwrapperd_" << x_id << "_" << y_id;
216        iniwrapperd = new VciVdspinInitiatorWrapper<vci_param,cmd_width,rsp_width>(
217                          wid.str().c_str(),
[247]218                          4,                            // cmd fifo depth
219                          4);                           // rsp fifo depth
[189]220
221        // direct target wrapper
222        std::ostringstream wtd;
223        wtd << "tgtwrapperd_" << x_id << "_" << y_id;
224        tgtwrapperd = new VciVdspinTargetWrapper<vci_param,cmd_width,rsp_width>(
225                          wtd.str().c_str(),
[247]226                          4,                            // cmd fifo depth
227                          4);                           // rsp fifo depth
[189]228
229        // coherence initiator wrapper
230        std::ostringstream wic;
231        wic << "iniwrapperc_" << x_id << "_" << y_id;
232        iniwrapperc = new VciVdspinInitiatorWrapper<vci_param,cmd_width,rsp_width>(
233                          wic.str().c_str(),
[247]234                          4,                            // cmd fifo depth
235                          4);                           // rsp fifo depth
[189]236
237        // coherence target wrapper
238        std::ostringstream wtc;
239        wtc << "tgtwrapperc_" << x_id << "_" << y_id;
240        tgtwrapperc = new VciVdspinTargetWrapper<vci_param,cmd_width,rsp_width>(
241                          wtc.str().c_str(),
[247]242                          4,                            // cmd fifo depth
243                          4);                           // rsp fifo depth
[189]244
245std::cout << "  - building cmdrouter_" << x_id << "_" << y_id << std::endl;
246
247        // CMD router
248        std::ostringstream scmd;
249        scmd << "cmdrouter_" << x_id << "_" << y_id;
250        cmdrouter = new VirtualDspinRouter<cmd_width>(
251                        scmd.str().c_str(),
252                        x_id,y_id,                    // coordinate in the mesh
253                        x_width, y_width,             // x & y fields width
254                        4,4);                         // input & output fifo depths
255       
256std::cout << "  - building rsprouter_" << x_id << "_" << y_id << std::endl;
257
258        // RSP router
259        std::ostringstream srsp;
260        srsp << "rsprouter_" << x_id << "_" << y_id;
261        rsprouter = new VirtualDspinRouter<rsp_width>(
262                        srsp.str().c_str(),
263                        x_id,y_id,                    // coordinates in mesh
264                        x_width, y_width,             // x & y fields width
265                        4,4);                         // input & output fifo depths
266       
267        // IO cluster components
268        if ( io == true )
[247]269        {
[189]270            brom = new VciSimpleRam<vci_param>(
271                       "brom",
272                       IntTab(cluster_id, tgtid_brom),
273                       mtd,
274                       loader);
275
276            fbuf = new VciFrameBuffer<vci_param>(
277                       "fbuf",
278                       IntTab(cluster_id, tgtid_fbuf),
279                       mtd,
[247]280                       xfb, yfb); 
[189]281
282            bdev = new VciBlockDeviceTsarV4<vci_param>(
283                       "bdev",
284                       mtd,
285                       IntTab(cluster_id, nprocs+1),
286                       IntTab(cluster_id, tgtid_bdev),
287                       disk_name,
288                       block_size);
289
290            mtty = new VciMultiTty<vci_param>(
291                       "mtty",
292                       IntTab(cluster_id, tgtid_mtty),
293                       mtd, 
294                       "tty0", "tty1", "tty2", "tty3", NULL);
[247]295        }
[189]296
297std::cout << "  - all components constructed" << std::endl;
298
299        ////////////////////////////////////
300        // Connections are defined here
301        ////////////////////////////////////
302
303        // CMDROUTER and RSPROUTER
[247]304        cmdrouter->p_clk                        (this->p_clk);
305        cmdrouter->p_resetn                     (this->p_resetn);
306        rsprouter->p_clk                        (this->p_clk);
307        rsprouter->p_resetn                     (this->p_resetn);
[189]308        for(int x = 0; x < 2; x++)
309        {
310          for(int y = 0; y < 4; y++)
311          {
312            cmdrouter->p_out[x][y]              (this->p_cmd_out[x][y]);
313            cmdrouter->p_in[x][y]               (this->p_cmd_in[x][y]);
314            rsprouter->p_out[x][y]              (this->p_rsp_out[x][y]);
315            rsprouter->p_in[x][y]               (this->p_rsp_in[x][y]);
316          }
317        }
318       
[247]319        cmdrouter->p_out[0][4]                  (signal_dspin_cmd_g2l_d);
320        cmdrouter->p_out[1][4]                  (signal_dspin_cmd_g2l_c);
321        cmdrouter->p_in[0][4]                   (signal_dspin_cmd_l2g_d);
322        cmdrouter->p_in[1][4]                   (signal_dspin_cmd_l2g_c);
[189]323
[247]324        rsprouter->p_out[0][4]                  (signal_dspin_rsp_g2l_d);
325        rsprouter->p_out[1][4]                  (signal_dspin_rsp_g2l_c);
326        rsprouter->p_in[0][4]                   (signal_dspin_rsp_l2g_d);
327        rsprouter->p_in[1][4]                   (signal_dspin_rsp_l2g_c);
[189]328
329        // VCI/DSPIN WRAPPERS
[247]330        iniwrapperd->p_clk                      (this->p_clk);
331        iniwrapperd->p_resetn                   (this->p_resetn);
332        iniwrapperd->p_vci                      (signal_vci_l2g_d);
333        iniwrapperd->p_dspin_out                (signal_dspin_cmd_l2g_d);
334        iniwrapperd->p_dspin_in                 (signal_dspin_rsp_g2l_d);
[189]335
[247]336        tgtwrapperd->p_clk                      (this->p_clk);
337        tgtwrapperd->p_resetn                   (this->p_resetn);
338        tgtwrapperd->p_vci                      (signal_vci_g2l_d);
339        tgtwrapperd->p_dspin_out                (signal_dspin_rsp_l2g_d);
340        tgtwrapperd->p_dspin_in                 (signal_dspin_cmd_g2l_d);
[189]341
[247]342        iniwrapperc->p_clk                      (this->p_clk);
343        iniwrapperc->p_resetn                   (this->p_resetn);
344        iniwrapperc->p_vci                      (signal_vci_l2g_c);
345        iniwrapperc->p_dspin_out                (signal_dspin_cmd_l2g_c);
346        iniwrapperc->p_dspin_in                 (signal_dspin_rsp_g2l_c);
[189]347
[247]348        tgtwrapperc->p_clk                      (this->p_clk);
349        tgtwrapperc->p_resetn                   (this->p_resetn);
350        tgtwrapperc->p_vci                      (signal_vci_g2l_c);
351        tgtwrapperc->p_dspin_out                (signal_dspin_rsp_l2g_c);
352        tgtwrapperc->p_dspin_in                 (signal_dspin_cmd_g2l_c);
[189]353
354        // CROSSBAR direct
[247]355        xbard->p_clk                            (this->p_clk);
356        xbard->p_resetn                         (this->p_resetn);
357        xbard->p_initiator_to_up                (signal_vci_l2g_d);
358        xbard->p_target_to_up                   (signal_vci_g2l_d);
[189]359         
[247]360        xbard->p_to_target[tgtid_memc]          (signal_vci_tgt_d_memc);
361        xbard->p_to_target[tgtid_xicu]          (signal_vci_tgt_d_xicu);
362        xbard->p_to_target[tgtid_mdma]          (signal_vci_tgt_d_mdma);
[189]363         
[247]364        xbard->p_to_initiator[nprocs]           (signal_vci_ini_d_mdma);
[189]365
366        for ( size_t p=0 ; p<nprocs ; p++)
367        {
[247]368            xbard->p_to_initiator[p]            (signal_vci_ini_d_proc[p]);
[189]369        }
370
[247]371        if ( io == true )
372        {
373            xbard->p_to_target[tgtid_mtty]      (signal_vci_tgt_d_mtty);
374            xbard->p_to_target[tgtid_brom]      (signal_vci_tgt_d_brom);
375            xbard->p_to_target[tgtid_bdev]      (signal_vci_tgt_d_bdev);
376            xbard->p_to_target[tgtid_fbuf]      (signal_vci_tgt_d_fbuf);
[189]377           
[247]378            xbard->p_to_initiator[nprocs+1]     (signal_vci_ini_d_bdev);
379        }
[189]380       
381        // CROSSBAR coherence
[247]382        xbarc->p_clk                            (this->p_clk);
383        xbarc->p_resetn                         (this->p_resetn);
384        xbarc->p_initiator_to_up                (signal_vci_l2g_c);
385        xbarc->p_target_to_up                   (signal_vci_g2l_c);
386        xbarc->p_to_initiator[nprocs]           (signal_vci_ini_c_memc);
387        xbarc->p_to_target[nprocs]              (signal_vci_tgt_c_memc);
[189]388        for ( size_t p=0 ; p<nprocs ; p++)
389        {
[247]390            xbarc->p_to_target[p]               (signal_vci_tgt_c_proc[p]);
391            xbarc->p_to_initiator[p]            (signal_vci_ini_c_proc[p]);
[189]392        }
393
394        // Processors
395        for ( size_t p=0 ; p<nprocs ; p++)
396        {
[247]397            proc[p]->p_clk                      (this->p_clk);
398            proc[p]->p_resetn                   (this->p_resetn);
399            proc[p]->p_vci_ini_d                (signal_vci_ini_d_proc[p]);
400            proc[p]->p_vci_ini_c                (signal_vci_ini_c_proc[p]);
401            proc[p]->p_vci_tgt_c                (signal_vci_tgt_c_proc[p]);
402            proc[p]->p_irq[0]                   (signal_proc_it[p]);
[189]403            for ( size_t j = 1 ; j < 6 ; j++ )
404            {
[247]405                proc[p]->p_irq[j]               (signal_false);
[189]406            }
407        }
408       
409        // XICU
[247]410        xicu->p_clk                             (this->p_clk);
411        xicu->p_resetn                          (this->p_resetn);
412        xicu->p_vci                             (signal_vci_tgt_d_xicu);
[189]413        for ( size_t p=0 ; p<nprocs ; p++)
414        {
[247]415            xicu->p_irq[p]                      (signal_proc_it[p]);
[189]416        }
417        for ( size_t p=0 ; p<nprocs ; p++)
418        {
[247]419            xicu->p_hwi[p]                      (signal_irq_mdma[p]);
[189]420        }
421        for ( size_t x=nprocs ; x<4 ; x++)
422        {
[247]423            xicu->p_hwi[x]                      (signal_false);
[189]424        }
425        if ( io == true )
[247]426        {
427            xicu->p_hwi[4]                      (signal_irq_tty0);
428            xicu->p_hwi[5]                      (signal_irq_tty1);
429            xicu->p_hwi[6]                      (signal_irq_tty2);
430            xicu->p_hwi[7]                      (signal_irq_tty3);
431            xicu->p_hwi[8]                      (signal_irq_bdev);
432        }
[189]433
434        // MEMC
[247]435        memc->p_clk                             (this->p_clk);
436        memc->p_resetn                          (this->p_resetn);
437        memc->p_vci_ixr                         (signal_vci_xram);
438        memc->p_vci_tgt                         (signal_vci_tgt_d_memc);
439        memc->p_vci_ini                         (signal_vci_ini_c_memc);
440        memc->p_vci_tgt_cleanup                 (signal_vci_tgt_c_memc);
[189]441
442        // XRAM
[247]443        xram->p_clk                             (this->p_clk);
444        xram->p_resetn                          (this->p_resetn);
445        xram->p_vci                             (signal_vci_xram);
[189]446
447        // CDMA
[247]448        mdma->p_clk                             (this->p_clk);
449        mdma->p_resetn                          (this->p_resetn);
450        mdma->p_vci_target                      (signal_vci_tgt_d_mdma);
451        mdma->p_vci_initiator                   (signal_vci_ini_d_mdma);
[189]452        for (size_t p=0 ; p<nprocs ; p++)
453        {
454            mdma->p_irq[p]                       (signal_irq_mdma[p]);
455        }
456
[247]457        // Components in IO cluster
[189]458
[247]459        if ( io == true )
460        {
461            // BDEV           
462            bdev->p_clk                         (this->p_clk);
463            bdev->p_resetn                      (this->p_resetn);
464            bdev->p_irq                         (signal_irq_bdev);
465            bdev->p_vci_target                  (signal_vci_tgt_d_bdev);
466            bdev->p_vci_initiator               (signal_vci_ini_d_bdev);
[189]467
[247]468            // FBUF
469            fbuf->p_clk                         (this->p_clk);
470            fbuf->p_resetn                      (this->p_resetn);
471            fbuf->p_vci                         (signal_vci_tgt_d_fbuf);
[189]472
[247]473            // BROM
474            brom->p_clk                         (this->p_clk);
475            brom->p_resetn                      (this->p_resetn);
476            brom->p_vci                         (signal_vci_tgt_d_brom);
[189]477
478            // MTTY
[247]479            mtty->p_clk                         (this->p_clk);
480            mtty->p_resetn                      (this->p_resetn);
481            mtty->p_vci                         (signal_vci_tgt_d_mtty);
482            mtty->p_irq[0]                      (signal_irq_tty0);
483            mtty->p_irq[1]                      (signal_irq_tty1);
484            mtty->p_irq[2]                      (signal_irq_tty2);
485            mtty->p_irq[3]                      (signal_irq_tty3);
[189]486        }
487} // end constructor
488
489///////////////////////////////////////////////////////////////////////////
490//    destructor
491///////////////////////////////////////////////////////////////////////////
492template<typename vci_param, typename iss_t, int cmd_width, int rsp_width>
493TsarV4ClusterMmu<vci_param, iss_t, cmd_width, rsp_width>::~TsarV4ClusterMmu() {}
494
495}}
Note: See TracBrowser for help on using the repository browser.