source: trunk/platforms/tsar_mono_fpga/tsar_fpga_cluster/caba/source/src/tsar_fpga_cluster.cpp @ 957

Last change on this file since 957 was 957, checked in by cfuguet, 9 years ago

Introduce a SocLib? platform implementing the FPGA mono cluster platform

  • This mono cluster platform is the one used for NetBSD and Linux on TSAR demonstrators.
  • It is based on the LETI platform but it contains an internal ROM and all the DSPIN routers have been removed.
File size: 14.5 KB
Line 
1//////////////////////////////////////////////////////////////////////////////
2// File: tsar_fpga_cluster.cpp
3// Author: Alain Greiner
4// Copyright: UPMC/LIP6
5// Date : february 2014
6// This program is released under the GNU public license
7//////////////////////////////////////////////////////////////////////////////
8
9#include "../include/tsar_fpga_cluster.h"
10
11namespace soclib {
12namespace caba  {
13
14////////////////////////////////////////////////////////////////////////////////////
15template<size_t dspin_cmd_width,
16    size_t dspin_rsp_width,
17    typename vci_param_int,
18    typename vci_param_ext> TsarFpgaCluster<dspin_cmd_width,
19    dspin_rsp_width,
20    vci_param_int,
21    vci_param_ext>::TsarFpgaCluster(
22            ////////////////////////////////////////////////////////////////////////
23            sc_module_name insname,
24            size_t nb_procs,
25            const soclib::common::MappingTable &mtd,
26            const soclib::common::MappingTable &mtx,
27            uint32_t reset_address,
28            size_t x_width, size_t y_width, size_t l_width,
29            size_t tgtid_memc,
30            size_t tgtid_xicu,
31            size_t tgtid_mtty,
32            size_t tgtid_bdev,
33            size_t tgtid_xrom,
34            const char* disk_pathname,
35            size_t memc_ways, size_t memc_sets,
36            size_t l1_i_ways, size_t l1_i_sets,
37            size_t l1_d_ways, size_t l1_d_sets,
38            size_t xram_latency,
39            const Loader &loader,
40            uint32_t frozen_cycles,
41            uint32_t trace_start_cycle,
42            bool trace_proc_ok, uint32_t trace_proc_id,
43            bool trace_memc_ok )
44                : soclib::caba::BaseModule(insname),
45                m_nprocs(nb_procs),
46                p_clk("clk"),
47                p_resetn("resetn")
48
49{
50    /////////////////////////////////////////////////////////////////////////////
51    // Components definition and allocation
52    /////////////////////////////////////////////////////////////////////////////
53
54    // The processor is a MIPS32 wrapped in the GDB server
55    // the reset address is defined by the reset_address argument
56    typedef GdbServer<Mips32ElIss> mips_iss;
57    mips_iss::setResetAddress( reset_address );
58
59    for (size_t p = 0; p < nb_procs; p++)
60    {
61        bool trace_ok = trace_proc_ok and (trace_proc_id == p);
62
63        std::ostringstream sproc;
64        sproc << "proc_" << p;
65        proc[p] = new VciCcVCacheWrapper<vci_param_int,
66                                         dspin_cmd_width, dspin_rsp_width,
67                                         mips_iss > (
68                sproc.str().c_str(),
69                p,                              // GLOBAL PROC_ID
70                mtd,                            // Mapping Table
71                IntTab(0,p),                    // SRCID
72                p,                              // GLOBAL_CC_ID
73                8, 8,                           // ITLB ways & sets
74                8, 8,                           // DTLB ways & sets
75                l1_i_ways, l1_i_sets, 16,       // ICACHE size
76                l1_d_ways, l1_d_sets, 16,       // DCACHE size
77                4, 4,                           // WBUF lines & words
78                x_width, y_width,
79                frozen_cycles,                  // max frozen cycles
80                trace_start_cycle, trace_ok );
81    }
82
83    /////////////////////////////////////////////////////////////////////////////
84    memc = new VciMemCache<vci_param_int, vci_param_ext,
85                           dspin_rsp_width, dspin_cmd_width>(
86             "memc",
87             mtd,                                // Mapping Table direct space
88             mtx,                                // Mapping Table external space
89             IntTab(0),                          // SRCID external space
90             IntTab(0, tgtid_memc),              // TGTID direct space
91             x_width, y_width,                   // Number of x,y bits in platform
92             memc_ways, memc_sets, 16,           // CACHE SIZE
93             3,                                  // MAX NUMBER OF COPIES
94             4096,                               // HEAP SIZE
95             8, 8, 8,                            // TRT, UPT, IVT DEPTH
96             trace_start_cycle,
97             trace_memc_ok );
98
99    /////////////////////////////////////////////////////////////////////////////
100    std::ostringstream sxram;
101    xram = new VciSimpleRam<vci_param_ext>(
102            "xram",
103            IntTab(0),
104            mtx,
105            loader,
106            xram_latency);
107
108    /////////////////////////////////////////////////////////////////////////////
109    std::ostringstream sxicu;
110    xicu = new VciXicu<vci_param_int>(
111            "xicu",
112            mtd,                               // mapping table
113            IntTab(0, tgtid_xicu),             // TGTID_D
114            16,                                // number of timer IRQs
115            16,                                // number of hard IRQs
116            16,                                // number of soft IRQs
117            16 );                              // number of output IRQs
118
119    /////////////////////////////////////////////////////////////////////////////
120    size_t nb_initiators = nb_procs + 1;
121    size_t nb_targets    = 5;
122
123    std::ostringstream s_xbar_cmd;
124    xbar_cmd = new VciLocalCrossbar<vci_param_int>(
125            s_xbar_cmd.str().c_str(),
126            mtd,                          // mapping table
127            0,                            // cluster id
128            nb_initiators,                // number of local initiators
129            nb_targets,                   // number of local targets
130            0 );                          // default target
131
132    wi_gate = new VciDspinInitiatorWrapper<vci_param_int,
133                                           dspin_cmd_width, dspin_rsp_width>(
134            "wi_gate",
135            x_width + y_width + l_width);
136
137    wt_gate = new VciDspinTargetWrapper<vci_param_int,
138                                        dspin_cmd_width, dspin_rsp_width>(
139            "wt_gate",
140            x_width + y_width + l_width);
141
142    /////////////////////////////////////////////////////////////////////////////
143    xbar_m2p = new DspinLocalCrossbar<dspin_cmd_width>(
144            "xbar_m2p",
145            mtd,                          // mapping table
146            0, 0,                         // cluster coordinates
147            x_width, y_width, l_width,
148            1,                            // number of local sources
149            nb_procs,                     // number of local dests
150            2, 2,                         // fifo depths
151            true,                         // CMD
152            false,                        // don't use local routing table
153            true );                       // broadcast
154
155    /////////////////////////////////////////////////////////////////////////////
156    xbar_p2m = new DspinLocalCrossbar<dspin_rsp_width>(
157            "xbar_p2m",
158            mtd,                          // mapping table
159            0, 0,                         // cluster coordinates
160            x_width, y_width, 0,          // l_width unused on p2m network
161            nb_procs,                     // number of local sources
162            1,                            // number of local dests
163            2, 2,                         // fifo depths
164            false,                        // RSP
165            false,                        // don't use local routing table
166            false );                      // no broadcast
167
168    /////////////////////////////////////////////////////////////////////////////
169    xbar_cla = new DspinLocalCrossbar<dspin_cmd_width>(
170            "xbar_cla",
171            mtd,                          // mapping table
172            0, 0,                         // cluster coordinates
173            x_width, y_width, l_width,
174            1,                            // number of local sources
175            nb_procs,                     // number of local dests
176            2, 2,                         // fifo depths
177            true,                         // CMD
178            false,                        // don't use local routing table
179            false );                      // no broadcast
180
181    /////////////////////////////////////////////
182    bdev = new VciBlockDeviceTsar<vci_param_int>(
183            "bdev",
184            mtd,
185            IntTab(0, nb_procs),
186            IntTab(0, tgtid_bdev),
187            disk_pathname,
188            512,
189            64 );            // burst size
190
191    /////////////////////////////////////////////
192    mtty = new VciMultiTty<vci_param_int>(
193            "mtty",
194            IntTab(0, tgtid_mtty),
195            mtd,
196            "tty", NULL );
197
198    /////////////////////////////////////////////
199    xrom = new VciSimpleRom<vci_param_int>(
200            "xrom",
201            IntTab(0, tgtid_xrom),
202            mtd,
203            loader,
204            0 );
205
206    std::cout << std::endl;
207
208    ////////////////////////////////////
209    // Connections are defined here
210    ////////////////////////////////////
211
212    // CMD DSPIN local crossbar direct
213    xbar_cmd->p_clk(this->p_clk);
214    xbar_cmd->p_resetn(this->p_resetn);
215    xbar_cmd->p_initiator_to_up(signal_vci_l2g);
216    xbar_cmd->p_target_to_up(signal_vci_g2l);
217
218    xbar_cmd->p_to_target[tgtid_memc](signal_vci_tgt_memc);
219    xbar_cmd->p_to_target[tgtid_xicu](signal_vci_tgt_xicu);
220    xbar_cmd->p_to_target[tgtid_mtty](signal_vci_tgt_mtty);
221    xbar_cmd->p_to_target[tgtid_bdev](signal_vci_tgt_bdev);
222    xbar_cmd->p_to_target[tgtid_xrom](signal_vci_tgt_xrom);
223
224    for (size_t p = 0; p < nb_procs; p++)
225    {
226        xbar_cmd->p_to_initiator[p](signal_vci_ini_proc[p]);
227    }
228    xbar_cmd->p_to_initiator[nb_procs](signal_vci_ini_bdev);
229
230    wi_gate->p_clk(this->p_clk);
231    wi_gate->p_resetn(this->p_resetn);
232    wi_gate->p_vci(signal_vci_l2g);
233    wi_gate->p_dspin_cmd(p_cmd_out);
234    wi_gate->p_dspin_rsp(p_rsp_in);
235
236    wt_gate->p_clk(this->p_clk);
237    wt_gate->p_resetn(this->p_resetn);
238    wt_gate->p_vci(signal_vci_g2l);
239    wt_gate->p_dspin_cmd(p_cmd_in);
240    wt_gate->p_dspin_rsp(p_rsp_out);
241
242    std::cout << "  - CMD & RSP Direct crossbar connected" << std::endl;
243
244    // M2P DSPIN local crossbar coherence
245    xbar_m2p->p_clk(this->p_clk);
246    xbar_m2p->p_resetn(this->p_resetn);
247    xbar_m2p->p_global_out(p_m2p_out);
248    xbar_m2p->p_global_in(p_m2p_in);
249    xbar_m2p->p_local_in[0](signal_dspin_m2p_memc);
250    for (size_t p = 0; p < nb_procs; p++)
251        xbar_m2p->p_local_out[p](signal_dspin_m2p_proc[p]);
252
253    std::cout << "  - M2P Coherence crossbar connected" << std::endl;
254
255    ////////////////////////// P2M DSPIN local crossbar coherence
256    xbar_p2m->p_clk(this->p_clk);
257    xbar_p2m->p_resetn(this->p_resetn);
258    xbar_p2m->p_global_out(p_p2m_out);
259    xbar_p2m->p_global_in(p_p2m_in);
260    xbar_p2m->p_local_out[0](signal_dspin_p2m_memc);
261    for (size_t p = 0; p < nb_procs; p++)
262        xbar_p2m->p_local_in[p](signal_dspin_p2m_proc[p]);
263
264    std::cout << "  - P2M Coherence crossbar connected" << std::endl;
265
266    ////////////////////// CLACK DSPIN local crossbar coherence
267    xbar_cla->p_clk(this->p_clk);
268    xbar_cla->p_resetn(this->p_resetn);
269    xbar_cla->p_global_out(p_cla_out);
270    xbar_cla->p_global_in(p_cla_in);
271    xbar_cla->p_local_in[0](signal_dspin_clack_memc);
272    for (size_t p = 0; p < nb_procs; p++)
273        xbar_cla->p_local_out[p](signal_dspin_clack_proc[p]);
274
275    std::cout << "  - CLA Coherence crossbar connected" << std::endl;
276
277    //////////////////////////////////// Processors
278    for (size_t p = 0; p < nb_procs; p++)
279    {
280        proc[p]->p_clk(this->p_clk);
281        proc[p]->p_resetn(this->p_resetn);
282        proc[p]->p_vci(signal_vci_ini_proc[p]);
283        proc[p]->p_dspin_m2p(signal_dspin_m2p_proc[p]);
284        proc[p]->p_dspin_p2m(signal_dspin_p2m_proc[p]);
285        proc[p]->p_dspin_clack(signal_dspin_clack_proc[p]);
286
287        for ( size_t j = 0 ; j < 6 ; j++)
288        {
289            if ( j < 4 ) proc[p]->p_irq[j](signal_proc_irq[4*p + j]);
290            else         proc[p]->p_irq[j](signal_false);
291        }
292    }
293
294    std::cout << "  - Processors connected" << std::endl;
295
296    ///////////////////////////////////// XICU
297    xicu->p_clk(this->p_clk);
298    xicu->p_resetn(this->p_resetn);
299    xicu->p_vci(signal_vci_tgt_xicu);
300
301    for (size_t i = 0 ; i < 16  ; i++)
302    {
303        xicu->p_irq[i](signal_proc_irq[i]);
304    }
305
306    for (size_t i = 0; i < 16; i++)
307    {
308        if      (i == 8)  xicu->p_hwi[i] (signal_irq_memc);
309        else if (i == 9)  xicu->p_hwi[i] (signal_irq_bdev);
310        else if (i == 10) xicu->p_hwi[i] (signal_irq_mtty);
311        else              xicu->p_hwi[i] (signal_false);
312    }
313
314    std::cout << "  - XICU connected" << std::endl;
315
316    // MEMC
317    memc->p_clk(this->p_clk);
318    memc->p_resetn(this->p_resetn);
319    memc->p_irq(signal_irq_memc);
320    memc->p_vci_ixr(signal_vci_xram);
321    memc->p_vci_tgt(signal_vci_tgt_memc);
322    memc->p_dspin_p2m(signal_dspin_p2m_memc);
323    memc->p_dspin_m2p(signal_dspin_m2p_memc);
324    memc->p_dspin_clack(signal_dspin_clack_memc);
325
326    std::cout << "  - MEMC connected" << std::endl;
327
328    // XRAM
329    xram->p_clk(this->p_clk);
330    xram->p_resetn(this->p_resetn);
331    xram->p_vci(signal_vci_xram);
332
333    std::cout << "  - XRAM connected" << std::endl;
334
335    // BDEV
336    bdev->p_clk(this->p_clk);
337    bdev->p_resetn(this->p_resetn);
338    bdev->p_irq(signal_irq_bdev);
339    bdev->p_vci_target(signal_vci_tgt_bdev);
340    bdev->p_vci_initiator(signal_vci_ini_bdev);
341
342    std::cout << "  - BDEV connected" << std::endl;
343
344    // MTTY (single channel)
345    mtty->p_clk(this->p_clk);
346    mtty->p_resetn(this->p_resetn);
347    mtty->p_vci(signal_vci_tgt_mtty);
348    mtty->p_irq[0](signal_irq_mtty);
349
350    std::cout << "  - MTTY connected" << std::endl;
351
352    // XROM
353    xrom->p_clk(this->p_clk);
354    xrom->p_resetn(this->p_resetn);
355    xrom->p_vci(signal_vci_tgt_xrom);
356
357    std::cout << "  - XROM connected" << std::endl;
358} // end constructor
359
360template<size_t dspin_cmd_width, size_t dspin_rsp_width,
361         typename vci_param_int, typename vci_param_ext>
362         TsarFpgaCluster<dspin_cmd_width, dspin_rsp_width,
363                         vci_param_int, vci_param_ext>::~TsarFpgaCluster()
364{
365    for (size_t p = 0; p < m_nprocs ; p++)
366    {
367        if ( proc[p] ) delete proc[p];
368    }
369
370    delete memc;
371    delete xram;
372    delete xicu;
373    delete xbar_cmd;
374    delete xbar_m2p;
375    delete xbar_p2m;
376    delete xbar_cla;
377    delete wi_gate;
378    delete wt_gate;
379    delete bdev;
380    delete mtty;
381    delete xrom;
382}
383
384}}
385
386// Local Variables:
387// tab-width: 4
388// c-basic-offset: 4
389// c-file-offsets:((innamespace . 0)(inline-open . 0))
390// indent-tabs-mode: nil
391// End:
392
393// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
394
395
396
Note: See TracBrowser for help on using the repository browser.