Ignore:
Timestamp:
Mar 29, 2013, 6:56:36 PM (11 years ago)
Author:
alain
Message:

New contructors for vci_mem_cache & vci_cc_vcache,
as we don't need anymore the mapping table for the coherence network...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/src/vci_cc_vcache_wrapper_dspin_coherence.cpp

    r341 r346  
    162162#define tmpl(...)  template<typename vci_param, typename iss_t> __VA_ARGS__ VciCcVCacheWrapper<vci_param, iss_t>
    163163
    164 using soclib::common::uint32_log2;
     164using namespace soclib::common;
    165165
    166166/////////////////////////////////
    167167tmpl(/**/)::VciCcVCacheWrapper(
    168168    sc_module_name                      name,
    169     int                                 proc_id,
    170     const soclib::common::MappingTable  &mtd,
    171     const soclib::common::MappingTable  &mtc,
    172     const soclib::common::IntTab        &initiator_index_d,
    173     const soclib::common::IntTab        &initiator_index_c,
    174     const soclib::common::IntTab        &target_index_c,
    175     size_t                              itlb_ways,
    176     size_t                              itlb_sets,
    177     size_t                              dtlb_ways,
    178     size_t                              dtlb_sets,
    179     size_t                              icache_ways,
    180     size_t                              icache_sets,
    181     size_t                              icache_words,
    182     size_t                              dcache_ways,
    183     size_t                              dcache_sets,
    184     size_t                              dcache_words,
    185     size_t                              wbuf_nlines,
    186     size_t                              wbuf_nwords,
    187     size_t                              x_width,
    188     size_t                              y_width,
    189     uint32_t                    memory_cache_local_id,
    190     uint32_t                    max_frozen_cycles,
    191     uint32_t                    debug_start_cycle,
    192     bool                                debug_ok)
     169    const int                           proc_id,
     170    const MappingTable      &mtd,
     171    const IntTab                &srcid,
     172    const size_t                cc_global_id,
     173    const size_t                        itlb_ways,
     174    const size_t                        itlb_sets,
     175    const size_t                        dtlb_ways,
     176    const size_t                        dtlb_sets,
     177    const size_t                        icache_ways,
     178    const size_t                        icache_sets,
     179    const size_t                        icache_words,
     180    const size_t                        dcache_ways,
     181    const size_t                        dcache_sets,
     182    const size_t                        dcache_words,
     183    const size_t                        wbuf_nlines,
     184    const size_t                        wbuf_nwords,
     185    const size_t                        x_width,
     186    const size_t                        y_width,
     187    const uint32_t                      max_frozen_cycles,
     188    const uint32_t                      debug_start_cycle,
     189    const bool                          debug_ok )
    193190    : soclib::caba::BaseModule(name),
    194191
    195       p_clk("clk"),
    196       p_resetn("resetn"),
    197       p_vci_ini_d("vci_ini_d"),
    198       p_dspin_in("dspin_in"),
    199       p_dspin_out("dspin_out"),
    200 
    201       m_cacheability_table(mtd.getCacheabilityTable()),
    202       m_segment(mtc.getSegment(target_index_c)),
    203       m_srcid_d(mtd.indexForId(initiator_index_d)),
    204       m_srcid_c(mtc.indexForId(initiator_index_c)),
    205 
    206       m_itlb_ways(itlb_ways),
    207       m_itlb_sets(itlb_sets),
    208 
    209       m_dtlb_ways(dtlb_ways),
    210       m_dtlb_sets(dtlb_sets),
    211 
    212       m_icache_ways(icache_ways),
    213       m_icache_sets(icache_sets),
    214       m_icache_yzmask((~0)<<(uint32_log2(icache_words) + 2)),
    215       m_icache_words(icache_words),
    216 
    217       m_dcache_ways(dcache_ways),
    218       m_dcache_sets(dcache_sets),
    219       m_dcache_yzmask((~0)<<(uint32_log2(dcache_words) + 2)),
    220       m_dcache_words(dcache_words),
    221 
    222       m_x_width(x_width),
    223       m_y_width(y_width),
    224 
    225       m_memory_cache_local_id(memory_cache_local_id),
    226       m_proc_id(proc_id),
    227       m_max_frozen_cycles(max_frozen_cycles),
    228       m_paddr_nbits(vci_param::N),
    229 
    230       m_debug_start_cycle(debug_start_cycle),
    231       m_debug_ok(debug_ok),
     192      p_clk("p_clk"),
     193      p_resetn("p_resetn"),
     194      p_vci("p_vci"),
     195      p_dspin_in("p_dspin_in"),
     196      p_dspin_out("p_dspin_out"),
     197
     198      m_cacheability_table( mtd.getCacheabilityTable() ),
     199      m_srcid( mtd.indexForId(srcid) ),
     200      m_cc_global_id( cc_global_id ),
     201      m_nline_width( vci_param::N - (uint32_log2(dcache_words)) - 2 ),
     202      m_itlb_ways( itlb_ways ),
     203      m_itlb_sets( itlb_sets ),
     204      m_dtlb_ways( dtlb_ways ),
     205      m_dtlb_sets( dtlb_sets ),
     206      m_icache_ways( icache_ways ),
     207      m_icache_sets( icache_sets ),
     208      m_icache_yzmask( (~0)<<(uint32_log2(icache_words) + 2) ),
     209      m_icache_words( icache_words ),
     210      m_dcache_ways( dcache_ways ),
     211      m_dcache_sets( dcache_sets ),
     212      m_dcache_yzmask( (~0)<<(uint32_log2(dcache_words) + 2) ),
     213      m_dcache_words( dcache_words ),
     214      m_x_width( x_width ),
     215      m_y_width( y_width ),
     216      m_proc_id( proc_id ),
     217      m_max_frozen_cycles( max_frozen_cycles ),
     218      m_paddr_nbits( vci_param::N ),
     219      m_debug_start_cycle( debug_start_cycle ),
     220      m_debug_ok( debug_ok ),
    232221
    233222      r_mmu_ptpr("r_mmu_ptpr"),
     
    30503039        // We should compute the access locality:
    30513040        // The PPN MSB bits define the destination cluster index.
    3052         // The m_srcid_d MSB bits define the source cluster index.
     3041        // The m_srcid MSB bits define the source cluster index.
    30533042        // The number of bits to compare depends on the number of clusters,
    30543043        // and can be obtained in the mapping table.
     
    33053294        // We should compute the access locality:
    33063295        // The PPN MSB bits define the destination cluster index.
    3307         // The m_srcid_d MSB bits define the source cluster index.
     3296        // The m_srcid MSB bits define the source cluster index.
    33083297        // The number of bits to compare depends on the number of clusters,
    33093298        // and can be obtained in the mapping table.
     
    50044993        case CMD_DATA_WRITE:
    50054994        {
    5006             if ( p_vci_ini_d.cmdack.read() )
     4995            if ( p_vci.cmdack.read() )
    50074996            {
    50084997                r_vci_cmd_cpt = r_vci_cmd_cpt + 1;
     
    50205009        {
    50215010            // The CAS and SC VCI commands contain two flits
    5022             if ( p_vci_ini_d.cmdack.read() )
     5011            if ( p_vci.cmdack.read() )
    50235012            {
    50245013               r_vci_cmd_cpt = r_vci_cmd_cpt + 1;
     
    50355024        {
    50365025            // all read VCI commands contain one single flit
    5037             if ( p_vci_ini_d.cmdack.read() )  r_vci_cmd_fsm = CMD_IDLE;
     5026            if ( p_vci.cmdack.read() )  r_vci_cmd_fsm = CMD_IDLE;
    50385027            break;
    50395028        }
     
    50735062    case RSP_IDLE:
    50745063    {
    5075         if ( p_vci_ini_d.rspval.read() )
     5064        if ( p_vci.rspval.read() )
    50765065        {
    50775066            r_vci_rsp_cpt = 0;
    50785067
    5079             if      ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_DATA_UNC  )
     5068            if      ( (p_vci.rpktid.read() & 0x7) ==  TYPE_READ_DATA_UNC  )
    50805069            {
    50815070                r_vci_rsp_fsm = RSP_DATA_UNC;
    50825071            }
    5083             else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_DATA_MISS )
     5072            else if ( (p_vci.rpktid.read() & 0x7) ==  TYPE_READ_DATA_MISS )
    50845073            {
    50855074                r_vci_rsp_fsm = RSP_DATA_MISS;
    50865075            }
    5087             else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_INS_UNC   )
     5076            else if ( (p_vci.rpktid.read() & 0x7) ==  TYPE_READ_INS_UNC   )
    50885077            {
    50895078                r_vci_rsp_fsm = RSP_INS_UNC;
    50905079            }
    5091             else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_INS_MISS  )
     5080            else if ( (p_vci.rpktid.read() & 0x7) ==  TYPE_READ_INS_MISS  )
    50925081            {
    50935082                r_vci_rsp_fsm = RSP_INS_MISS;
    50945083            }
    5095             else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_WRITE          )
     5084            else if ( (p_vci.rpktid.read() & 0x7) ==  TYPE_WRITE          )
    50965085            {
    50975086                r_vci_rsp_fsm = RSP_DATA_WRITE;
    50985087            }
    5099             else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_CAS            )
     5088            else if ( (p_vci.rpktid.read() & 0x7) ==  TYPE_CAS            )
    51005089            {
    51015090                r_vci_rsp_fsm = RSP_DATA_UNC;
    51025091            }
    5103             else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_LL             )
     5092            else if ( (p_vci.rpktid.read() & 0x7) ==  TYPE_LL             )
    51045093            {
    51055094                r_vci_rsp_fsm = RSP_DATA_LL;
    51065095            }
    5107             else if ( (p_vci_ini_d.rpktid.read() & 0x7) == TYPE_SC             )
     5096            else if ( (p_vci.rpktid.read() & 0x7) == TYPE_SC             )
    51085097            {
    51095098                r_vci_rsp_fsm = RSP_DATA_UNC;
     
    51195108        case RSP_INS_MISS:
    51205109        {
    5121             if ( p_vci_ini_d.rspval.read() )
    5122             {
    5123                 if ( (p_vci_ini_d.rerror.read()&0x1) != 0 )  // error reported
     5110            if ( p_vci.rspval.read() )
     5111            {
     5112                if ( (p_vci.rerror.read()&0x1) != 0 )  // error reported
    51245113                {
    51255114                    r_vci_rsp_ins_error = true;
    5126                     if ( p_vci_ini_d.reop.read() ) r_vci_rsp_fsm = RSP_IDLE;
     5115                    if ( p_vci.reop.read() ) r_vci_rsp_fsm = RSP_IDLE;
    51275116                }
    51285117                else                                        // no error reported
     
    51355124                        r_vci_rsp_cpt                 = r_vci_rsp_cpt.read() + 1;
    51365125                        vci_rsp_fifo_icache_put       = true,
    5137                         vci_rsp_fifo_icache_data      = p_vci_ini_d.rdata.read();
    5138                         if ( p_vci_ini_d.reop.read() )
     5126                        vci_rsp_fifo_icache_data      = p_vci.rdata.read();
     5127                        if ( p_vci.reop.read() )
    51395128                        {
    51405129                            assert( (r_vci_rsp_cpt.read() == m_icache_words - 1) and
     
    51515140        case RSP_INS_UNC:
    51525141        {
    5153             if (p_vci_ini_d.rspval.read() )
    5154             {
    5155                 assert( p_vci_ini_d.reop.read() and
     5142            if (p_vci.rspval.read() )
     5143            {
     5144                assert( p_vci.reop.read() and
    51565145                "illegal VCI response packet for uncachable instruction");
    51575146
    5158                 if ( (p_vci_ini_d.rerror.read()&0x1) != 0 )  // error reported
     5147                if ( (p_vci.rerror.read()&0x1) != 0 )  // error reported
    51595148                {
    51605149                    r_vci_rsp_ins_error = true;
     
    51665155                    {
    51675156                        vci_rsp_fifo_icache_put       = true;
    5168                         vci_rsp_fifo_icache_data      = p_vci_ini_d.rdata.read();
     5157                        vci_rsp_fifo_icache_data      = p_vci.rdata.read();
    51695158                        r_vci_rsp_fsm = RSP_IDLE;
    51705159                    }
     
    51765165        case RSP_DATA_MISS:
    51775166        {
    5178             if ( p_vci_ini_d.rspval.read() )
    5179             {
    5180                 if ( (p_vci_ini_d.rerror.read()&0x1) != 0 )  // error reported
     5167            if ( p_vci.rspval.read() )
     5168            {
     5169                if ( (p_vci.rerror.read()&0x1) != 0 )  // error reported
    51815170                {
    51825171                    r_vci_rsp_data_error = true;
    5183                     if ( p_vci_ini_d.reop.read() ) r_vci_rsp_fsm = RSP_IDLE;
     5172                    if ( p_vci.reop.read() ) r_vci_rsp_fsm = RSP_IDLE;
    51845173                }
    51855174                else                                        // no error reported
     
    51925181                        r_vci_rsp_cpt                 = r_vci_rsp_cpt.read() + 1;
    51935182                        vci_rsp_fifo_dcache_put       = true,
    5194                         vci_rsp_fifo_dcache_data      = p_vci_ini_d.rdata.read();
    5195                         if ( p_vci_ini_d.reop.read() )
     5183                        vci_rsp_fifo_dcache_data      = p_vci.rdata.read();
     5184                        if ( p_vci.reop.read() )
    51965185                        {
    51975186                            assert( (r_vci_rsp_cpt.read() == m_dcache_words - 1) and
     
    52085197        case RSP_DATA_UNC:
    52095198        {
    5210             if (p_vci_ini_d.rspval.read() )
    5211             {
    5212                 assert( p_vci_ini_d.reop.read() and
     5199            if (p_vci.rspval.read() )
     5200            {
     5201                assert( p_vci.reop.read() and
    52135202                "illegal VCI response packet for uncachable read data");
    52145203
    5215                 if ( (p_vci_ini_d.rerror.read()&0x1) != 0 )  // error reported
     5204                if ( (p_vci.rerror.read()&0x1) != 0 )  // error reported
    52165205                {
    52175206                    r_vci_rsp_data_error = true;
     
    52235212                    {
    52245213                        vci_rsp_fifo_dcache_put       = true;
    5225                         vci_rsp_fifo_dcache_data      = p_vci_ini_d.rdata.read();
     5214                        vci_rsp_fifo_dcache_data      = p_vci.rdata.read();
    52265215                        r_vci_rsp_fsm = RSP_IDLE;
    52275216                    }
     
    52335222        case RSP_DATA_LL:
    52345223        {
    5235             if ( p_vci_ini_d.rspval.read() )
    5236             {
    5237                 if ( (p_vci_ini_d.rerror.read()&0x1) != 0 )  // error reported
     5224            if ( p_vci.rspval.read() )
     5225            {
     5226                if ( (p_vci.rerror.read()&0x1) != 0 )  // error reported
    52385227                {
    52395228                    r_vci_rsp_data_error = true;
     
    52445233                    if(r_vci_rsp_fifo_dcache.wok())
    52455234                    {
    5246                         assert(!p_vci_ini_d.reop.read() &&
     5235                        assert(!p_vci.reop.read() &&
    52475236                            "illegal VCI response packet for LL");
    52485237                        vci_rsp_fifo_dcache_put  = true;
    5249                         vci_rsp_fifo_dcache_data = p_vci_ini_d.rdata.read();
     5238                        vci_rsp_fifo_dcache_data = p_vci.rdata.read();
    52505239                        r_vci_rsp_cpt            = r_vci_rsp_cpt.read() + 1;
    52515240                    }
     
    52565245                    if(r_vci_rsp_fifo_dcache.wok())
    52575246                    {
    5258                         assert(p_vci_ini_d.reop.read() &&
     5247                        assert(p_vci.reop.read() &&
    52595248                            "illegal VCI response packet for LL");
    52605249                        vci_rsp_fifo_dcache_put  = true;
    5261                         vci_rsp_fifo_dcache_data = p_vci_ini_d.rdata.read();
     5250                        vci_rsp_fifo_dcache_data = p_vci.rdata.read();
    52625251                        r_vci_rsp_fsm            = RSP_IDLE;
    52635252                    }
     
    52705259        case RSP_DATA_WRITE:
    52715260        {
    5272             if (p_vci_ini_d.rspval.read())
    5273             {
    5274                 assert( p_vci_ini_d.reop.read() and
     5261            if (p_vci.rspval.read())
     5262            {
     5263                assert( p_vci.reop.read() and
    52755264                "a VCI response packet must contain one flit for a write transaction");
    52765265
    52775266                r_vci_rsp_fsm = RSP_IDLE;
    5278                 uint32_t   wbuf_index = p_vci_ini_d.rtrdid.read();
     5267                uint32_t   wbuf_index = p_vci.rtrdid.read();
    52795268                bool       cacheable  = r_wbuf.completed(wbuf_index);
    52805269                if ( not cacheable ) r_dcache_pending_unc_write = false;
    5281                 if ( (p_vci_ini_d.rerror.read()&0x1) != 0 ) r_iss.setWriteBerr();
     5270                if ( (p_vci.rerror.read()&0x1) != 0 ) r_iss.setWriteBerr();
    52825271            }
    52835272            break;
     
    55455534        case CC_RECEIVE_INVAL_HEADER:
    55465535        {
    5547             // sample updt tab index in the HEADER, than skip to second flit
     5536            // sample updt tab index in the HEADER, then skip to second flit
    55485537            uint64_t receive_data = p_dspin_in.data.read();
    55495538            // for data INVAL, wait for dcache to take the request
     
    56835672                                 vci_rsp_fifo_dcache_put,
    56845673                                 vci_rsp_fifo_dcache_data);
     5674
    56855675    ///////////////// updt FIFO update  //////////////////////
    56865676    //TODO check this
     
    57085698                         (r_vci_cmd_fsm.read() == CMD_DATA_SC );
    57095699
    5710     p_vci_ini_d.pktid  = 0;
    5711     p_vci_ini_d.srcid  = m_srcid_d;
    5712     p_vci_ini_d.cons   = is_sc_or_cas;
    5713     p_vci_ini_d.contig = not is_sc_or_cas;
    5714     p_vci_ini_d.wrap   = false;
    5715     p_vci_ini_d.clen   = 0;
    5716     p_vci_ini_d.cfixed = false;
     5700    p_vci.pktid  = 0;
     5701    p_vci.srcid  = m_srcid;
     5702    p_vci.cons   = is_sc_or_cas;
     5703    p_vci.contig = not is_sc_or_cas;
     5704    p_vci.wrap   = false;
     5705    p_vci.clen   = 0;
     5706    p_vci.cfixed = false;
    57175707
    57185708    switch ( r_vci_cmd_fsm.read() ) {
    57195709
    57205710    case CMD_IDLE:
    5721         p_vci_ini_d.cmdval  = false;
    5722         p_vci_ini_d.address = 0;
    5723         p_vci_ini_d.wdata   = 0;
    5724         p_vci_ini_d.be      = 0;
    5725         p_vci_ini_d.trdid   = 0;
    5726         p_vci_ini_d.pktid   = 0;
    5727         p_vci_ini_d.plen    = 0;
    5728         p_vci_ini_d.cmd     = vci_param::CMD_NOP;
    5729         p_vci_ini_d.eop     = false;
     5711        p_vci.cmdval  = false;
     5712        p_vci.address = 0;
     5713        p_vci.wdata   = 0;
     5714        p_vci.be      = 0;
     5715        p_vci.trdid   = 0;
     5716        p_vci.pktid   = 0;
     5717        p_vci.plen    = 0;
     5718        p_vci.cmd     = vci_param::CMD_NOP;
     5719        p_vci.eop     = false;
    57305720        break;
    57315721
    57325722    case CMD_INS_MISS:
    5733         p_vci_ini_d.cmdval  = true;
    5734         p_vci_ini_d.address = r_icache_vci_paddr.read() & m_icache_yzmask;
    5735         p_vci_ini_d.wdata   = 0;
    5736         p_vci_ini_d.be      = 0xF;
    5737         p_vci_ini_d.trdid   = 0;
    5738         p_vci_ini_d.pktid   = TYPE_READ_INS_MISS;
    5739         p_vci_ini_d.plen    = m_icache_words<<2;
    5740         p_vci_ini_d.cmd     = vci_param::CMD_READ;
    5741         p_vci_ini_d.eop     = true;
     5723        p_vci.cmdval  = true;
     5724        p_vci.address = r_icache_vci_paddr.read() & m_icache_yzmask;
     5725        p_vci.wdata   = 0;
     5726        p_vci.be      = 0xF;
     5727        p_vci.trdid   = 0;
     5728        p_vci.pktid   = TYPE_READ_INS_MISS;
     5729        p_vci.plen    = m_icache_words<<2;
     5730        p_vci.cmd     = vci_param::CMD_READ;
     5731        p_vci.eop     = true;
    57425732        break;
    57435733
    57445734    case CMD_INS_UNC:
    5745         p_vci_ini_d.cmdval  = true;
    5746         p_vci_ini_d.address = r_icache_vci_paddr.read() & ~0x3;
    5747         p_vci_ini_d.wdata   = 0;
    5748         p_vci_ini_d.be      = 0xF;
    5749         p_vci_ini_d.trdid   = 0;
    5750         p_vci_ini_d.pktid   = TYPE_READ_INS_UNC;
    5751         p_vci_ini_d.plen    = 4;
    5752         p_vci_ini_d.cmd     = vci_param::CMD_READ;
    5753         p_vci_ini_d.eop     = true;
     5735        p_vci.cmdval  = true;
     5736        p_vci.address = r_icache_vci_paddr.read() & ~0x3;
     5737        p_vci.wdata   = 0;
     5738        p_vci.be      = 0xF;
     5739        p_vci.trdid   = 0;
     5740        p_vci.pktid   = TYPE_READ_INS_UNC;
     5741        p_vci.plen    = 4;
     5742        p_vci.cmd     = vci_param::CMD_READ;
     5743        p_vci.eop     = true;
    57545744        break;
    57555745
    57565746    case CMD_DATA_MISS:
    5757         p_vci_ini_d.cmdval  = true;
    5758         p_vci_ini_d.address = r_dcache_vci_paddr.read() & m_dcache_yzmask;
    5759         p_vci_ini_d.wdata   = 0;
    5760         p_vci_ini_d.be      = 0xF;
    5761         p_vci_ini_d.trdid   = 0;
    5762         p_vci_ini_d.pktid   = TYPE_READ_DATA_MISS;
    5763         p_vci_ini_d.plen    = m_dcache_words << 2;
    5764         p_vci_ini_d.cmd     = vci_param::CMD_READ;
    5765         p_vci_ini_d.eop     = true;
     5747        p_vci.cmdval  = true;
     5748        p_vci.address = r_dcache_vci_paddr.read() & m_dcache_yzmask;
     5749        p_vci.wdata   = 0;
     5750        p_vci.be      = 0xF;
     5751        p_vci.trdid   = 0;
     5752        p_vci.pktid   = TYPE_READ_DATA_MISS;
     5753        p_vci.plen    = m_dcache_words << 2;
     5754        p_vci.cmd     = vci_param::CMD_READ;
     5755        p_vci.eop     = true;
    57665756        break;
    57675757
    57685758    case CMD_DATA_UNC:
    5769         p_vci_ini_d.cmdval  = true;
    5770         p_vci_ini_d.address = r_dcache_vci_paddr.read() & ~0x3;
    5771         p_vci_ini_d.wdata   = 0;
    5772         p_vci_ini_d.be      = r_dcache_vci_unc_be.read();
    5773         p_vci_ini_d.trdid   = 0;
    5774         p_vci_ini_d.pktid   = TYPE_READ_DATA_UNC;
    5775         p_vci_ini_d.plen    = 4;
    5776         p_vci_ini_d.cmd     = vci_param::CMD_READ;
    5777         p_vci_ini_d.eop     = true;
     5759        p_vci.cmdval  = true;
     5760        p_vci.address = r_dcache_vci_paddr.read() & ~0x3;
     5761        p_vci.wdata   = 0;
     5762        p_vci.be      = r_dcache_vci_unc_be.read();
     5763        p_vci.trdid   = 0;
     5764        p_vci.pktid   = TYPE_READ_DATA_UNC;
     5765        p_vci.plen    = 4;
     5766        p_vci.cmd     = vci_param::CMD_READ;
     5767        p_vci.eop     = true;
    57785768        break;
    57795769
    57805770    case CMD_DATA_WRITE:
    5781         p_vci_ini_d.cmdval  = true;
    5782         p_vci_ini_d.address = r_wbuf.getAddress(r_vci_cmd_cpt.read()) & ~0x3;
    5783         p_vci_ini_d.wdata   = r_wbuf.getData(r_vci_cmd_cpt.read());
    5784         p_vci_ini_d.be      = r_wbuf.getBe(r_vci_cmd_cpt.read());
    5785         p_vci_ini_d.trdid   = r_wbuf.getIndex();
    5786         p_vci_ini_d.pktid   = TYPE_WRITE;
    5787         p_vci_ini_d.plen    = (r_vci_cmd_max.read() - r_vci_cmd_min.read() + 1) << 2;
    5788         p_vci_ini_d.cmd     = vci_param::CMD_WRITE;
    5789         p_vci_ini_d.eop     = (r_vci_cmd_cpt.read() == r_vci_cmd_max.read());
     5771        p_vci.cmdval  = true;
     5772        p_vci.address = r_wbuf.getAddress(r_vci_cmd_cpt.read()) & ~0x3;
     5773        p_vci.wdata   = r_wbuf.getData(r_vci_cmd_cpt.read());
     5774        p_vci.be      = r_wbuf.getBe(r_vci_cmd_cpt.read());
     5775        p_vci.trdid   = r_wbuf.getIndex();
     5776        p_vci.pktid   = TYPE_WRITE;
     5777        p_vci.plen    = (r_vci_cmd_max.read() - r_vci_cmd_min.read() + 1) << 2;
     5778        p_vci.cmd     = vci_param::CMD_WRITE;
     5779        p_vci.eop     = (r_vci_cmd_cpt.read() == r_vci_cmd_max.read());
    57905780        break;
    57915781
    57925782    case CMD_DATA_LL:
    5793         p_vci_ini_d.cmdval  = true;
    5794         p_vci_ini_d.address = r_dcache_vci_paddr.read() & ~0x3;
    5795         p_vci_ini_d.wdata   = 0;
    5796         p_vci_ini_d.be      = 0xF;
    5797         p_vci_ini_d.trdid   = 0;
    5798         p_vci_ini_d.pktid   = TYPE_LL;
    5799         p_vci_ini_d.plen    = 8;
    5800         p_vci_ini_d.cmd     = vci_param::CMD_LOCKED_READ;
    5801         p_vci_ini_d.eop     = true;
     5783        p_vci.cmdval  = true;
     5784        p_vci.address = r_dcache_vci_paddr.read() & ~0x3;
     5785        p_vci.wdata   = 0;
     5786        p_vci.be      = 0xF;
     5787        p_vci.trdid   = 0;
     5788        p_vci.pktid   = TYPE_LL;
     5789        p_vci.plen    = 8;
     5790        p_vci.cmd     = vci_param::CMD_LOCKED_READ;
     5791        p_vci.eop     = true;
    58025792        break;
    58035793
    58045794    case CMD_DATA_SC:
    5805         p_vci_ini_d.cmdval  = true;
    5806         p_vci_ini_d.address = r_dcache_vci_paddr.read() & ~0x3;
    5807         if ( r_vci_cmd_cpt.read() == 0 ) p_vci_ini_d.wdata = r_dcache_llsc_key.read();
    5808         else                             p_vci_ini_d.wdata = r_dcache_vci_sc_data.read();
    5809         p_vci_ini_d.be      = 0xF;
    5810         p_vci_ini_d.trdid   = 0;
    5811         p_vci_ini_d.pktid   = TYPE_SC;
    5812         p_vci_ini_d.plen    = 8;
    5813         p_vci_ini_d.cmd     = vci_param::CMD_NOP;
    5814         p_vci_ini_d.eop     = (r_vci_cmd_cpt.read() == 1);
     5795        p_vci.cmdval  = true;
     5796        p_vci.address = r_dcache_vci_paddr.read() & ~0x3;
     5797        if ( r_vci_cmd_cpt.read() == 0 ) p_vci.wdata = r_dcache_llsc_key.read();
     5798        else                             p_vci.wdata = r_dcache_vci_sc_data.read();
     5799        p_vci.be      = 0xF;
     5800        p_vci.trdid   = 0;
     5801        p_vci.pktid   = TYPE_SC;
     5802        p_vci.plen    = 8;
     5803        p_vci.cmd     = vci_param::CMD_NOP;
     5804        p_vci.eop     = (r_vci_cmd_cpt.read() == 1);
    58155805        break;
    58165806
    58175807    case CMD_DATA_CAS:
    5818         p_vci_ini_d.cmdval  = true;
    5819         p_vci_ini_d.address = r_dcache_vci_paddr.read() & ~0x3;
    5820         if ( r_vci_cmd_cpt.read() == 0 ) p_vci_ini_d.wdata = r_dcache_vci_cas_old.read();
    5821         else                             p_vci_ini_d.wdata = r_dcache_vci_cas_new.read();
    5822         p_vci_ini_d.be      = 0xF;
    5823         p_vci_ini_d.trdid   = 0;
    5824         p_vci_ini_d.pktid   = TYPE_CAS;
    5825         p_vci_ini_d.plen    = 8;
    5826         p_vci_ini_d.cmd     = vci_param::CMD_NOP;
    5827         p_vci_ini_d.eop     = (r_vci_cmd_cpt.read() == 1);
     5808        p_vci.cmdval  = true;
     5809        p_vci.address = r_dcache_vci_paddr.read() & ~0x3;
     5810        if ( r_vci_cmd_cpt.read() == 0 ) p_vci.wdata = r_dcache_vci_cas_old.read();
     5811        else                             p_vci.wdata = r_dcache_vci_cas_new.read();
     5812        p_vci.be      = 0xF;
     5813        p_vci.trdid   = 0;
     5814        p_vci.pktid   = TYPE_CAS;
     5815        p_vci.plen    = 8;
     5816        p_vci.cmd     = vci_param::CMD_NOP;
     5817        p_vci.eop     = (r_vci_cmd_cpt.read() == 1);
    58285818        break;
    58295819    } // end switch r_vci_cmd_fsm
    58305820
    58315821    // VCI initiator response on the direct network
    5832     // it depends on the VCI RSP state
     5822    // it depends on the VCI_RSP FSM
    58335823
    58345824    switch (r_vci_rsp_fsm.read() )
    58355825    {
    5836         case RSP_DATA_WRITE : p_vci_ini_d.rspack = true; break;
    5837         case RSP_INS_MISS   : p_vci_ini_d.rspack = r_vci_rsp_fifo_icache.wok(); break;
    5838         case RSP_INS_UNC    : p_vci_ini_d.rspack = r_vci_rsp_fifo_icache.wok(); break;
    5839         case RSP_DATA_MISS  : p_vci_ini_d.rspack = r_vci_rsp_fifo_dcache.wok(); break;
    5840         case RSP_DATA_UNC   : p_vci_ini_d.rspack = r_vci_rsp_fifo_dcache.wok(); break;
    5841         case RSP_DATA_LL    : p_vci_ini_d.rspack = r_vci_rsp_fifo_dcache.wok(); break;
    5842         case RSP_IDLE       : p_vci_ini_d.rspack = false; break;
     5826        case RSP_DATA_WRITE : p_vci.rspack = true; break;
     5827        case RSP_INS_MISS   : p_vci.rspack = r_vci_rsp_fifo_icache.wok(); break;
     5828        case RSP_INS_UNC    : p_vci.rspack = r_vci_rsp_fifo_icache.wok(); break;
     5829        case RSP_DATA_MISS  : p_vci.rspack = r_vci_rsp_fifo_dcache.wok(); break;
     5830        case RSP_DATA_UNC   : p_vci.rspack = r_vci_rsp_fifo_dcache.wok(); break;
     5831        case RSP_DATA_LL    : p_vci.rspack = r_vci_rsp_fifo_dcache.wok(); break;
     5832        case RSP_IDLE       : p_vci.rspack = false; break;
    58435833    } // end switch r_vci_rsp_fsm
    58445834
    5845     /////////////////
    5846     // CC_SEND FSM //
    5847     /////////////////
     5835   
     5836    // Send coherence packets on DSPIN L2M
     5837    // it depends on the CC_SEND FSM
     5838
    58485839    uint64_t dspin_send_data = 0;
    58495840    switch ( r_cc_send_fsm.read() )
    58505841    {
    5851         ///////////////////////////
     5842        //////////////////
    58525843        case CC_SEND_IDLE:
    58535844        {
     
    58555846            break;
    58565847        }
    5857         ///////////////////////////
     5848        ///////////////////////
    58585849        case CC_SEND_CLEANUP_1:
    58595850        {
    58605851            // initialize dspin send data
    5861             DspinDhccpParam::dspin_set(dspin_send_data,0,DspinDhccpParam::FROM_L1_EOP);
    5862             DspinDhccpParam::dspin_set(dspin_send_data,m_srcid_c,DspinDhccpParam::CLEANUP_SRCID);
    5863             DspinDhccpParam::dspin_set(dspin_send_data,0,DspinDhccpParam::FROM_L1_BC);
    5864             // dcache active request
    5865             if(r_cc_send_last_client.read() == 0)
    5866             {
    5867                 // compute global id
    5868                 uint32_t nline_size = vci_param::N - (uint32_log2(m_dcache_words)) - (uint32_log2(vci_param::B));
    5869                 uint64_t global_id = (uint64_t) r_dcache_cc_send_nline.read();
    5870                 global_id >>= (nline_size - m_x_width - m_y_width) << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
    5871 
     5852            DspinDhccpParam::dspin_set(dspin_send_data,
     5853                                       0,
     5854                                       DspinDhccpParam::FROM_L1_EOP);
     5855            DspinDhccpParam::dspin_set(dspin_send_data,
     5856                                       m_cc_global_id,
     5857                                       DspinDhccpParam::CLEANUP_SRCID);
     5858            DspinDhccpParam::dspin_set(dspin_send_data,
     5859                                       0,
     5860                                       DspinDhccpParam::FROM_L1_BC);
     5861
     5862            if(r_cc_send_last_client.read() == 0) // dcache active request
     5863            {
     5864                uint64_t dest = (uint64_t)r_dcache_cc_send_nline.read()
     5865                                >> (m_nline_width - m_x_width - m_y_width)
     5866                                << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
     5867 
    58725868                DspinDhccpParam::dspin_set(dspin_send_data,
    5873                     global_id,
    5874                     DspinDhccpParam::CLEANUP_DEST);
     5869                                           dest,
     5870                                           DspinDhccpParam::CLEANUP_DEST);
    58755871
    58765872                DspinDhccpParam::dspin_set(dspin_send_data,
    5877                     r_dcache_cc_send_nline.read() & 0x300000000ULL,
    5878                     DspinDhccpParam::CLEANUP_NLINE_MSB);
     5873                                           r_dcache_cc_send_nline.read() & 0x300000000ULL,
     5874                                           DspinDhccpParam::CLEANUP_NLINE_MSB);
    58795875
    58805876                DspinDhccpParam::dspin_set(dspin_send_data,
    5881                     r_dcache_cc_send_way.read(),
    5882                     DspinDhccpParam::CLEANUP_WAY_INDEX);
     5877                                           r_dcache_cc_send_way.read(),
     5878                                           DspinDhccpParam::CLEANUP_WAY_INDEX);
    58835879
    58845880                DspinDhccpParam::dspin_set(dspin_send_data,
    5885                     DspinDhccpParam::TYPE_CLEANUP_DATA,
    5886                     DspinDhccpParam::FROM_L1_TYPE);
    5887             }
    5888             // icache active request
    5889             else
    5890             {
    5891                 // compute global id
    5892                 uint32_t nline_size = vci_param::N - (uint32_log2(m_icache_words)) - (uint32_log2(vci_param::B));
    5893                 uint64_t global_id = (uint64_t) r_icache_cc_send_nline.read();
    5894                 global_id >>= (nline_size - m_x_width - m_y_width) << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
     5881                                           DspinDhccpParam::TYPE_CLEANUP_DATA,
     5882                                           DspinDhccpParam::FROM_L1_TYPE);
     5883            }
     5884            else                                // icache active request
     5885            {
     5886                uint64_t dest = (uint64_t)r_icache_cc_send_nline.read()
     5887                                >> (m_nline_width - m_x_width - m_y_width)
     5888                                << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
    58955889
    58965890                DspinDhccpParam::dspin_set(dspin_send_data,
    5897                     global_id,
    5898                     DspinDhccpParam::CLEANUP_DEST);
     5891                                           dest,
     5892                                           DspinDhccpParam::CLEANUP_DEST);
    58995893
    59005894                DspinDhccpParam::dspin_set(dspin_send_data,
    5901                     r_icache_cc_send_nline.read() & 0x300000000ULL,
    5902                     DspinDhccpParam::CLEANUP_NLINE_MSB);
     5895                                           r_icache_cc_send_nline.read() & 0x300000000ULL,
     5896                                           DspinDhccpParam::CLEANUP_NLINE_MSB);
    59035897
    59045898                DspinDhccpParam::dspin_set(dspin_send_data,
    5905                     r_icache_cc_send_way.read(),
    5906                     DspinDhccpParam::CLEANUP_WAY_INDEX);
     5899                                           r_icache_cc_send_way.read(),
     5900                                           DspinDhccpParam::CLEANUP_WAY_INDEX);
    59075901
    59085902                DspinDhccpParam::dspin_set(dspin_send_data,
    5909                     DspinDhccpParam::TYPE_CLEANUP_INST,
    5910                     DspinDhccpParam::FROM_L1_TYPE);
     5903                                           DspinDhccpParam::TYPE_CLEANUP_INST,
     5904                                           DspinDhccpParam::FROM_L1_TYPE);
    59115905            }
    59125906            // send flit
     
    59155909            break;
    59165910        }
    5917         ///////////////////////////
     5911        ///////////////////////
    59185912        case CC_SEND_CLEANUP_2:
    59195913        {
    59205914            // initialize dspin send data
    5921             DspinDhccpParam::dspin_set(dspin_send_data,1,DspinDhccpParam::FROM_L1_EOP);
    5922             // dcache active request
    5923             if(r_cc_send_last_client.read() == 0)
     5915            DspinDhccpParam::dspin_set(dspin_send_data,
     5916                                       1,
     5917                                       DspinDhccpParam::FROM_L1_EOP);
     5918
     5919            if(r_cc_send_last_client.read() == 0) // dcache active request
    59245920            {
    59255921                DspinDhccpParam::dspin_set(dspin_send_data,
    5926                     r_dcache_cc_send_nline.read() & 0xFFFFFFFFULL,
    5927                     DspinDhccpParam::CLEANUP_NLINE_LSB);
    5928             }
    5929             // icache active request
    5930             else
     5922                                           r_dcache_cc_send_nline.read() & 0xFFFFFFFFULL,
     5923                                           DspinDhccpParam::CLEANUP_NLINE_LSB);
     5924            }
     5925            else                                  // icache active request
    59315926            {
    59325927                DspinDhccpParam::dspin_set(dspin_send_data,
    5933                     r_icache_cc_send_nline.read() & 0xFFFFFFFFULL,
    5934                     DspinDhccpParam::CLEANUP_NLINE_LSB);
     5928                                           r_icache_cc_send_nline.read() & 0xFFFFFFFFULL,
     5929                                           DspinDhccpParam::CLEANUP_NLINE_LSB);
    59355930            }
    59365931            // send flit
     
    59395934            break;
    59405935        }
    5941         ///////////////////////////
     5936        ///////////////////////
    59425937        case CC_SEND_MULTI_ACK:
    59435938        {
    59445939            // initialize dspin send data
    5945             DspinDhccpParam::dspin_set(dspin_send_data,1,DspinDhccpParam::FROM_L1_EOP);
    5946             DspinDhccpParam::dspin_set(dspin_send_data,0,DspinDhccpParam::FROM_L1_BC);
    59475940            DspinDhccpParam::dspin_set(dspin_send_data,
    5948                 DspinDhccpParam::TYPE_MULTI_ACK,
    5949                 DspinDhccpParam::FROM_L1_TYPE);
    5950             // dcache active request
    5951             if(r_cc_send_last_client.read() == 0)
    5952             {
    5953                 // compute global id
    5954                 uint32_t nline_size = vci_param::N - (uint32_log2(m_dcache_words)) - (uint32_log2(vci_param::B));
    5955                 uint64_t global_id = (uint64_t) r_dcache_cc_send_nline.read();
    5956                 global_id >>= (nline_size - m_x_width - m_y_width) << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
    5957 
     5941                                       1,
     5942                                       DspinDhccpParam::FROM_L1_EOP);
     5943            DspinDhccpParam::dspin_set(dspin_send_data,
     5944                                       0,
     5945                                       DspinDhccpParam::FROM_L1_BC);
     5946            DspinDhccpParam::dspin_set(dspin_send_data,
     5947                                       DspinDhccpParam::TYPE_MULTI_ACK,
     5948                                       DspinDhccpParam::FROM_L1_TYPE);
     5949
     5950            if(r_cc_send_last_client.read() == 0) // dcache active request
     5951            {
     5952                uint64_t dest = (uint64_t)r_dcache_cc_send_nline.read()
     5953                                >> (m_nline_width - m_x_width - m_y_width)
     5954                                << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
     5955 
    59585956                DspinDhccpParam::dspin_set(dspin_send_data,
    5959                     global_id,
    5960                     DspinDhccpParam::MULTI_ACK_DEST);
     5957                                           dest,
     5958                                           DspinDhccpParam::MULTI_ACK_DEST);
    59615959
    59625960                DspinDhccpParam::dspin_set(dspin_send_data,
    5963                     r_dcache_cc_send_updt_tab_idx.read(),
    5964                     DspinDhccpParam::MULTI_ACK_UPDT_INDEX);
    5965             }
    5966             // icache active request
    5967             else
    5968             {
    5969                 // compute global id
    5970                 uint32_t nline_size = vci_param::N - (uint32_log2(m_icache_words)) - (uint32_log2(vci_param::B));
    5971                 uint64_t global_id = (uint64_t) r_icache_cc_send_nline.read();
    5972                 global_id >>= (nline_size - m_x_width - m_y_width) << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
     5961                                           r_dcache_cc_send_updt_tab_idx.read(),
     5962                                           DspinDhccpParam::MULTI_ACK_UPDT_INDEX);
     5963            }
     5964            else                                    // icache active request
     5965            {
     5966                uint64_t dest = (uint64_t)r_icache_cc_send_nline.read()
     5967                                >> (m_nline_width - m_x_width - m_y_width)
     5968                                << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
     5969 
    59735970
    59745971                DspinDhccpParam::dspin_set(dspin_send_data,
    5975                     global_id,
    5976                     DspinDhccpParam::MULTI_ACK_DEST);
     5972                                           dest,
     5973                                           DspinDhccpParam::MULTI_ACK_DEST);
    59775974
    59785975                DspinDhccpParam::dspin_set(dspin_send_data,
    5979                     r_icache_cc_send_updt_tab_idx.read(),
    5980                     DspinDhccpParam::MULTI_ACK_UPDT_INDEX);
     5976                                           r_icache_cc_send_updt_tab_idx.read(),
     5977                                           DspinDhccpParam::MULTI_ACK_UPDT_INDEX);
    59815978            }
    59825979            // send flit
     
    59875984    } // end switch CC_SEND FSM
    59885985
    5989     ////////////////////
    5990     // CC_RECEIVE FSM //
    5991     ////////////////////
     5986    // Receive coherence packets
     5987    // It depends on the CC_RECEIVE FSM
     5988
    59925989    switch( r_cc_receive_fsm.read() )
    59935990    {
Note: See TracChangeset for help on using the changeset viewer.