Changeset 718


Ignore:
Timestamp:
Jun 24, 2014, 10:15:26 AM (10 years ago)
Author:
cfuguet
Message:

tsar_generic_iob:

  • Replacing "ad-hoc" dspin_tsar router by standard dspin_router on the RAM interconnect. To do so, in IO clusters (clusters with IOB) two crossbars are implemented:

+ One for commands which interconnects MEMC and IOB to the

local interface of RAM CMD dspin_router.

+ One for responses which interconnects local interface of RAM

RSP dspin_router to MEMC and IOB.

  • Introducing modified vci_io_bridge component
  • Modifying IOX memory segments used by IOX network for routing:

+ bugfix: all segments of IOX interconnect must have

global id = 0.

+ Adding XICU segments with special attribute. This

attribute is used by IOB to determine if a command coming
from external DMA peripheral should be routed
through INT or RAM networks.

+ Using bit 32 of physical address to determine if an

external DMA command should be routed through IOB0
or IOB1.

Location:
trunk/platforms/tsar_generic_iob
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/platforms/tsar_generic_iob/top.cpp

    r714 r718  
    11///////////////////////////////////////////////////////////////////////////////
    22// File: top.cpp  (for tsar_generic_iob platform)
    3 // Author: Alain Greiner 
     3// Author: Alain Greiner
    44// Copyright: UPMC/LIP6
    55// Date : august 2013
    66// This program is released under the GNU public license
    77///////////////////////////////////////////////////////////////////////////////
    8 // This file define a generic TSAR architecture with an IO network emulating 
     8// This file define a generic TSAR architecture with an IO network emulating
    99// an external bus (i.e. Hypertransport) to access 7 external peripherals:
    1010//
     
    2525//
    2626// 1) the "INT" network supports Read/Write transactions
    27 //    between processors and L2 caches or peripherals. 
     27//    between processors and L2 caches or peripherals.
    2828//    (VCI ADDDRESS = 40 bits / VCI DATA width = 32 bits)
    2929//    It supports also coherence transactions between L1 & L2 caches.
    30 // 3) the "RAM" network is emulating the 3D network between L2 caches
     30// 3) the "RAM" network emulates the 3D network between L2 caches
    3131//    and L3 caches, and is implemented as a 2D mesh between the L2 caches,
    3232//    the two IO bridges and the physical RAMs disributed in all clusters.
     
    3535//    7 external peripheral controllers.
    3636//    (VCI ADDDRESS = 40 bits / VCI DATA width = 64 bits)
    37 // 
    38 // The external peripherals HWI IRQs are translated to WTI IRQs by the 
     37//
     38// The external peripherals HWI IRQs are translated to WTI IRQs by the
    3939// external IOPIC component, that must be configured by the OS to route
    40 // these WTI ITQS to one or several internal XICU components. 
     40// these WTI ITQS to one or several internal XICU components.
    4141// The total number of channels for the external peripherals (MTTY, MNIC, CDMA
    4242// IOC or HBA) is limited by the IOPIC 32 HWI inputs:..
    4343// - IOPIC HWI[1:0]     connected to IRQ_NIC_RX[1:0]
    44 // - IOPIC HWI[3:2]     connected to IRQ_NIC_TX[1:0]     
     44// - IOPIC HWI[3:2]     connected to IRQ_NIC_TX[1:0]
    4545// - IOPIC HWI[7:4]     connected to IRQ_CMA_TX[3:0]]
    4646// - IOPIC HWI[8]       connected to IRQ_BDEV
     
    5252// and one multi channels DMA component.
    5353// The XICU component is mainly used to handle WTI IRQs, as only 2 HWI IRQs
    54 // are connected to XICU in each cluster: 
     54// are connected to XICU in each cluster:
    5555// - IRQ_IN[0] : MMC
    5656// - IRQ_IN[1] : DMA channel 0
     
    5858// - IRQ_IN[3] : DMA channel 2
    5959// - IRQ_IN[4] : DMA channel 3
    60 // 
     60//
    6161// All clusters are identical, but cluster(0,0) and cluster(XMAX-1,YMAX-1)
    6262// contain an extra IO bridge component. These IOB0 & IOB1 components are
    6363// connected to the three networks (INT, RAM, IOX).
    64 // 
     64//
    6565// - It uses two dspin_local_crossbar per cluster to implement the
    66 //   local interconnect correponding to the INT network. 
    67 // - It uses two dspin_local_crossbar per cluster to implement the
    68 //   local interconnect correponding to the coherence INT network. 
     66//   local interconnect correponding to the INT network.
     67// - It uses three dspin_local_crossbar per cluster to implement the
     68//   local interconnect correponding to the coherence INT network.
    6969// - It uses two virtual_dspin_router per cluster to implement
    7070//   the INT network (routing both the direct and coherence trafic).
     
    7979//
    8080// The main hardware parameters must be defined in the hard_config.h file :
    81 // - X_SIZE           : number of clusters in a row 
     81// - X_SIZE           : number of clusters in a row
    8282// - Y_SIZE           : number of clusters in a column
    8383// - NB_PROCS_MAX     : number of processors per cluster (power of 2)
     
    8888// - FBUF_Y_SIZE      : heigth of frame buffer (lines)
    8989// - XCU_NB_INPUTS    : number of HWIs = number of WTIs = number of PTIs
    90 // 
     90//
    9191// Some secondary hardware parameters must be defined in this top.cpp file:
    92 // - XRAM_LATENCY     : external ram latency 
     92// - XRAM_LATENCY     : external ram latency
    9393// - MEMC_WAYS        : L2 cache number of ways
    9494// - MEMC_SETS        : L2 cache number of sets
    95 // - L1_IWAYS     
    96 // - L1_ISETS   
    97 // - L1_DWAYS   
    98 // - L1_DSETS 
    99 // - BDEV_IMAGE_NAME  : file pathname for block device 
     95// - L1_IWAYS
     96// - L1_ISETS
     97// - L1_DWAYS
     98// - L1_DSETS
     99// - BDEV_IMAGE_NAME  : file pathname for block device
    100100// - NIC_RX_NAME      : file pathname for NIC received packets
    101101// - NIC_TX_NAME      : file pathname for NIC transmited packets
     
    104104// General policy for 40 bits physical address decoding:
    105105// All physical segments base addresses are multiple of 1 Mbytes
    106 // (=> the 24 LSB bits = 0, and the 16 MSB bits define the target) 
     106// (=> the 24 LSB bits = 0, and the 16 MSB bits define the target)
    107107// The (x_width + y_width) MSB bits (left aligned) define
    108108// the cluster index, and the LADR bits define the local index:
     
    159159
    160160///////////////////////////////////////////////////////////
    161 //          DSPIN parameters           
     161//          DSPIN parameters
    162162///////////////////////////////////////////////////////////
    163163
     
    169169
    170170///////////////////////////////////////////////////////////
    171 //         VCI fields width  for the 3 VCI networks         
     171//         VCI fields width  for the 3 VCI networks
    172172///////////////////////////////////////////////////////////
    173173
     
    186186
    187187////////////////////////////////////////////////////////////
    188 //    Main Hardware Parameters values         
     188//    Main Hardware Parameters values
    189189//////////////////////i/////////////////////////////////////
    190190
     
    192192
    193193////////////////////////////////////////////////////////////
    194 //    Secondary Hardware Parameters values         
     194//    Secondary Hardware Parameters values
    195195//////////////////////i/////////////////////////////////////
    196196
     
    223223
    224224////////////////////////////////////////////////////////////
    225 //    Software to be loaded in ROM & RAM         
     225//    Software to be loaded in ROM & RAM
    226226//////////////////////i/////////////////////////////////////
    227227
     
    229229
    230230////////////////////////////////////////////////////////////
    231 //     DEBUG Parameters default values         
     231//     DEBUG Parameters default values
    232232//////////////////////i/////////////////////////////////////
    233233
     
    238238/////////////////////////////////////////////////////////
    239239
    240 // Non replicated peripherals (must be in cluster 0)
    241 
    242 #define BROM_BASE             0x00BFC00000     
    243 #define BROM_SIZE             0x0000100000   // 1 M Kbytes
    244 
    245 #define IOBX_BASE             0x00BE000000
    246 #define IOBX_SIZE             0x0000001000   // 4 Kbytes
    247 
    248 #define BDEV_BASE             0x00B3000000     
    249 #define BDEV_SIZE             0x0000001000   // 4 Kbytes
    250 
    251 #define MTTY_BASE             0x00B4000000     
    252 #define MTTY_SIZE             0x0000001000   // 4 Kbytes
    253 
    254 #define MNIC_BASE             0x00B5000000     
    255 #define MNIC_SIZE             0x0000080000   // 512 Kbytes
    256 
    257 #define CDMA_BASE             0x00B6000000     
    258 #define CDMA_SIZE             0x0000001000 * (NB_CMA_CHANNELS)  // 4 Kbytes per channel
    259 
    260 #define FBUF_BASE             0x00B7000000     
    261 #define FBUF_SIZE             FBUF_X_SIZE * FBUF_Y_SIZE
    262 
    263 #define IOPI_BASE             0x00B8000000     
    264 #define IOPI_SIZE             0x0000001000   // 4 Kbytes
    265 
    266 // Replicated peripherals : address is incremented by a cluster offset
     240// Replicated RAMs : address is incremented by a cluster offset
    267241//     offset  = cluster(x,y) << (address_width-x_width-y_width);
    268242
    269 #define XRAM_BASE             0x0000000000     
    270 #define XRAM_SIZE             0x0004000000   // 64 Mbytes
    271 
    272 #define XICU_BASE             0x00B0000000     
    273 #define XICU_SIZE             0x0000001000   // 4 Kbytes
    274 
    275 #define MDMA_BASE             0x00B1000000     
    276 #define MDMA_SIZE             0x0000001000 * NB_DMA_CHANNELS // 4 Kbytes per channel 
    277 
    278 // Replicated memory segments (XRAM) : address is incremented by a cluster offset
    279 //     offset  = cluster(x,y) << (address_width-x_width-y_width);
    280 
    281 #define MEMC_BASE             0x00B2000000     
    282 #define MEMC_SIZE             0x0000001000   // 4 Kbytes
     243#define SEG_RAM_BASE          0x0000000000
     244#define SEG_RAM_SIZE          0x0004000000   // 64 Mbytes
    283245
    284246////////////////////////////////////////////////////////////////////////
     
    289251// - The 10 MSB bits define the cluster index (left aligned)
    290252// - The 4  LSB bits define the local index.
    291 // Two different initiators cannot have the same SRCID, but a given 
    292 // initiator can have two alias SRCIDs: 
     253// Two different initiators cannot have the same SRCID, but a given
     254// initiator can have two alias SRCIDs:
    293255// - Internal initiators (procs, mdma) are replicated in all clusters,
    294256//   and each initiator has one single SRCID.
    295257// - External initiators (bdev, cdma) are not replicated, but can be
    296 //   accessed in 2 clusters : cluster_iob0 and cluster_iob1. 
     258//   accessed in 2 clusters : cluster_iob0 and cluster_iob1.
    297259//   They have the same local index, but two different cluster indexes.
    298260//
    299261// As cluster_iob0 and cluster_iob1 contain both internal initiators
    300 // and external initiators, they must have different local indexes. 
     262// and external initiators, they must have different local indexes.
    301263// Consequence: For a local interconnect, the INI_ID port index
    302264// is NOT equal to the SRCID local index, and the local interconnect
    303 // must make a translation: SRCID => INI_ID 
     265// must make a translation: SRCID => INI_ID
    304266////////////////////////////////////////////////////////////////////////
    305267
     
    308270#define IOBX_LOCAL_SRCID             0x9
    309271#define MEMC_LOCAL_SRCID             0xA
     272#define CDMA_LOCAL_SRCID             0xB
     273#define BDEV_LOCAL_SRCID             0xC
    310274#define IOPI_LOCAL_SRCID             0xD
    311 #define CDMA_LOCAL_SRCID             0xE    // hard-coded in dspin_tsar
    312 #define BDEV_LOCAL_SRCID             0xF    // hard-coded in dspin_tsar
    313275
    314276///////////////////////////////////////////////////////////////////////
     
    338300///////////////////////////////////////////////////////////////////////
    339301
    340 #define IOX_IOB0_TGT_ID              0    // don't change this value
    341 #define IOX_IOB1_TGT_ID              1    // don't change this value
    342 #define IOX_FBUF_TGT_ID              2
    343 #define IOX_BDEV_TGT_ID              3
    344 #define IOX_MNIC_TGT_ID              4
    345 #define IOX_CDMA_TGT_ID              5
    346 #define IOX_BROM_TGT_ID              6
    347 #define IOX_MTTY_TGT_ID              7
    348 #define IOX_IOPI_TGT_ID              8
    349 
    350 #define IOX_IOB0_INI_ID              0    // Don't change this value
    351 #define IOX_IOB1_INI_ID              1    // Don't change this value
    352 #define IOX_BDEV_INI_ID              2     
    353 #define IOX_CDMA_INI_ID              3 
    354 #define IOX_IOPI_INI_ID              4
     302#define IOX_FBUF_TGT_ID              0
     303#define IOX_BDEV_TGT_ID              1
     304#define IOX_MNIC_TGT_ID              2
     305#define IOX_CDMA_TGT_ID              3
     306#define IOX_BROM_TGT_ID              4
     307#define IOX_MTTY_TGT_ID              5
     308#define IOX_IOPI_TGT_ID              6
     309#define IOX_IOB0_TGT_ID              7
     310#define IOX_IOB1_TGT_ID              8
     311
     312#define IOX_BDEV_INI_ID              0
     313#define IOX_CDMA_INI_ID              1
     314#define IOX_IOPI_INI_ID              2
     315#define IOX_IOB0_INI_ID              3
     316#define IOX_IOB1_INI_ID              4
    355317
    356318////////////////////////////////////////////////////////////////////////
     
    371333   bool     debug_ok         = false;                      // trace activated
    372334   size_t   debug_period     = 1;                          // trace period
    373    size_t   debug_memc_id    = 0xFFFFFFFF;                 // index of traced memc   
    374    size_t   debug_proc_id    = 0xFFFFFFFF;                 // index of traced proc 
    375    size_t   debug_xram_id    = 0xFFFFFFFF;                 // index of traced xram 
     335   size_t   debug_memc_id    = 0xFFFFFFFF;                 // index of traced memc
     336   size_t   debug_proc_id    = 0xFFFFFFFF;                 // index of traced proc
     337   size_t   debug_xram_id    = 0xFFFFFFFF;                 // index of traced xram
    376338   bool     debug_iob        = false;                      // trace iob0 & iob1 when true
    377339   uint32_t debug_from       = 0;                          // trace start cycle
     
    384346   assert( (X_WIDTH == 4) and (Y_WIDTH == 4) and
    385347   "ERROR: we must have X_WIDTH == Y_WIDTH == 4");
    386  
     348
    387349   ////////////// command line arguments //////////////////////
    388350   if (argc > 1)
     
    536498                                   vci_plen_width,
    537499                                   vci_address_width,
    538                                    vci_rerror_width, 
     500                                   vci_rerror_width,
    539501                                   vci_clen_width,
    540502                                   vci_rflag_width,
     
    551513   // - 4 local targets (MEMC, XICU, MDMA, IOBX) per cluster
    552514   /////////////////////////////////////////////////////////////////////
    553    MappingTable maptab_int( vci_address_width, 
    554                             IntTab(x_width + y_width, 16 - x_width - y_width), 
    555                             IntTab(x_width + y_width, vci_srcid_width - x_width - y_width), 
     515   MappingTable maptab_int( vci_address_width,
     516                            IntTab(x_width + y_width, 16 - x_width - y_width),
     517                            IntTab(x_width + y_width, vci_srcid_width - x_width - y_width),
    556518                            0x00FF000000);
    557519
     
    560522      for (size_t y = 0; y < YMAX; y++)
    561523      {
    562          uint64_t offset = ((uint64_t)cluster(x,y)) 
     524         uint64_t offset = ((uint64_t)cluster(x,y))
    563525                              << (vci_address_width-x_width-y_width);
    564526         bool config    = true;
     
    569531         std::ostringstream    smemc_conf;
    570532         smemc_conf << "int_seg_memc_conf_" << x << "_" << y;
    571          maptab_int.add(Segment(smemc_conf.str(), MEMC_BASE+offset, MEMC_SIZE,
    572                      IntTab(cluster(x,y),INT_MEMC_TGT_ID), not cacheable, config ));
     533         maptab_int.add(Segment(smemc_conf.str(), SEG_MMC_BASE+offset, SEG_MMC_SIZE,
     534                     IntTab(cluster(x,y), INT_MEMC_TGT_ID), not cacheable, config ));
    573535
    574536         std::ostringstream    smemc_xram;
    575537         smemc_xram << "int_seg_memc_xram_" << x << "_" << y;
    576          maptab_int.add(Segment(smemc_xram.str(), XRAM_BASE+offset, XRAM_SIZE,
    577                      IntTab(cluster(x,y),INT_MEMC_TGT_ID), cacheable));
     538         maptab_int.add(Segment(smemc_xram.str(), SEG_RAM_BASE+offset, SEG_RAM_SIZE,
     539                     IntTab(cluster(x,y), INT_MEMC_TGT_ID), cacheable));
    578540
    579541         std::ostringstream    sxicu;
    580542         sxicu << "int_seg_xicu_" << x << "_" << y;
    581          maptab_int.add(Segment(sxicu.str(), XICU_BASE+offset, XICU_SIZE,
    582                      IntTab(cluster(x,y),INT_XICU_TGT_ID), not cacheable));
     543         maptab_int.add(Segment(sxicu.str(), SEG_XCU_BASE+offset, SEG_XCU_SIZE,
     544                     IntTab(cluster(x,y), INT_XICU_TGT_ID), not cacheable));
    583545
    584546         std::ostringstream    smdma;
    585547         smdma << "int_seg_mdma_" << x << "_" << y;
    586          maptab_int.add(Segment(smdma.str(), MDMA_BASE+offset, MDMA_SIZE,
    587                      IntTab(cluster(x,y),INT_MDMA_TGT_ID), not cacheable));
     548         maptab_int.add(Segment(smdma.str(), SEG_DMA_BASE+offset, SEG_DMA_SIZE,
     549                     IntTab(cluster(x,y), INT_MDMA_TGT_ID), not cacheable));
    588550
    589551         // the following segments are only defined in cluster_iob0 or in cluster_iob1
    590552
    591          if ( (cluster(x,y) == cluster_iob0) or (cluster(x,y) == cluster_iob1) ) 
     553         if ( (cluster(x,y) == cluster_iob0) or (cluster(x,y) == cluster_iob1) )
    592554         {
    593555            std::ostringstream    siobx;
    594556            siobx << "int_seg_iobx_" << x << "_" << y;
    595             maptab_int.add(Segment(siobx.str(), IOBX_BASE+offset, IOBX_SIZE,
     557            maptab_int.add(Segment(siobx.str(), SEG_IOB_BASE+offset, SEG_IOB_SIZE,
    596558                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable, config ));
    597559
    598560            std::ostringstream    stty;
    599561            stty << "int_seg_mtty_" << x << "_" << y;
    600             maptab_int.add(Segment(stty.str(), MTTY_BASE+offset, MTTY_SIZE,
     562            maptab_int.add(Segment(stty.str(), SEG_TTY_BASE+offset, SEG_TTY_SIZE,
    601563                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable));
    602564
    603565            std::ostringstream    sfbf;
    604566            sfbf << "int_seg_fbuf_" << x << "_" << y;
    605             maptab_int.add(Segment(sfbf.str(), FBUF_BASE+offset, FBUF_SIZE,
     567            maptab_int.add(Segment(sfbf.str(), SEG_FBF_BASE+offset, SEG_FBF_SIZE,
    606568                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable));
    607569
    608570            std::ostringstream    sbdv;
    609571            sbdv << "int_seg_bdev_" << x << "_" << y;
    610             maptab_int.add(Segment(sbdv.str(), BDEV_BASE+offset, BDEV_SIZE,
     572            maptab_int.add(Segment(sbdv.str(), SEG_IOC_BASE+offset, SEG_IOC_SIZE,
    611573                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable));
    612574
    613575            std::ostringstream    snic;
    614576            snic << "int_seg_mnic_" << x << "_" << y;
    615             maptab_int.add(Segment(snic.str(), MNIC_BASE+offset, MNIC_SIZE,
     577            maptab_int.add(Segment(snic.str(), SEG_NIC_BASE+offset, SEG_NIC_SIZE,
    616578                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable));
    617579
    618580            std::ostringstream    srom;
    619581            srom << "int_seg_brom_" << x << "_" << y;
    620             maptab_int.add(Segment(srom.str(), BROM_BASE+offset, BROM_SIZE,
     582            maptab_int.add(Segment(srom.str(), SEG_ROM_BASE+offset, SEG_ROM_SIZE,
    621583                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), cacheable ));
    622584
    623585            std::ostringstream    sdma;
    624586            sdma << "int_seg_cdma_" << x << "_" << y;
    625             maptab_int.add(Segment(sdma.str(), CDMA_BASE+offset, CDMA_SIZE,
     587            maptab_int.add(Segment(sdma.str(), SEG_CMA_BASE+offset, SEG_CMA_SIZE,
    626588                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable));
    627589
    628590            std::ostringstream    spic;
    629591            spic << "int_seg_iopi_" << x << "_" << y;
    630             maptab_int.add(Segment(spic.str(), IOPI_BASE+offset, IOPI_SIZE,
     592            maptab_int.add(Segment(spic.str(), SEG_PIC_BASE+offset, SEG_PIC_SIZE,
    631593                        IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable));
    632594         }
     
    635597         // and the port index on the local interconnect.
    636598
    637          maptab_int.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), 
     599         maptab_int.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ),
    638600                               IntTab( cluster(x,y), INT_MDMA_INI_ID ) );
    639601
     
    645607
    646608         for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ )
    647          maptab_int.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+p ), 
     609         maptab_int.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+p ),
    648610                               IntTab( cluster(x,y), INT_PROC_INI_ID+p ) );
    649611      }
     
    652614
    653615    /////////////////////////////////////////////////////////////////////////
    654     // RAM network mapping table 
     616    // RAM network mapping table
    655617    // - two levels address decoding for commands
    656618    // - two levels srcid decoding for responses
    657     // - 2 local initiators (MEMC, IOBX) per cluster 
     619    // - 2 local initiators (MEMC, IOBX) per cluster
    658620    //   (IOBX component only in cluster_iob0 and cluster_iob1)
    659621    // - 1 local target (XRAM) per cluster
    660622    ////////////////////////////////////////////////////////////////////////
    661623    MappingTable maptab_ram( vci_address_width,
    662                              IntTab(x_width+y_width, 16 - x_width - y_width),
    663                              IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), 
     624                             IntTab(x_width+y_width, 0),
     625                             IntTab(x_width+y_width, vci_srcid_width - x_width - y_width),
    664626                             0x00FF000000);
    665627
     
    667629    {
    668630        for (size_t y = 0; y < YMAX ; y++)
    669         { 
    670             uint64_t offset = ((uint64_t)cluster(x,y)) 
     631        {
     632            uint64_t offset = ((uint64_t)cluster(x,y))
    671633                                << (vci_address_width-x_width-y_width);
    672634
    673635            std::ostringstream sxram;
    674636            sxram << "ext_seg_xram_" << x << "_" << y;
    675             maptab_ram.add(Segment(sxram.str(), XRAM_BASE+offset,
    676                            XRAM_SIZE, IntTab(cluster(x,y), 0), false));
     637            maptab_ram.add(Segment(sxram.str(), SEG_RAM_BASE+offset,
     638                           SEG_RAM_SIZE, IntTab(cluster(x,y), RAM_XRAM_TGT_ID), false));
    677639        }
    678640    }
     
    680642    // This define the mapping between the initiators SRCID
    681643    // and the port index on the RAM local interconnect.
    682     // External initiator have two alias SRCID (iob0 / iob1) 
    683 
    684     maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), 
     644    // External initiator have two alias SRCID (iob0 / iob1)
     645
     646    maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ),
    685647                          IntTab( cluster_iob0, RAM_IOBX_INI_ID ) );
    686648
    687     maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), 
     649    maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ),
    688650                          IntTab( cluster_iob1, RAM_IOBX_INI_ID ) );
    689651
     
    694656                          IntTab( cluster_iob1, RAM_IOBX_INI_ID ) );
    695657
    696     maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ),
     658    maptab_ram.srcid_map( IntTab( cluster_iob0, IOPI_LOCAL_SRCID ),
     659                          IntTab( cluster_iob0, RAM_IOBX_INI_ID ) );
     660
     661    maptab_ram.srcid_map( IntTab( cluster_iob1, IOPI_LOCAL_SRCID ),
     662                          IntTab( cluster_iob1, RAM_IOBX_INI_ID ) );
     663
     664    maptab_ram.srcid_map( IntTab( cluster_iob0, MEMC_LOCAL_SRCID ),
     665                          IntTab( cluster_iob0, RAM_MEMC_INI_ID ) );
     666
     667    maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ),
    697668                          IntTab( cluster_iob1, RAM_MEMC_INI_ID ) );
    698669
     
    700671
    701672    ///////////////////////////////////////////////////////////////////////
    702     // IOX network mapping table 
    703     // - two levels address decoding for commands
     673    // IOX network mapping table
     674    // - two levels address decoding for commands (9, 7) bits
    704675    // - two levels srcid decoding for responses
    705676    // - 5 initiators (IOB0, IOB1, BDEV, CDMA, IOPI)
    706677    // - 9 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, BROM, MNIC, IOPI)
     678    //
     679    // Address bit 32 is used to determine if a command must be routed to
     680    // IOB0 or IOB1.
    707681    ///////////////////////////////////////////////////////////////////////
    708     MappingTable maptab_iox( vci_address_width,
    709                              IntTab(x_width+y_width, 16 - x_width - y_width),
    710                              IntTab(x_width+y_width, vci_srcid_width - x_width - y_width),
    711                              0x00FF000000);
    712 
    713     // compute base addresses for cluster_iob0 and cluster_iob1
    714     uint64_t iob0_base = ((uint64_t)cluster_iob0) << (vci_address_width - x_width - y_width);
    715     uint64_t iob1_base = ((uint64_t)cluster_iob1) << (vci_address_width - x_width - y_width);
     682    MappingTable maptab_iox(
     683          vci_address_width,
     684          IntTab(x_width + y_width - 1, 16 - x_width - y_width + 1),
     685          IntTab(x_width + y_width    , vci_param_ext::S - x_width - y_width),
     686          0x00FF000000);
    716687
    717688    // External peripherals segments
    718     // WHen there is more than one cluster, external peripherals can be accessed
     689    // When there is more than one cluster, external peripherals can be accessed
    719690    // through two segments, depending on the used IOB (IOB0 or IOB1).
    720     maptab_iox.add(Segment("iox_seg_mtty_0", MTTY_BASE + iob0_base, MTTY_SIZE,
    721                    IntTab(cluster_iob0,IOX_MTTY_TGT_ID), false));
    722     maptab_iox.add(Segment("iox_seg_fbuf_0", FBUF_BASE + iob0_base, FBUF_SIZE,
    723                    IntTab(cluster_iob0,IOX_FBUF_TGT_ID), false));
    724     maptab_iox.add(Segment("iox_seg_bdev_0", BDEV_BASE + iob0_base, BDEV_SIZE,
    725                    IntTab(cluster_iob0,IOX_BDEV_TGT_ID), false));
    726     maptab_iox.add(Segment("iox_seg_mnic_0", MNIC_BASE + iob0_base, MNIC_SIZE,
    727                    IntTab(cluster_iob0,IOX_MNIC_TGT_ID), false));
    728     maptab_iox.add(Segment("iox_seg_cdma_0", CDMA_BASE + iob0_base, CDMA_SIZE,
    729                    IntTab(cluster_iob0,IOX_CDMA_TGT_ID), false));
    730     maptab_iox.add(Segment("iox_seg_brom_0", BROM_BASE + iob0_base, BROM_SIZE,
    731                    IntTab(cluster_iob0,IOX_BROM_TGT_ID), false));
    732     maptab_iox.add(Segment("iox_seg_iopi_0", IOPI_BASE + iob0_base, IOPI_SIZE,
    733                    IntTab(cluster_iob0,IOX_IOPI_TGT_ID), false));
    734    
     691
     692    const uint64_t iob0_base = ((uint64_t)cluster_iob0)
     693       << (vci_address_width - x_width - y_width);
     694
     695    maptab_iox.add(Segment("iox_seg_mtty_0", SEG_TTY_BASE + iob0_base, SEG_TTY_SIZE,
     696                   IntTab(0, IOX_MTTY_TGT_ID), false));
     697    maptab_iox.add(Segment("iox_seg_fbuf_0", SEG_FBF_BASE + iob0_base, SEG_FBF_SIZE,
     698                   IntTab(0, IOX_FBUF_TGT_ID), false));
     699    maptab_iox.add(Segment("iox_seg_bdev_0", SEG_IOC_BASE + iob0_base, SEG_IOC_SIZE,
     700                   IntTab(0, IOX_BDEV_TGT_ID), false));
     701    maptab_iox.add(Segment("iox_seg_mnic_0", SEG_NIC_BASE + iob0_base, SEG_NIC_SIZE,
     702                   IntTab(0, IOX_MNIC_TGT_ID), false));
     703    maptab_iox.add(Segment("iox_seg_cdma_0", SEG_CMA_BASE + iob0_base, SEG_CMA_SIZE,
     704                   IntTab(0, IOX_CDMA_TGT_ID), false));
     705    maptab_iox.add(Segment("iox_seg_brom_0", SEG_ROM_BASE + iob0_base, SEG_ROM_SIZE,
     706                   IntTab(0, IOX_BROM_TGT_ID), false));
     707    maptab_iox.add(Segment("iox_seg_iopi_0", SEG_PIC_BASE + iob0_base, SEG_PIC_SIZE,
     708                   IntTab(0, IOX_IOPI_TGT_ID), false));
     709
    735710    if ( cluster_iob0 != cluster_iob1 )
    736711    {
    737         maptab_iox.add(Segment("iox_seg_mtty_1", MTTY_BASE + iob1_base, MTTY_SIZE,
    738                    IntTab(cluster_iob1,IOX_MTTY_TGT_ID), false));
    739         maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, FBUF_SIZE,
    740                    IntTab(cluster_iob1,IOX_FBUF_TGT_ID), false));
    741         maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, BDEV_SIZE,
    742                    IntTab(cluster_iob1,IOX_BDEV_TGT_ID), false));
    743         maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, MNIC_SIZE,
    744                    IntTab(cluster_iob1,IOX_MNIC_TGT_ID), false));
    745         maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, CDMA_SIZE,
    746                    IntTab(cluster_iob1,IOX_CDMA_TGT_ID), false));
    747         maptab_iox.add(Segment("iox_seg_brom_1", BROM_BASE + iob1_base, BROM_SIZE,
    748                    IntTab(cluster_iob1,IOX_BROM_TGT_ID), false));
    749         maptab_iox.add(Segment("iox_seg_iopi_1", IOPI_BASE + iob1_base, IOPI_SIZE,
    750                    IntTab(cluster_iob1,IOX_IOPI_TGT_ID), false));
     712       const uint64_t iob1_base = ((uint64_t)cluster_iob1)
     713          << (vci_address_width - x_width - y_width);
     714
     715        maptab_iox.add(Segment("iox_seg_mtty_1", SEG_TTY_BASE + iob1_base, SEG_TTY_SIZE,
     716                   IntTab(0, IOX_MTTY_TGT_ID), false));
     717        maptab_iox.add(Segment("iox_seg_fbuf_1", SEG_FBF_BASE + iob1_base, SEG_FBF_SIZE,
     718                   IntTab(0, IOX_FBUF_TGT_ID), false));
     719        maptab_iox.add(Segment("iox_seg_bdev_1", SEG_IOC_BASE + iob1_base, SEG_IOC_SIZE,
     720                   IntTab(0, IOX_BDEV_TGT_ID), false));
     721        maptab_iox.add(Segment("iox_seg_mnic_1", SEG_NIC_BASE + iob1_base, SEG_NIC_SIZE,
     722                   IntTab(0, IOX_MNIC_TGT_ID), false));
     723        maptab_iox.add(Segment("iox_seg_cdma_1", SEG_CMA_BASE + iob1_base, SEG_CMA_SIZE,
     724                   IntTab(0, IOX_CDMA_TGT_ID), false));
     725        maptab_iox.add(Segment("iox_seg_brom_1", SEG_ROM_BASE + iob1_base, SEG_ROM_SIZE,
     726                   IntTab(0, IOX_BROM_TGT_ID), false));
     727        maptab_iox.add(Segment("iox_seg_iopi_1", SEG_PIC_BASE + iob1_base, SEG_PIC_SIZE,
     728                   IntTab(0, IOX_IOPI_TGT_ID), false));
    751729    }
    752730
    753     // If there is more than one cluster, external peripherals 
     731    // If there is more than one cluster, external peripherals
    754732    // can access RAM through two segments (IOB0 / IOB1).
    755733    // As IOMMU is not activated, addresses are 40 bits (physical addresses),
    756     // and the choice depends on address bit A[39].
     734    // and the choice depends on address bit A[32].
    757735    for (size_t x = 0; x < XMAX; x++)
    758736    {
    759737        for (size_t y = 0; y < YMAX ; y++)
    760         {
    761             uint64_t offset = ((uint64_t)cluster(x,y))
    762                              << (vci_address_width-x_width-y_width);
    763 
    764             if ( (cluster_iob0 != cluster_iob1) and (x >= (XMAX/2)) ) // use IOB1
     738        {
     739            const bool wti       = true;
     740            const bool cacheable = true;
     741
     742            const uint64_t offset = ((uint64_t)cluster(x,y))
     743                << (vci_address_width-x_width-y_width);
     744
     745            const uint64_t xicu_base = SEG_XCU_BASE + offset;
     746
     747            if ( (y & 0x1) == 0 ) // use IOB0
    765748            {
     749                std::ostringstream sxcu0;
     750                sxcu0 << "iox_seg_xcu0_" << x << "_" << y;
     751                maptab_iox.add(Segment(sxcu0.str(), xicu_base, SEG_XCU_SIZE,
     752                            IntTab(0, IOX_IOB0_TGT_ID), not cacheable, wti));
     753
     754                std::ostringstream siob0;
     755                siob0 << "iox_seg_ram0_" << x << "_" << y;
     756                maptab_iox.add(Segment(siob0.str(), offset, SEG_XCU_BASE,
     757                            IntTab(0, IOX_IOB0_TGT_ID), not cacheable, not wti));
     758            }
     759            else                  // USE IOB1
     760            {
     761                std::ostringstream sxcu1;
     762                sxcu1 << "iox_seg_xcu1_" << x << "_" << y;
     763                maptab_iox.add(Segment(sxcu1.str(), xicu_base, SEG_XCU_SIZE,
     764                            IntTab(0, IOX_IOB1_TGT_ID), not cacheable, wti));
     765
    766766                std::ostringstream siob1;
    767                 siob1 << "iox_seg_xram_" << x << "_" << y;
    768                 maptab_iox.add(Segment(siob1.str(), offset, XRAM_SIZE,
    769                             IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false));
    770             }
    771             else                                                     // USE IOB0
    772             {
    773                 std::ostringstream siob0;
    774                 siob0 << "iox_seg_xram_" << x << "_" << y;
    775                 maptab_iox.add(Segment(siob0.str(), offset, XRAM_SIZE,
    776                             IntTab(cluster_iob0,IOX_IOB0_TGT_ID), false));
     767                siob1 << "iox_seg_ram1_" << x << "_" << y;
     768                maptab_iox.add(Segment(siob1.str(), offset, SEG_XCU_BASE,
     769                            IntTab(0, IOX_IOB1_TGT_ID), not cacheable, not wti));
    777770            }
    778771        }
     
    781774    // This define the mapping between the external initiators (SRCID)
    782775    // and the port index on the IOX local interconnect.
    783     // If there is more than one cluster, external initiators
    784     // have two alias SRCID (iob0 / iob1 access) 
    785     maptab_iox.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ),
    786                           IntTab( cluster_iob0, IOX_CDMA_INI_ID ) );
    787     maptab_iox.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ),
    788                           IntTab( cluster_iob0, IOX_BDEV_INI_ID ) );
    789     maptab_iox.srcid_map( IntTab( cluster_iob0, IOPI_LOCAL_SRCID ),
    790                           IntTab( cluster_iob0, IOX_IOPI_INI_ID ) );
     776
     777    maptab_iox.srcid_map( IntTab( 0, CDMA_LOCAL_SRCID ) ,
     778                          IntTab( 0, IOX_CDMA_INI_ID  ) );
     779    maptab_iox.srcid_map( IntTab( 0, BDEV_LOCAL_SRCID ) ,
     780                          IntTab( 0, IOX_BDEV_INI_ID  ) );
     781    maptab_iox.srcid_map( IntTab( 0, IOPI_LOCAL_SRCID ) ,
     782                          IntTab( 0, IOX_IOPI_INI_ID  ) );
     783    maptab_iox.srcid_map( IntTab( 0, IOX_IOB0_INI_ID  ) ,
     784                          IntTab( 0, IOX_IOB0_INI_ID  ) );
    791785
    792786    if ( cluster_iob0 != cluster_iob1 )
    793787    {
    794         maptab_iox.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ),
    795                               IntTab( cluster_iob1, IOX_CDMA_INI_ID ) );
    796         maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ),
    797                               IntTab( cluster_iob1, IOX_BDEV_INI_ID ) );
    798         maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ),
    799                               IntTab( cluster_iob1, IOX_IOPI_INI_ID ) );
    800     }
    801 
    802     // This define the mapping between the internal initiators (SRCID)
    803     // and the port index on the IOX local interconnect.
    804     // If there is more than one cluster, external initiators
    805 
    806     for (size_t x = 0; x < XMAX; x++)
    807     {
    808         for (size_t y = 0; y < YMAX ; y++)
    809         {
    810             if ( (cluster_iob0 != cluster_iob1) and (x >= (XMAX/2)) ) // use IOB1
    811             {
    812                 for (size_t p = 0 ; p < NB_PROCS_MAX ; p++)
    813                 maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID + p ),
    814                                       IntTab( cluster_iob1, IOX_IOB1_INI_ID ) );
    815 
    816                 maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ),
    817                                       IntTab( cluster_iob1, IOX_IOB1_INI_ID ) );
    818             }
    819             else                                                      // USE IOB0
    820             {
    821                 for (size_t p = 0 ; p < NB_PROCS_MAX ; p++)
    822                 maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID + p ),
    823                                       IntTab( cluster_iob0, IOX_IOB0_INI_ID ) );
    824 
    825                 maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ),
    826                                       IntTab( cluster_iob0, IOX_IOB0_INI_ID ) );
    827             }
    828         }
     788        maptab_iox.srcid_map( IntTab( 0, IOX_IOB1_INI_ID ) ,
     789                              IntTab( 0, IOX_IOB1_INI_ID ) );
    829790    }
    830791
     
    844805    sc_signal<bool>                   signal_irq_mnic_tx[NB_NIC_CHANNELS];
    845806    sc_signal<bool>                   signal_irq_cdma[NB_CMA_CHANNELS];
    846 
    847     // DSPIN signals for loopback in cluster_iob0 & cluster_iob1
    848     DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob0_loopback;
    849     DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob0_loopback;
    850     DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob1_loopback;
    851     DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob1_loopback;
    852807
    853808    // VCI signals for IOX network
     
    868823    VciSignals<vci_param_ext>         signal_vci_tgt_iopi("signal_vci_ini_iopi");
    869824
    870    // Horizontal inter-clusters INT network DSPIN 
     825   // Horizontal inter-clusters INT network DSPIN
    871826   DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_inc =
    872827      alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_inc", XMAX-1, YMAX, 3);
     
    888843      alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_dec", XMAX, YMAX-1, 2);
    889844
    890    // Mesh boundaries INT network DSPIN 
     845   // Mesh boundaries INT network DSPIN
    891846   DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_in =
    892847      alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_in", XMAX, YMAX, 4, 3);
     
    899854
    900855
    901    // Horizontal inter-clusters RAM network DSPIN 
     856   // Horizontal inter-clusters RAM network DSPIN
    902857   DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_inc =
    903858      alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_inc", XMAX-1, YMAX);
     
    919874      alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_dec", XMAX, YMAX-1);
    920875
    921    // Mesh boundaries RAM network DSPIN 
     876   // Mesh boundaries RAM network DSPIN
    922877   DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_in =
    923878      alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_in", XMAX, YMAX, 4);
     
    930885
    931886   ////////////////////////////
    932    //      Loader   
     887   //      Loader
    933888   ////////////////////////////
    934889
     
    950905   std::cout << std::endl << "External Bus and Peripherals" << std::endl << std::endl;
    951906
     907   const size_t nb_iox_initiators = (cluster_iob0 != cluster_iob1) ? 5 : 4;
     908   const size_t nb_iox_targets = (cluster_iob0 != cluster_iob1) ? 9 : 8;
     909
    952910   // IOX network
    953911   VciIoxNetwork<vci_param_ext>* iox_network;
    954    iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network", 
     912   iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network",
    955913                                                   maptab_iox,
    956                                                    9,        // number of targets
    957                                                    5 );      // number of initiators
     914                                                   nb_iox_targets,
     915                                                   nb_iox_initiators );
    958916   // boot ROM
    959917   VciSimpleRom<vci_param_ext>*  brom;
     
    991949                                                  disk_name,
    992950                                                  512,        // block size
    993                                                   64,         // burst size (bytes) 
    994                                                   0 );        // disk latency 
     951                                                  64,         // burst size (bytes)
     952                                                  0 );        // disk latency
    995953
    996954   // Chained Buffer DMA controller
     
    1013971      mtty = new VciMultiTty<vci_param_ext>( "mtty",
    1014972                                             IntTab(0, IOX_MTTY_TGT_ID),
    1015                                              maptab_iox, 
     973                                             maptab_iox,
    1016974                                             vect_names);
    1017975
     
    1022980                                       IntTab(0, IOPI_LOCAL_SRCID),
    1023981                                       IntTab(0, IOX_IOPI_TGT_ID),
    1024                                        32 );        // number of input HWI             
    1025    // Clusters 
     982                                       32 );        // number of input HWI
     983   // Clusters
    1026984   TsarIobCluster<vci_param_int,
    1027985                  vci_param_ext,
     
    10481006            std::cout << "Cluster_" << std::dec << x << "_" << y << std::endl;
    10491007            std::cout << std::endl;
     1008
     1009            const bool is_iob0 = (cluster(x,y) == cluster_iob0);
     1010            const bool is_iob1 = (cluster(x,y) == cluster_iob1);
     1011            const bool is_io_cluster = is_iob0 || is_iob1;
     1012
     1013            const int iox_iob_ini_id = is_iob0 ?
     1014                IOX_IOB0_INI_ID :
     1015                IOX_IOB1_INI_ID ;
     1016            const int iox_iob_tgt_id = is_iob0 ?
     1017                IOX_IOB0_TGT_ID :
     1018                IOX_IOB1_TGT_ID ;
    10501019
    10511020            std::ostringstream sc;
     
    10881057                RAM_IOBX_INI_ID,
    10891058
     1059                is_io_cluster,
     1060                iox_iob_tgt_id,
     1061                iox_iob_ini_id,
     1062
    10901063                MEMC_WAYS,
    10911064                MEMC_SETS,
     
    11171090
    11181091    ///////////////////////////////////////////////////////////////////////////////
    1119     //     Net-list 
     1092    //     Net-list
    11201093    ///////////////////////////////////////////////////////////////////////////////
    11211094
     
    11241097    iox_network->p_resetn                                (signal_resetn);
    11251098    iox_network->p_to_ini[IOX_IOB0_INI_ID]               (signal_vci_ini_iob0);
    1126     iox_network->p_to_ini[IOX_IOB1_INI_ID]               (signal_vci_ini_iob1);
    11271099    iox_network->p_to_ini[IOX_BDEV_INI_ID]               (signal_vci_ini_bdev);
    11281100    iox_network->p_to_ini[IOX_CDMA_INI_ID]               (signal_vci_ini_cdma);
     
    11301102
    11311103    iox_network->p_to_tgt[IOX_IOB0_TGT_ID]               (signal_vci_tgt_iob0);
    1132     iox_network->p_to_tgt[IOX_IOB1_TGT_ID]               (signal_vci_tgt_iob1);
    11331104    iox_network->p_to_tgt[IOX_MTTY_TGT_ID]               (signal_vci_tgt_mtty);
    11341105    iox_network->p_to_tgt[IOX_FBUF_TGT_ID]               (signal_vci_tgt_fbuf);
     
    11391110    iox_network->p_to_tgt[IOX_IOPI_TGT_ID]               (signal_vci_tgt_iopi);
    11401111
     1112    if (cluster_iob0 != cluster_iob1)
     1113    {
     1114        iox_network->p_to_ini[IOX_IOB1_INI_ID]           (signal_vci_ini_iob1);
     1115        iox_network->p_to_tgt[IOX_IOB1_TGT_ID]           (signal_vci_tgt_iob1);
     1116    }
     1117
    11411118    // BDEV connexion
    1142         bdev->p_clk                                          (signal_clk);
     1119    bdev->p_clk                                          (signal_clk);
    11431120    bdev->p_resetn                                       (signal_resetn);
    11441121    bdev->p_irq                                          (signal_irq_bdev);
     
    11781155    mtty->p_resetn                                       (signal_resetn);
    11791156    mtty->p_vci                                          (signal_vci_tgt_mtty);
    1180     mtty->p_irq[0]                                              (signal_irq_mtty_rx);
     1157    mtty->p_irq[0]                                       (signal_irq_mtty_rx);
    11811158
    11821159    std::cout << "  - MTTY connected" << std::endl;
    11831160
    11841161    // CDMA connexion
    1185     cdma->p_clk                                         (signal_clk);
    1186     cdma->p_resetn                                      (signal_resetn);
    1187     cdma->p_vci_target                                  (signal_vci_tgt_cdma);
    1188     cdma->p_vci_initiator                               (signal_vci_ini_cdma);
     1162    cdma->p_clk                                          (signal_clk);
     1163    cdma->p_resetn                                       (signal_resetn);
     1164    cdma->p_vci_target                                   (signal_vci_tgt_cdma);
     1165    cdma->p_vci_initiator                                (signal_vci_ini_cdma);
    11891166    for ( size_t i=0 ; i<(NB_NIC_CHANNELS*2) ; i++)
    11901167    {
    1191         cdma->p_irq[i]                                 (signal_irq_cdma[i]);
     1168        cdma->p_irq[i]                                   (signal_irq_cdma[i]);
    11921169    }
    11931170
     
    11951172
    11961173    // IOPI connexion
    1197     iopi->p_clk                                         (signal_clk);
    1198     iopi->p_resetn                                      (signal_resetn);
    1199     iopi->p_vci_target                                  (signal_vci_tgt_iopi);
    1200     iopi->p_vci_initiator                               (signal_vci_ini_iopi);
     1174    iopi->p_clk                                          (signal_clk);
     1175    iopi->p_resetn                                       (signal_resetn);
     1176    iopi->p_vci_target                                   (signal_vci_tgt_iopi);
     1177    iopi->p_vci_initiator                                (signal_vci_ini_iopi);
    12011178    for ( size_t i=0 ; i<32 ; i++)
    12021179    {
     
    12141191    std::cout << "  - IOPIC connected" << std::endl;
    12151192
    1216    
     1193
    12171194    // IOB0 cluster connexion to IOX network
    1218     (*clusters[0][0]->p_vci_iob_iox_ini)               (signal_vci_ini_iob0);
    1219     (*clusters[0][0]->p_vci_iob_iox_tgt)               (signal_vci_tgt_iob0);
    1220 
    1221     // IOB1 cluster connexion to IOX network 
     1195    (*clusters[0][0]->p_vci_iob_iox_ini) (signal_vci_ini_iob0);
     1196    (*clusters[0][0]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob0);
     1197
     1198    // IOB1 cluster connexion to IOX network
    12221199    // (only when there is more than 1 cluster)
    12231200    if ( cluster_iob0 != cluster_iob1 )
     
    12721249   }
    12731250
    1274    std::cout << std::endl << "Horizontal connections established" << std::endl;   
     1251   std::cout << std::endl << "Horizontal connections established" << std::endl;
    12751252
    12761253   // Inter Clusters vertical connections
    1277    if (YMAX > 1) 
     1254   if (YMAX > 1)
    12781255   {
    12791256      for (size_t y = 0; y < (YMAX-1); y++)
     
    13301307      }
    13311308
    1332       if( y == 0 )        // handling IOB to RAM network connection in cluster_iob0
    1333       {
    1334          (*clusters[0][0]->p_dspin_iob_cmd_out)               (signal_dspin_cmd_iob0_loopback);
    1335          clusters[0][0]->p_dspin_ram_cmd_in[WEST]             (signal_dspin_cmd_iob0_loopback);
    1336 
    1337          clusters[0][0]->p_dspin_ram_cmd_out[WEST]            (signal_dspin_false_ram_cmd_out[0][0][WEST]);
    1338          clusters[0][0]->p_dspin_ram_rsp_in[WEST]             (signal_dspin_false_ram_rsp_in[0][0][WEST]);
    1339 
    1340          clusters[0][0]->p_dspin_ram_rsp_out[WEST]            (signal_dspin_rsp_iob0_loopback);
    1341          (*clusters[0][0]->p_dspin_iob_rsp_in)                (signal_dspin_rsp_iob0_loopback);
    1342 
    1343       }
    1344       else
    1345       {
    1346          clusters[0][y]->p_dspin_ram_cmd_in[WEST]             (signal_dspin_false_ram_cmd_in[0][y][WEST]);
    1347          clusters[0][y]->p_dspin_ram_cmd_out[WEST]            (signal_dspin_false_ram_cmd_out[0][y][WEST]);
    1348          clusters[0][y]->p_dspin_ram_rsp_in[WEST]             (signal_dspin_false_ram_rsp_in[0][y][WEST]);
    1349          clusters[0][y]->p_dspin_ram_rsp_out[WEST]            (signal_dspin_false_ram_rsp_out[0][y][WEST]);
    1350       }
    1351 
    1352       if( (y == YMAX-1) and (cluster_iob0 != cluster_iob1) )  // handling IOB to RAM network connection in cluster_iob1
    1353       {
    1354          (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_cmd_out)     (signal_dspin_cmd_iob1_loopback);
    1355          clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_in[EAST]   (signal_dspin_cmd_iob1_loopback);
    1356 
    1357          clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_out[EAST]  (signal_dspin_false_ram_cmd_out[XMAX-1][YMAX-1][EAST]);
    1358          clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_in[EAST]   (signal_dspin_false_ram_rsp_in[XMAX-1][YMAX-1][EAST]);
    1359 
    1360          clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_out[EAST]  (signal_dspin_rsp_iob1_loopback);
    1361          (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_rsp_in)      (signal_dspin_rsp_iob1_loopback);
    1362       }
    1363       else
    1364       {
    1365          clusters[XMAX-1][y]->p_dspin_ram_cmd_in[EAST]        (signal_dspin_false_ram_cmd_in[XMAX-1][y][EAST]);
    1366          clusters[XMAX-1][y]->p_dspin_ram_cmd_out[EAST]       (signal_dspin_false_ram_cmd_out[XMAX-1][y][EAST]);
    1367          clusters[XMAX-1][y]->p_dspin_ram_rsp_in[EAST]        (signal_dspin_false_ram_rsp_in[XMAX-1][y][EAST]);
    1368          clusters[XMAX-1][y]->p_dspin_ram_rsp_out[EAST]       (signal_dspin_false_ram_rsp_out[XMAX-1][y][EAST]);
    1369       }
     1309     clusters[0][y]->p_dspin_ram_cmd_in[WEST]       (signal_dspin_false_ram_cmd_in[0][y][WEST]);
     1310     clusters[0][y]->p_dspin_ram_cmd_out[WEST]      (signal_dspin_false_ram_cmd_out[0][y][WEST]);
     1311     clusters[0][y]->p_dspin_ram_rsp_in[WEST]       (signal_dspin_false_ram_rsp_in[0][y][WEST]);
     1312     clusters[0][y]->p_dspin_ram_rsp_out[WEST]      (signal_dspin_false_ram_rsp_out[0][y][WEST]);
     1313
     1314     clusters[XMAX-1][y]->p_dspin_ram_cmd_in[EAST]  (signal_dspin_false_ram_cmd_in[XMAX-1][y][EAST]);
     1315     clusters[XMAX-1][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][y][EAST]);
     1316     clusters[XMAX-1][y]->p_dspin_ram_rsp_in[EAST]  (signal_dspin_false_ram_rsp_in[XMAX-1][y][EAST]);
     1317     clusters[XMAX-1][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_false_ram_rsp_out[XMAX-1][y][EAST]);
    13701318   }
    13711319
     
    13911339      }
    13921340
    1393       clusters[x][0]->p_dspin_ram_cmd_in[SOUTH]               (signal_dspin_false_ram_cmd_in[x][0][SOUTH]);
    1394       clusters[x][0]->p_dspin_ram_cmd_out[SOUTH]              (signal_dspin_false_ram_cmd_out[x][0][SOUTH]);
    1395       clusters[x][0]->p_dspin_ram_rsp_in[SOUTH]               (signal_dspin_false_ram_rsp_in[x][0][SOUTH]);
    1396       clusters[x][0]->p_dspin_ram_rsp_out[SOUTH]              (signal_dspin_false_ram_rsp_out[x][0][SOUTH]);
    1397 
    1398       clusters[x][YMAX-1]->p_dspin_ram_cmd_in[NORTH]          (signal_dspin_false_ram_cmd_in[x][YMAX-1][NORTH]);
    1399       clusters[x][YMAX-1]->p_dspin_ram_cmd_out[NORTH]         (signal_dspin_false_ram_cmd_out[x][YMAX-1][NORTH]);
    1400       clusters[x][YMAX-1]->p_dspin_ram_rsp_in[NORTH]          (signal_dspin_false_ram_rsp_in[x][YMAX-1][NORTH]);
    1401       clusters[x][YMAX-1]->p_dspin_ram_rsp_out[NORTH]         (signal_dspin_false_ram_rsp_out[x][YMAX-1][NORTH]);
     1341      clusters[x][0]->p_dspin_ram_cmd_in[SOUTH]       (signal_dspin_false_ram_cmd_in[x][0][SOUTH]);
     1342      clusters[x][0]->p_dspin_ram_cmd_out[SOUTH]      (signal_dspin_false_ram_cmd_out[x][0][SOUTH]);
     1343      clusters[x][0]->p_dspin_ram_rsp_in[SOUTH]       (signal_dspin_false_ram_rsp_in[x][0][SOUTH]);
     1344      clusters[x][0]->p_dspin_ram_rsp_out[SOUTH]      (signal_dspin_false_ram_rsp_out[x][0][SOUTH]);
     1345
     1346      clusters[x][YMAX-1]->p_dspin_ram_cmd_in[NORTH]  (signal_dspin_false_ram_cmd_in[x][YMAX-1][NORTH]);
     1347      clusters[x][YMAX-1]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_false_ram_cmd_out[x][YMAX-1][NORTH]);
     1348      clusters[x][YMAX-1]->p_dspin_ram_rsp_in[NORTH]  (signal_dspin_false_ram_rsp_in[x][YMAX-1][NORTH]);
     1349      clusters[x][YMAX-1]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_false_ram_rsp_out[x][YMAX-1][NORTH]);
    14021350   }
    14031351
     
    14111359
    14121360   signal_resetn = false;
    1413 
    14141361   signal_irq_false = false;
    14151362
    1416    // only one cluster case:
    1417    if ( cluster_iob0 == cluster_iob1 )
    1418    {
    1419       signal_vci_ini_iob1.cmdval = false;
    1420       signal_vci_ini_iob1.rspack = true;
    1421       signal_vci_tgt_iob1.cmdack = true;
    1422       signal_vci_tgt_iob1.rspval = false;
    1423    }
    1424      
    14251363   // network boundaries signals
    14261364   for (size_t x = 0; x < XMAX ; x++)
     
    14781416            uint64_t ms2 = (uint64_t) t2.tv_sec  * 1000ULL +
    14791417                           (uint64_t) t2.tv_usec / 1000;
    1480             std::cerr << "### cycle = " << n 
    1481                       << " / frequency = " 
    1482                       << (double) 5000000 / (double) (ms2 - ms1) << "Khz"
     1418            std::cerr << "### cycle = " << n
     1419                      << " / frequency = "
     1420                      << (double) 1000000 / (double) (ms2 - ms1) << "Khz"
    14831421                      << std::endl;
    14841422
     
    15001438            std::cout << " ************************************************" << std::endl;
    15011439
    1502             // trace proc[debug_proc_id] 
     1440            // trace proc[debug_proc_id]
    15031441            if ( debug_proc_id != 0xFFFFFFFF )
    15041442            {
     
    15231461//              clusters[x][y]->signal_int_vci_tgt_mdma.print_trace(mdma_signame.str());
    15241462
    1525                 if( clusters[x][y]->signal_proc_it[l].read() ) 
     1463                if( clusters[x][y]->signal_proc_it[l].read() )
    15261464                    std::cout << "### IRQ_PROC_" << std::dec
    15271465                              << x << "_" << y << "_" << l << " ACTIVE" << std::endl;
    1528             }   
    1529 
    1530             // trace memc[debug_memc_id] 
     1466            }
     1467
     1468            // trace memc[debug_memc_id]
    15311469            if ( debug_memc_id != 0xFFFFFFFF )
    15321470            {
    15331471                size_t x = debug_memc_id >> 4;
    15341472                size_t y = debug_memc_id & 0xF;
    1535            
     1473
    15361474                clusters[x][y]->memc->print_trace(0);
    15371475                std::ostringstream smemc_tgt;
     
    15541492                size_t x = debug_xram_id >> 4;
    15551493                size_t y = debug_xram_id & 0xF;
    1556            
     1494
    15571495                clusters[x][y]->xram->print_trace();
    15581496                std::ostringstream sxram_tgt;
     
    15631501                clusters[x][y]->ram_router_rsp->print_trace();
    15641502            }
    1565        
    1566             // trace iob, iox and external peripherals 
     1503
     1504            // trace iob, iox and external peripherals
    15671505            if ( debug_iob )
    15681506            {
    15691507                clusters[0][0]->iob->print_trace();
    1570                 clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT");
    1571                 clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI");
    1572                 clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( "[SIG]IOB0_RAM_INI");
     1508                clusters[XMAX-1][YMAX-1]->iob->print_trace();
     1509//              clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT");
     1510//              clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI");
     1511//              clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( "[SIG]IOB0_RAM_INI");
    15731512
    15741513                signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI");
    15751514                signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT");
    1576 
    1577 //              signal_dspin_cmd_iob0_loopback.print_trace("[SIG]IOB0_CMD_LOOPBACK");
    1578 //              signal_dspin_rsp_iob0_loopback.print_trace("[SIG]IOB0_RSP_LOOPBACK");
    15791515
    15801516//              cdma->print_trace();
  • trunk/platforms/tsar_generic_iob/tsar_iob_cluster/caba/metadata/tsar_iob_cluster.sd

    r693 r718  
    5959              flit_width         = parameter.Reference('dspin_int_rsp_width')),
    6060
     61        Uses('caba:dspin_local_crossbar',
     62              flit_width         = parameter.Reference('dspin_ram_cmd_width')),
     63
     64        Uses('caba:dspin_local_crossbar',
     65              flit_width         = parameter.Reference('dspin_ram_rsp_width')),
     66
    6167        Uses('caba:vci_dspin_initiator_wrapper',
    6268              cell_size          = parameter.Reference('vci_data_width_int'),
     
    8692              dspin_rsp_width    = parameter.Reference('dspin_ram_rsp_width')),
    8793
    88         Uses('caba:dspin_router_tsar',
     94        Uses('caba:dspin_router',
    8995              flit_width         = parameter.Reference('dspin_ram_cmd_width')),
    9096
    91         Uses('caba:dspin_router_tsar',
     97        Uses('caba:dspin_router',
    9298              flit_width         = parameter.Reference('dspin_ram_rsp_width')),
    9399
  • trunk/platforms/tsar_generic_iob/tsar_iob_cluster/caba/source/include/tsar_iob_cluster.h

    r714 r718  
    2626#include "vci_dspin_initiator_wrapper.h"
    2727#include "vci_dspin_target_wrapper.h"
    28 #include "dspin_router_tsar.h"
     28#include "dspin_router.h"
    2929#include "virtual_dspin_router.h"
    3030#include "vci_multi_dma.h"
     
    5757    soclib::caba::VciTarget<vci_param_ext>*            p_vci_iob_iox_tgt;
    5858
    59     // These ports are used to connect IOB to RAM network in top cell
    60     soclib::caba::DspinOutput<dspin_ram_cmd_width>*    p_dspin_iob_cmd_out; 
    61     soclib::caba::DspinInput<dspin_ram_rsp_width>*     p_dspin_iob_rsp_in; 
    62 
    6359    // These arrays of ports are used to connect the INT & RAM networks in top cell
    6460    soclib::caba::DspinOutput<dspin_int_cmd_width>**   p_dspin_int_cmd_out;
     
    116112    VciSignals<vci_param_ext>             signal_ram_vci_tgt_xram;
    117113
    118     // RAM network DSPIN signals between VCI/DSPIN wrappers and routers
     114    // RAM network DSPIN signals between VCI/DSPIN wrappers, RAM dspin crossbar
     115    // and routers
    119116    DspinSignals<dspin_ram_cmd_width>     signal_ram_dspin_cmd_xram_t;
    120117    DspinSignals<dspin_ram_rsp_width>     signal_ram_dspin_rsp_xram_t;
    121118    DspinSignals<dspin_ram_cmd_width>     signal_ram_dspin_cmd_memc_i;
    122119    DspinSignals<dspin_ram_rsp_width>     signal_ram_dspin_rsp_memc_i;
     120    DspinSignals<dspin_ram_cmd_width>     signal_ram_dspin_cmd_iob_i;
     121    DspinSignals<dspin_ram_rsp_width>     signal_ram_dspin_rsp_iob_i;
     122    DspinSignals<dspin_ram_cmd_width>     signal_ram_dspin_cmd_xbar;
     123    DspinSignals<dspin_ram_rsp_width>     signal_ram_dspin_rsp_xbar;
     124    DspinSignals<dspin_ram_cmd_width>     signal_ram_dspin_cmd_false;
     125    DspinSignals<dspin_ram_rsp_width>     signal_ram_dspin_rsp_false;
    123126 
    124127    //////////////////////////////////////
     
    166169                          dspin_ram_rsp_width>*       xram_ram_wt;
    167170   
    168     DspinRouterTsar<dspin_ram_cmd_width>*             ram_router_cmd;
    169     DspinRouterTsar<dspin_ram_rsp_width>*             ram_router_rsp;
     171    DspinRouter<dspin_ram_cmd_width>*                 ram_router_cmd;
     172    DspinRouter<dspin_ram_rsp_width>*                 ram_router_rsp;
     173
     174    DspinLocalCrossbar<dspin_ram_cmd_width>*          ram_xbar_cmd;
     175    DspinLocalCrossbar<dspin_ram_rsp_width>*          ram_xbar_rsp;
     176   
    170177
    171178    // IO Network Components (not instanciated in all clusters)
     
    177184                             dspin_ram_cmd_width,
    178185                             dspin_ram_rsp_width>*    iob_ram_wi;
    179    
     186
    180187    // cluster constructor
    181188    TsarIobCluster( sc_module_name                     insname,
     
    195202                    size_t                             l_width,       // l field  bits
    196203
    197                     size_t                             int_memc_tgtid,
    198                     size_t                             int_xicu_tgtid,
    199                     size_t                             int_mdma_tgtid,
    200                     size_t                             int_iobx_tgtid,
    201 
    202                     size_t                             int_proc_srcid,
    203                     size_t                             int_mdma_srcid,
    204                     size_t                             int_iobx_srcid,
    205 
    206                     size_t                             ext_xram_tgtid,
    207 
    208                     size_t                             ext_memc_srcid,
    209                     size_t                             ext_iobx_srcid,
     204                    size_t                             int_memc_tgt_id,
     205                    size_t                             int_xicu_tgt_id,
     206                    size_t                             int_mdma_tgt_id,
     207                    size_t                             int_iobx_tgt_id,
     208                    size_t                             int_proc_ini_id,
     209                    size_t                             int_mdma_ini_id,
     210                    size_t                             int_iobx_ini_id,
     211
     212                    size_t                             ram_xram_tgt_id,
     213                    size_t                             ram_memc_ini_id,
     214                    size_t                             ram_iobx_ini_id,
     215
     216                    bool                               is_io,
     217                    size_t                             iox_iobx_tgt_id,
     218                    size_t                             iox_iobx_ini_id,
    210219
    211220                    size_t                             memc_ways,
     
    226235                    bool                               iob0_debug_ok );
    227236
     237  protected:
     238
     239    SC_HAS_PROCESS(TsarIobCluster);
     240
     241    void init();
     242 
     243
    228244};
    229245
     
    231247
    232248#endif
     249
     250// Local Variables:
     251// tab-width: 3
     252// c-basic-offset: 3
     253// c-file-offsets:((innamespace . 0)(inline-open . 0))
     254// indent-tabs-mode: nil
     255// End:
     256
     257// vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3
     258//
  • trunk/platforms/tsar_generic_iob/tsar_iob_cluster/caba/source/src/tsar_iob_cluster.cpp

    r714 r718  
    1515#include "../include/tsar_iob_cluster.h"
    1616
     17#define tmpl(x) \
     18   template<typename vci_param_int      , typename vci_param_ext,\
     19            size_t   dspin_int_cmd_width, size_t   dspin_int_rsp_width,\
     20            size_t   dspin_ram_cmd_width, size_t   dspin_ram_rsp_width>\
     21            x TsarIobCluster<\
     22                  vci_param_int      , vci_param_ext,\
     23                  dspin_int_cmd_width, dspin_int_rsp_width,\
     24                  dspin_ram_cmd_width, dspin_ram_rsp_width>
     25
    1726namespace soclib { namespace caba  {
    1827
     
    2029//                 Constructor
    2130//////////////////////////////////////////////////////////////////////////
    22 template<typename vci_param_int,
    23          typename vci_param_ext,
    24          size_t   dspin_int_cmd_width,
    25          size_t   dspin_int_rsp_width,
    26          size_t   dspin_ram_cmd_width,
    27          size_t   dspin_ram_rsp_width>
    28 TsarIobCluster<vci_param_int,
    29                vci_param_ext,
    30                dspin_int_cmd_width,
    31                dspin_int_rsp_width,
    32                dspin_ram_cmd_width,
    33                dspin_ram_rsp_width>::TsarIobCluster(
     31tmpl(/**/)::TsarIobCluster(
    3432//////////////////////////////////////////////////////////////////////////
    3533                    sc_module_name                     insname,
     
    4947                    size_t                             l_width,
    5048
    51                     size_t                             memc_int_tgtid,  // local index
    52                     size_t                             xicu_int_tgtid,  // local index
    53                     size_t                             mdma_int_tgtid,  // local index
    54                     size_t                             iobx_int_tgtid,  // local index
    55 
    56                     size_t                             proc_int_srcid,  // local index
    57                     size_t                             mdma_int_srcid,  // local index
    58                     size_t                             iobx_int_srcid,  // local index
    59 
    60                     size_t                             xram_ram_tgtid,  // local index
    61 
    62                     size_t                             memc_ram_srcid,  // local index
    63                     size_t                             iobx_ram_srcid,  // local index
     49                    size_t                             int_memc_tgt_id, // local index
     50                    size_t                             int_xicu_tgt_id, // local index
     51                    size_t                             int_mdma_tgt_id, // local index
     52                    size_t                             int_iobx_tgt_id, // local index
     53
     54                    size_t                             int_proc_ini_id, // local index
     55                    size_t                             int_mdma_ini_id, // local index
     56                    size_t                             int_iobx_ini_id, // local index
     57
     58                    size_t                             ram_xram_tgt_id, // local index
     59                    size_t                             ram_memc_ini_id, // local index
     60                    size_t                             ram_iobx_ini_id, // local index
     61
     62                    bool                               is_io,           // is IO cluster (IOB)?
     63                    size_t                             iox_iobx_tgt_id, // local_index
     64                    size_t                             iox_iobx_ini_id, // local index
    6465
    6566                    size_t                             memc_ways,
     
    8788    size_t cluster_id = (x_id<<4) + y_id;
    8889
    89     size_t cluster_iob0 = 0;                            // South-West cluster
    90     size_t cluster_iob1 = ((xmax-1)<<4) + ymax-1;       // North-East cluster
    91 
    9290    // Vectors of DSPIN ports for inter-cluster communications
    9391    p_dspin_int_cmd_in  = alloc_elems<DspinInput<dspin_int_cmd_width> >("p_int_cmd_in", 4, 3);
     
    10199    p_dspin_ram_rsp_out = alloc_elems<DspinOutput<dspin_ram_rsp_width> >("p_ext_rsp_out", 4);
    102100
    103     // ports in cluster_iob0 and cluster_iob1 only
    104     if ( (cluster_id == cluster_iob0) or (cluster_id == cluster_iob1) )
    105     {
    106         // VCI ports from IOB to IOX network
     101    // VCI ports from IOB to IOX network (only in IO clusters)
     102    if ( is_io )
     103    {
    107104        p_vci_iob_iox_ini = new soclib::caba::VciInitiator<vci_param_ext>;
    108105        p_vci_iob_iox_tgt = new soclib::caba::VciTarget<vci_param_ext>;
    109 
    110         // DSPIN ports from IOB to RAM network
    111         p_dspin_iob_cmd_out = new soclib::caba::DspinOutput<dspin_ram_cmd_width>;
    112         p_dspin_iob_rsp_in  = new soclib::caba::DspinInput<dspin_ram_rsp_width>;
    113106    }
    114107
     
    135128                      8,                              // DTLB ways
    136129                      8,                              // DTLB sets
    137                       l1_i_ways,l1_i_sets,16,         // ICACHE size
    138                       l1_d_ways,l1_d_sets,16,         // DCACHE size
     130                      l1_i_ways, l1_i_sets, 16,       // ICACHE size
     131                      l1_d_ways, l1_d_sets, 16,       // DCACHE size
    139132                      4,                              // WBUF nlines
    140133                      4,                              // WBUF nwords
     
    154147                           dspin_int_cmd_width>(
    155148                     s_memc.str().c_str(),
    156                      mt_int,                             // Mapping Table INT network
    157                      mt_ram,                             // Mapping Table RAM network
    158                      IntTab(cluster_id, memc_ram_srcid), // SRCID RAM network
    159                      IntTab(cluster_id, memc_int_tgtid), // TGTID INT network
    160                      x_width,                            // number of bits for x coordinate
    161                      y_width,                            // number of bits for y coordinate
    162                      memc_ways, memc_sets, 16,           // CACHE SIZE
    163                      3,                                  // MAX NUMBER OF COPIES
    164                      4096,                               // HEAP SIZE
    165                      8,                                  // TRANSACTION TABLE DEPTH
    166                      8,                                  // UPDATE TABLE DEPTH
    167                      8,                                  // INVALIDATE TABLE DEPTH
     149                     mt_int,                              // Mapping Table INT network
     150                     mt_ram,                              // Mapping Table RAM network
     151                     IntTab(cluster_id, ram_memc_ini_id), // SRCID RAM network
     152                     IntTab(cluster_id, int_memc_tgt_id), // TGTID INT network
     153                     x_width,                             // number of bits for x coordinate
     154                     y_width,                             // number of bits for y coordinate
     155                     memc_ways, memc_sets, 16,            // CACHE SIZE
     156                     3,                                   // MAX NUMBER OF COPIES
     157                     4096,                                // HEAP SIZE
     158                     8,                                   // TRANSACTION TABLE DEPTH
     159                     8,                                   // UPDATE TABLE DEPTH
     160                     8,                                   // INVALIDATE TABLE DEPTH
    168161                     debug_start_cycle,
    169162                     memc_debug_ok );
     
    182175    xicu = new VciXicu<vci_param_int>(
    183176                     s_xicu.str().c_str(),
    184                      mt_int,                            // mapping table INT network
    185                      IntTab(cluster_id,xicu_int_tgtid), // TGTID direct space
    186                      xcu_nb_inputs,                     // number of timer IRQs
    187                      xcu_nb_inputs,                     // number of hard IRQs
    188                      xcu_nb_inputs,                     // number of soft IRQs
    189                      16);                               // number of output IRQs
     177                     mt_int,                              // mapping table INT network
     178                     IntTab(cluster_id, int_xicu_tgt_id), // TGTID direct space
     179                     xcu_nb_inputs,                       // number of timer IRQs
     180                     xcu_nb_inputs,                       // number of hard IRQs
     181                     xcu_nb_inputs,                       // number of soft IRQs
     182                     16);                                 // number of output IRQs
    190183
    191184    ////////////  MDMA
     
    196189                     mt_int,
    197190                     IntTab(cluster_id, nb_procs),        // SRCID
    198                      IntTab(cluster_id, mdma_int_tgtid), // TGTID
     191                     IntTab(cluster_id, int_mdma_tgt_id), // TGTID
    199192                     64,                                  // burst size
    200193                     nb_dmas);                            // number of IRQs
    201194
    202195    ///////////  Direct LOCAL_XBAR(S)
    203     size_t nb_direct_initiators      = nb_procs + 1;
    204     size_t nb_direct_targets         = 3;
    205     if ( (cluster_id == cluster_iob0) or (cluster_id == cluster_iob1) )
    206     {
    207         nb_direct_initiators         = nb_procs + 2;
    208         nb_direct_targets            = 4;
    209     }
     196    size_t nb_direct_initiators = is_io ? nb_procs + 2 : nb_procs + 1;
     197    size_t nb_direct_targets    = is_io ? 4 : 3;
    210198
    211199    std::ostringstream s_int_xbar_d;
     
    304292    xram = new VciSimpleRam<vci_param_ext>(
    305293                     s_xram.str().c_str(),
    306                      IntTab(cluster_id, xram_ram_tgtid ),
     294                     IntTab(cluster_id, ram_xram_tgt_id),
    307295                     mt_ram,
    308296                     loader,
     
    320308    std::ostringstream s_ram_router_cmd;
    321309    s_ram_router_cmd << "ram_router_cmd_" << x_id << "_" << y_id;
    322     size_t is_iob0 = (x_id == 0) and (y_id == 0);
    323     size_t is_iob1 = (x_id == (xmax-1)) and (y_id == (ymax-1));
    324     ram_router_cmd = new DspinRouterTsar<dspin_ram_cmd_width>(
     310    ram_router_cmd = new DspinRouter<dspin_ram_cmd_width>(
    325311                     s_ram_router_cmd.str().c_str(),
    326312                     x_id, y_id,                     // router coordinates in mesh
    327313                     x_width,                        // x field width in first flit
    328314                     y_width,                        // y field width in first flit
    329                      4, 4,                           // input & output fifo depths
    330                      is_iob0,                        // cluster contains IOB0
    331                      is_iob1,                        // cluster contains IOB1
    332                      false,                          // not a response router
    333                      l_width);                       // local field width in first flit
     315                     4, 4);                          // input & output fifo depths
    334316
    335317    std::ostringstream s_ram_router_rsp;
    336318    s_ram_router_rsp << "ram_router_rsp_" << x_id << "_" << y_id;
    337     ram_router_rsp = new DspinRouterTsar<dspin_ram_rsp_width>(
     319    ram_router_rsp = new DspinRouter<dspin_ram_rsp_width>(
    338320                     s_ram_router_rsp.str().c_str(),
    339321                     x_id, y_id,                     // coordinates in mesh
    340322                     x_width,                        // x field width in first flit
    341323                     y_width,                        // y field width in first flit
    342                      4, 4,                           // input & output fifo depths
    343                      is_iob0,                        // cluster contains IOB0
    344                      is_iob1,                        // cluster contains IOB1
    345                      true,                           // response router
    346                      l_width);                       // local field width in first flit
     324                     4, 4);                          // input & output fifo depths
    347325
    348326
    349327    ////////////////////// I/O  CLUSTER ONLY    ///////////////////////
    350     if ( (cluster_id == cluster_iob0) or (cluster_id == cluster_iob1) )
     328    if ( is_io )
    351329    {
    352330        ///////////  IO_BRIDGE
    353         size_t iox_local_id;
    354         size_t global_id;
    355         if ( cluster_id == cluster_iob0 )
    356         {
    357             iox_local_id = 0;
    358             global_id    = cluster_iob0;
    359         }
    360         else
    361         {
    362             iox_local_id = 1;
    363             global_id    = cluster_iob1;
    364         }
    365 
    366331        std::ostringstream s_iob;
    367332        s_iob << "iob_" << x_id << "_" << y_id;   
     
    369334                              vci_param_ext>( 
    370335                     s_iob.str().c_str(),
    371                      mt_ram,                               // EXT network maptab
    372                      mt_int,                               // INT network maptab
    373                      mt_iox,                               // IOX network maptab
    374                      IntTab( global_id, iobx_int_tgtid ),  // INT TGTID
    375                      IntTab( global_id, iobx_int_srcid ),  // INT SRCID
    376                      IntTab( global_id, iox_local_id   ),  // IOX TGTID
    377                      16,                                   // cache line words
    378                      8,                                    // IOTLB ways
    379                      8,                                    // IOTLB sets
     336                     mt_ram,                                // EXT network maptab
     337                     mt_int,                                // INT network maptab
     338                     mt_iox,                                // IOX network maptab
     339                     IntTab( cluster_id, int_iobx_tgt_id ), // INT TGTID
     340                     IntTab( cluster_id, int_iobx_ini_id ), // INT SRCID
     341                     IntTab( 0         , iox_iobx_tgt_id ), // IOX TGTID
     342                     IntTab( 0         , iox_iobx_ini_id ), // IOX SRCID
     343                     16,                                    // cache line words
     344                     8,                                     // IOTLB ways
     345                     8,                                     // IOTLB sets
    380346                     debug_start_cycle,
    381347                     iob_debug_ok );
     
    387353                                                  dspin_ram_rsp_width>(
    388354                     s_iob_ram_wi.str().c_str(),
    389                      x_width + y_width + l_width);
     355                     vci_param_int::S);
     356
     357        std::ostringstream s_ram_xbar_cmd;
     358        s_ram_xbar_cmd << "s_ram_xbar_cmd_" << x_id << "_" << y_id;
     359        ram_xbar_cmd = new DspinLocalCrossbar<dspin_ram_cmd_width>(
     360              s_ram_xbar_cmd.str().c_str(), // name
     361              mt_ram,                       // mapping table
     362              x_id, y_id,                   // x, y
     363              x_width, y_width, l_width,    // x_width, y_width, l_width
     364              2, 0,                         // local inputs, local outputs
     365              2, 2,                         // in fifo, out fifo depths
     366              true,                         // is cmd ?
     367              false,                        // use routing table ?
     368              false);                       // support broadcast ?
     369
     370        std::ostringstream s_ram_xbar_rsp;
     371        s_ram_xbar_rsp << "s_ram_xbar_rsp_" << x_id << "_" << y_id;
     372        ram_xbar_rsp = new DspinLocalCrossbar<dspin_ram_rsp_width>(
     373              s_ram_xbar_rsp.str().c_str(), // name
     374              mt_ram,                       // mapping table
     375              x_id, y_id,                   // x, y
     376              x_width, y_width, l_width,    // x_width, y_width, l_width
     377              0, 2,                         // local inputs, local outputs
     378              2, 2,                         // in fifo, out fifo depths
     379              false,                        // is cmd ?
     380              true,                         // use routing table ?
     381              false);                       // support broadcast ?
    390382    } // end if IO
    391383
     
    396388    // on coherence network : local srcid[proc] in [0...nb_procs-1]
    397389    //                      : local srcid[memc] = nb_procs
    398     // In cluster_iob0, 32 HWI interrupts from external peripherals
    399     // are connected to the XICU ports p_hwi[0:31]
    400     // In other clusters, no HWI interrupts are connected to XICU
    401390 
    402391    //////////////////////// internal CMD & RSP routers
     
    440429    int_xbar_d->p_target_to_up                        (signal_int_vci_g2l);
    441430
    442     int_xbar_d->p_to_target[memc_int_tgtid]           (signal_int_vci_tgt_memc);
    443     int_xbar_d->p_to_target[xicu_int_tgtid]           (signal_int_vci_tgt_xicu);
    444     int_xbar_d->p_to_target[mdma_int_tgtid]           (signal_int_vci_tgt_mdma);
    445     int_xbar_d->p_to_initiator[mdma_int_srcid]        (signal_int_vci_ini_mdma);
     431    int_xbar_d->p_to_target[int_memc_tgt_id]          (signal_int_vci_tgt_memc);
     432    int_xbar_d->p_to_target[int_xicu_tgt_id]          (signal_int_vci_tgt_xicu);
     433    int_xbar_d->p_to_target[int_mdma_tgt_id]          (signal_int_vci_tgt_mdma);
     434    int_xbar_d->p_to_initiator[int_mdma_ini_id]       (signal_int_vci_ini_mdma);
    446435    for (size_t p = 0; p < nb_procs; p++)
    447        int_xbar_d->p_to_initiator[proc_int_srcid + p] (signal_int_vci_ini_proc[p]);
    448 
    449     if ( (cluster_id == cluster_iob0) or (cluster_id == cluster_iob1) )
    450     {
    451        int_xbar_d->p_to_target[iobx_int_tgtid]        (signal_int_vci_tgt_iobx);
    452        int_xbar_d->p_to_initiator[iobx_int_srcid]     (signal_int_vci_ini_iobx);
     436       int_xbar_d->p_to_initiator[int_proc_ini_id + p] (signal_int_vci_ini_proc[p]);
     437
     438    if ( is_io )
     439    {
     440       int_xbar_d->p_to_target[int_iobx_tgt_id]        (signal_int_vci_tgt_iobx);
     441       int_xbar_d->p_to_initiator[int_iobx_ini_id]     (signal_int_vci_ini_iobx);
    453442    }
    454443
     
    573562        ram_router_rsp->p_in[n]                  (this->p_dspin_ram_rsp_in[n]);
    574563    }
     564
    575565    ram_router_cmd->p_out[4]                     (signal_ram_dspin_cmd_xram_t);
    576     ram_router_cmd->p_in[4]                      (signal_ram_dspin_cmd_memc_i);
    577     ram_router_rsp->p_out[4]                     (signal_ram_dspin_rsp_memc_i);
    578566    ram_router_rsp->p_in[4]                      (signal_ram_dspin_rsp_xram_t);
     567
     568    if ( is_io )
     569    {
     570       ram_router_cmd->p_in[4]                   (signal_ram_dspin_cmd_xbar);
     571       ram_router_rsp->p_out[4]                  (signal_ram_dspin_rsp_xbar);
     572    }
     573    else
     574    {
     575       ram_router_cmd->p_in[4]                   (signal_ram_dspin_cmd_memc_i);
     576       ram_router_rsp->p_out[4]                  (signal_ram_dspin_rsp_memc_i);
     577    }
    579578   
    580579    ///////////////////////// IOB exists only in cluster_iob0 & cluster_iob1.
    581     if ( (cluster_id == cluster_iob0) or (cluster_id == cluster_iob1) )
     580    if ( is_io )
    582581    {
    583582        // IO bridge
    584         iob->p_clk                               (this->p_clk);
    585         iob->p_resetn                            (this->p_resetn);
    586         iob->p_vci_ini_iox                       (*(this->p_vci_iob_iox_ini));
    587         iob->p_vci_tgt_iox                       (*(this->p_vci_iob_iox_tgt));
    588         iob->p_vci_tgt_int                       (signal_int_vci_tgt_iobx);
    589         iob->p_vci_ini_int                       (signal_int_vci_ini_iobx);
    590         iob->p_vci_ini_ram                       (signal_ram_vci_ini_iobx);
     583        iob->p_clk                                 (this->p_clk);
     584        iob->p_resetn                              (this->p_resetn);
     585        iob->p_vci_ini_iox                         (*(this->p_vci_iob_iox_ini));
     586        iob->p_vci_tgt_iox                         (*(this->p_vci_iob_iox_tgt));
     587        iob->p_vci_tgt_int                         (signal_int_vci_tgt_iobx);
     588        iob->p_vci_ini_int                         (signal_int_vci_ini_iobx);
     589        iob->p_vci_ini_ram                         (signal_ram_vci_ini_iobx);
    591590
    592591        // initiator wrapper to RAM network
    593         iob_ram_wi->p_clk                        (this->p_clk);
    594         iob_ram_wi->p_resetn                     (this->p_resetn);
    595         iob_ram_wi->p_dspin_cmd                  (*(this->p_dspin_iob_cmd_out));
    596         iob_ram_wi->p_dspin_rsp                  (*(this->p_dspin_iob_rsp_in));
    597         iob_ram_wi->p_vci                        (signal_ram_vci_ini_iobx);
    598     }
    599 
     592        iob_ram_wi->p_clk                          (this->p_clk);
     593        iob_ram_wi->p_resetn                       (this->p_resetn);
     594        iob_ram_wi->p_dspin_cmd                    (signal_ram_dspin_cmd_iob_i);
     595        iob_ram_wi->p_dspin_rsp                    (signal_ram_dspin_rsp_iob_i);
     596        iob_ram_wi->p_vci                          (signal_ram_vci_ini_iobx);
     597
     598        // crossbar between MEMC and IOB to RAM network
     599        ram_xbar_cmd->p_clk                        (this->p_clk);
     600        ram_xbar_cmd->p_resetn                     (this->p_resetn);
     601        ram_xbar_cmd->p_global_out                 (signal_ram_dspin_cmd_xbar);
     602        ram_xbar_cmd->p_global_in                  (signal_ram_dspin_cmd_false);
     603        ram_xbar_cmd->p_local_in[ram_memc_ini_id]  (signal_ram_dspin_cmd_memc_i);
     604        ram_xbar_cmd->p_local_in[ram_iobx_ini_id]  (signal_ram_dspin_cmd_iob_i);
     605
     606        ram_xbar_rsp->p_clk                        (this->p_clk);
     607        ram_xbar_rsp->p_resetn                     (this->p_resetn);
     608        ram_xbar_rsp->p_global_out                 (signal_ram_dspin_rsp_false);
     609        ram_xbar_rsp->p_global_in                  (signal_ram_dspin_rsp_xbar);
     610        ram_xbar_rsp->p_local_out[ram_memc_ini_id] (signal_ram_dspin_rsp_memc_i);
     611        ram_xbar_rsp->p_local_out[ram_iobx_ini_id] (signal_ram_dspin_rsp_iob_i);
     612    }
     613
     614   SC_METHOD(init);
    600615} // end constructor
     616
     617tmpl(void)::init()
     618{
     619   signal_ram_dspin_cmd_false.write = false;
     620   signal_ram_dspin_cmd_false.read = true;
     621   signal_ram_dspin_rsp_false.write = false;
     622   signal_ram_dspin_rsp_false.read = true;
     623} // end init
    601624
    602625}}
     
    612635// vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3
    613636
    614 
    615 
Note: See TracChangeset for help on using the changeset viewer.