Changeset 446


Ignore:
Timestamp:
Jul 18, 2013, 11:37:47 AM (11 years ago)
Author:
cfuguet
Message:

Modifications in vci_cc_vcache_wrapper:

  • Merging the states DCACHE/ICACHE_CC_BROADCAST and DCACHE/ICACHE_CC_INVAL. This is because, the BROADCAST INVALIDATE and the MULTICAST INVALIDATE are both acknowledged by a CLEANUP.
  • Adding third port for the clack coherence network.
  • Renaming the port dspin_in to dspin_m2p and the port dspin_out to dspin_p2m
Location:
branches/v5/modules/vci_cc_vcache_wrapper/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/v5/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h

    r443 r446  
    8989        // handling coherence requests
    9090        ICACHE_CC_CHECK,
     91        ICACHE_CC_UPDT,
    9192        ICACHE_CC_INVAL,
    92         ICACHE_CC_UPDT,
    93         ICACHE_CC_BROADCAST,
    9493        ICACHE_CC_SEND_WAIT,
    9594    };
     
    138137        // handling coherence requests
    139138        DCACHE_CC_CHECK,
     139        DCACHE_CC_UPDT,
    140140        DCACHE_CC_INVAL,
    141         DCACHE_CC_UPDT,
    142         DCACHE_CC_BROADCAST,
    143141        DCACHE_CC_SEND_WAIT,
    144142        // handling TLB inval (after a coherence or XTN request)
     
    285283
    286284public:
    287     sc_in<bool>                                 p_clk;
    288     sc_in<bool>                                 p_resetn;
    289     sc_in<bool>                                 p_irq[iss_t::n_irq];
    290     soclib::caba::VciInitiator<vci_param>       p_vci;
    291     soclib::caba::DspinInput <dspin_in_width>   p_dspin_in;
    292     soclib::caba::DspinOutput<dspin_out_width>  p_dspin_out;
     285    sc_in<bool>                                p_clk;
     286    sc_in<bool>                                p_resetn;
     287    sc_in<bool>                                p_irq[iss_t::n_irq];
     288    soclib::caba::VciInitiator<vci_param>      p_vci;
     289    soclib::caba::DspinInput<dspin_in_width>   p_dspin_m2p;
     290    soclib::caba::DspinOutput<dspin_out_width> p_dspin_p2m;
     291    soclib::caba::DspinInput<dspin_in_width>   p_dspin_clack;
    293292
    294293private:
     
    371370    sc_signal<bool>         r_icache_cc_need_write;     // activate the cache for writing
    372371
     372    // coherence clack handling
     373    sc_signal<bool>         r_icache_clack_req;         // clack request
     374    sc_signal<size_t>       r_icache_clack_way;             // clack way
     375    sc_signal<size_t>       r_icache_clack_set;             // clack set
     376
    373377    // icache flush handling
    374378    sc_signal<size_t>       r_icache_flush_count;           // slot counter used for cache flush
     
    444448    sc_signal<bool>         r_dcache_cc_need_write;     // activate the cache for writing
    445449
     450    // coherence clack handling
     451    sc_signal<bool>         r_dcache_clack_req;         // clack request
     452    sc_signal<size_t>       r_dcache_clack_way;             // clack way
     453    sc_signal<size_t>       r_dcache_clack_set;             // clack set
     454
    446455    // dcache flush handling
    447456    sc_signal<size_t>       r_dcache_flush_count;           // slot counter used for cache flush
     
    537546    sc_signal<paddr_t>      r_cc_receive_dcache_nline;      // cache line physical address
    538547
     548    ///////////////////////////////////
     549    //  DSPIN CLACK INTERFACE REGISTER
     550    ///////////////////////////////////
     551    sc_signal<bool>         r_dspin_clack_req;
     552    sc_signal<uint64_t>     r_dspin_clack_flit;
     553   
    539554    //////////////////////////////////////////////////////////////////
    540555    // processor, write buffer, caches , TLBs
  • branches/v5/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r444 r446  
    6262
    6363        "ICACHE_CC_CHECK",
     64        "ICACHE_CC_UPDT",
    6465        "ICACHE_CC_INVAL",
    65         "ICACHE_CC_UPDT",
    66         "ICACHE_CC_BROADCAST",
    6766        "ICACHE_CC_SEND_WAIT",
    6867    };
     
    110109
    111110        "DCACHE_CC_CHECK",
     111        "DCACHE_CC_UPDT",
    112112        "DCACHE_CC_INVAL",
    113         "DCACHE_CC_UPDT",
    114         "DCACHE_CC_BROADCAST",
    115113        "DCACHE_CC_SEND_WAIT",
    116114
     
    216214      p_resetn("p_resetn"),
    217215      p_vci("p_vci"),
    218       p_dspin_in("p_dspin_in"),
    219       p_dspin_out("p_dspin_out"),
     216      p_dspin_m2p("p_dspin_m2p"),
     217      p_dspin_p2m("p_dspin_p2m"),
     218      p_dspin_clack("p_dspin_clack"),
    220219
    221220      m_cacheability_table( mtd.getCacheabilityTable() ),
     
    755754        r_icache_cc_send_req       = false;
    756755
     756        r_icache_clack_req         = false;
     757
    757758        // No pending write in pipeline
    758759        r_dcache_wbuf_req          = false;
     
    775776        r_dcache_cc_send_req       = false;
    776777
     778        r_dcache_clack_req         = false;
     779
    777780        // No request from CC_RECEIVE FSM to ICACHE/DCACHE FSMs
    778781        r_cc_receive_icache_req    = false;
     
    789792        r_icache_miss_inval        = false;
    790793        r_dcache_miss_inval        = false;
     794
     795        r_dspin_clack_req          = false;
    791796
    792797        // No signalisation  of errors
     
    10141019                        // 5/ uncacheable read miss                     => ICACHE_UNC_REQ
    10151020    {
     1021        // coherence clack interrupt
     1022        if ( r_icache_clack_req.read() )
     1023        {
     1024            r_icache_fsm = ICACHE_CC_CHECK;
     1025            r_icache_fsm_save = r_icache_fsm.read();
     1026            break;
     1027        }
     1028
    10161029        // coherence interrupt
    10171030        if ( r_cc_receive_icache_req.read() )
     
    12421255                            // external coherence request are accepted in this state.
    12431256    {
     1257        // coherence clack interrupt
     1258        if ( r_icache_clack_req.read() )
     1259        {
     1260            r_icache_fsm = ICACHE_CC_CHECK;
     1261            r_icache_fsm_save = r_icache_fsm.read();
     1262            break;
     1263        }
     1264
    12441265        // coherence interrupt
    12451266        if ( r_cc_receive_icache_req.read() )
     
    12861307                                        // A cleanup request is generated for each valid line
    12871308    {
     1309        // coherence clack interrupt
     1310        if ( r_icache_clack_req.read() )
     1311        {
     1312            r_icache_fsm = ICACHE_CC_CHECK;
     1313            r_icache_fsm_save = r_icache_fsm.read();
     1314            break;
     1315        }
     1316
    12881317        // coherence request (from CC_RECEIVE FSM)
    12891318        if ( r_cc_receive_icache_req.read() )
     
    14841513    {
    14851514        if (m_ireq.valid) m_cost_ins_miss_frz++;
     1515
     1516        // coherence clack interrupt
     1517        if ( r_icache_clack_req.read() )
     1518        {
     1519            r_icache_fsm = ICACHE_CC_CHECK;
     1520            r_icache_fsm_save = r_icache_fsm.read();
     1521            break;
     1522        }
    14861523
    14871524        // coherence interrupt
     
    15741611        if (m_ireq.valid) m_cost_ins_miss_frz++;
    15751612
     1613        // coherence clack interrupt
     1614        if ( r_icache_clack_req.read() )
     1615        {
     1616            r_icache_fsm = ICACHE_CC_CHECK;
     1617            r_icache_fsm_save = r_icache_fsm.read();
     1618            break;
     1619        }
     1620
    15761621        // coherence interrupt
    15771622        if ( r_cc_receive_icache_req.read() )
     
    16451690        if ( m_ireq.valid ) m_cost_ins_miss_frz++;
    16461691
     1692        // coherence clack interrupt
     1693        if ( r_icache_clack_req.read() )
     1694        {
     1695            r_icache_fsm = ICACHE_CC_CHECK;
     1696            r_icache_fsm_save = r_icache_fsm.read();
     1697            break;
     1698        }
     1699
    16471700        // coherence interrupt
    16481701        if ( r_cc_receive_icache_req.read() )
     
    17161769    case ICACHE_UNC_WAIT:       // waiting a response to an uncacheable read from VCI_RSP FSM
    17171770    {
     1771        // coherence clack interrupt
     1772        if ( r_icache_clack_req.read() )
     1773        {
     1774            r_icache_fsm = ICACHE_CC_CHECK;
     1775            r_icache_fsm_save = r_icache_fsm.read();
     1776            break;
     1777        }
     1778
    17181779        // coherence interrupt
    17191780        if ( r_cc_receive_icache_req.read() )
     
    17561817        paddr_t  mask  = ~((m_icache_words<<2)-1);
    17571818
    1758         if (r_cc_receive_icache_type.read() == CC_TYPE_CLACK)
     1819        if (r_icache_clack_req.read())
    17591820                                // We switch the directory slot to EMPTY state
    17601821                            // and reset r_icache_miss_clack if the cleanup ack
     
    17681829#endif
    17691830            r_icache.write_dir( 0,
    1770                                 r_cc_receive_icache_way.read(),
    1771                                 r_cc_receive_icache_set.read(),
     1831                                r_icache_clack_way.read(),
     1832                                r_icache_clack_set.read(),
    17721833                                CACHE_SLOT_STATE_EMPTY);
    17731834
    1774             if ( (r_icache_miss_set.read() == r_cc_receive_icache_set.read()) and
    1775                  (r_icache_miss_way.read() == r_cc_receive_icache_way.read()) )
     1835            if ( (r_icache_miss_set.read() == r_icache_clack_set.read()) and
     1836                 (r_icache_miss_way.read() == r_icache_clack_way.read()) )
    17761837                    r_icache_miss_clack = false;
    17771838
    17781839            r_icache_fsm = r_icache_fsm_save.read() ;
    1779             r_cc_receive_icache_req = false;
     1840            r_icache_clack_req = false;
    17801841
    17811842#if DEBUG_ICACHE
     
    17841845    std::cout << "  <PROC " << name()
    17851846    << " ICACHE_CC_CHECK>  CC_TYPE_CLACK slot returns to empty state"
    1786     << " set = " << r_cc_receive_icache_set.read()
    1787     << " / way = " << r_cc_receive_icache_way.read() << std::endl;
     1847    << " set = " << r_icache_clack_set.read()
     1848    << " / way = " << r_icache_clack_way.read() << std::endl;
    17881849}
    17891850#endif
     
    18401901            r_icache_cc_set = set;
    18411902
    1842             if ( state == CACHE_SLOT_STATE_VALID)            // hit
     1903            if (state == CACHE_SLOT_STATE_VALID)            // hit
    18431904            {
    18441905                // need to update the cache state
     
    18491910                    r_icache_cc_word      = r_cc_receive_word_idx.read();
    18501911                }
    1851                 else if (r_cc_receive_icache_type.read() == CC_TYPE_INVAL)   // hit inval
     1912                else if ((r_cc_receive_icache_type.read() == CC_TYPE_INVAL  ) || // hit inval
     1913                         (r_cc_receive_icache_type.read() == CC_TYPE_BRDCAST))   // hit broadcast
    18521914                {
    18531915                    r_icache_fsm          = ICACHE_CC_INVAL;
    1854                 }
    1855                 else if (r_cc_receive_icache_type.read() == CC_TYPE_BRDCAST)  // hit broadcast
    1856                 {
    1857                     r_icache_fsm          = ICACHE_CC_BROADCAST;
    18581916                }
    18591917            }
     
    18751933            }
    18761934        }
    1877         break;
    1878     }
    1879     /////////////////////
    1880     case ICACHE_CC_INVAL:       // hit inval : switch slot to EMPTY state
    1881     {
    1882 
    1883 #if DEBUG_ICACHE
    1884 if ( m_debug_activated )
    1885 {
    1886     std::cout << "  <PROC " << name()
    1887               << " ICACHE_CC_INVAL> slot returns to empty state"
    1888               << " set = " << r_icache_cc_set.read()
    1889               << " / way = " << r_icache_cc_way.read() << std::endl;
    1890 }
    1891 #endif
    1892 
    1893 #ifdef INSTRUMENTATION
    1894 m_cpt_icache_dir_read++;
    1895 #endif
    1896         if (r_icache_cc_need_write.read())
    1897         {
    1898             r_icache.write_dir( 0,
    1899                                     r_icache_cc_way.read(),
    1900                                     r_icache_cc_set.read(),
    1901                                 CACHE_SLOT_STATE_EMPTY );
    1902             // no need to write in the cache anymore
    1903             r_icache_cc_need_write = false;
    1904         }
    1905 
    1906         // multicast acknowledgement
    1907         // send a request to cc_send_fsm
    1908         if(not r_icache_cc_send_req.read()) // cc_send is available
    1909         {
    1910             // coherence request completed
    1911             r_cc_receive_icache_req = false;
    1912             // request multicast acknowledgement
    1913             r_icache_cc_send_req = true;
    1914             r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
    1915             r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
    1916             r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
    1917 
    1918             r_icache_fsm          = r_icache_fsm_save.read();
    1919         }
    1920         //else wait for previous cc_send request to be sent
    19211935        break;
    19221936    }
     
    19841998    }
    19851999    /////////////////////////
    1986     case ICACHE_CC_BROADCAST:  // hit broadcast : switch slot to ZOMBI state
    1987                                // and request a cleanup
     2000    case ICACHE_CC_INVAL:  // hit invalidate : switch slot to ZOMBI state
     2001                           // and request a cleanup
    19882002    {
    19892003
     
    19922006{
    19932007    std::cout << "  <PROC " << name()
    1994               << " ICACHE_CC_BROADCAST > Slot goes to zombi state "
     2008              << " ICACHE_CC_INVAL > Slot goes to zombi state "
    19952009              << " set = " << r_icache_cc_set.read()
    19962010              << " / way = " << r_icache_cc_way.read() << std::endl;
     
    23082322        }
    23092323
     2324        // coherence clack request (from DSPIN CLACK)
     2325        else if ( r_dcache_clack_req.read() )
     2326        {
     2327            r_dcache_fsm = DCACHE_CC_CHECK;
     2328            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     2329        }
    23102330        // coherence request (from CC_RECEIVE FSM)
    23112331        else if ( r_cc_receive_dcache_req.read() )
     
    29122932    case DCACHE_TLB_PTE1_GET:   // try to read a PT1 entry in dcache
    29132933    {
     2934        // coherence clack request (from DSPIN CLACK)
     2935        if ( r_dcache_clack_req.read() )
     2936        {
     2937            r_dcache_fsm = DCACHE_CC_CHECK;
     2938            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     2939            break;
     2940        }
     2941
    29142942        // coherence request (from CC_RECEIVE FSM)
    29152943        if ( r_cc_receive_dcache_req.read() )
     
    32093237    case DCACHE_TLB_PTE2_GET:   // Try to get a PTE2 (64 bits) in the dcache
    32103238    {
     3239        // coherence clack request (from DSPIN CLACK)
     3240        if ( r_dcache_clack_req.read() )
     3241        {
     3242            r_dcache_fsm = DCACHE_CC_CHECK;
     3243            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3244            break;
     3245        }
     3246
    32113247        // coherence request (from CC_RECEIVE FSM)
    32123248        if ( r_cc_receive_dcache_req.read() )
     
    35063542
    35073543    {
     3544        // coherence clack request (from DSPIN CLACK)
     3545        if ( r_dcache_clack_req.read() )
     3546        {
     3547            r_dcache_fsm = DCACHE_CC_CHECK;
     3548            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3549            break;
     3550        }
     3551
    35083552        // coherence request (from CC_RECEIVE FSM)
    35093553        if ( r_cc_receive_dcache_req.read() )
     
    35773621                                // as there is a risk of dead-lock
    35783622    {
     3623        // coherence clack request (from DSPIN CLACK)
     3624        if ( r_dcache_clack_req.read() )
     3625        {
     3626            r_dcache_fsm = DCACHE_CC_CHECK;
     3627            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3628            break;
     3629        }
     3630
    35793631        // coherence request (from CC_RECEIVE FSM)
    35803632        if ( r_cc_receive_dcache_req.read() )
     
    35823634            r_dcache_fsm = DCACHE_CC_CHECK;
    35833635            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3636            break;
    35843637        }
    35853638
     
    35983651                                    // and because it can exist a simultaneous ITLB miss
    35993652    {
     3653        // coherence clack request (from DSPIN CLACK)
     3654        if ( r_dcache_clack_req.read() )
     3655        {
     3656            r_dcache_fsm = DCACHE_CC_CHECK;
     3657            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3658            break;
     3659        }
     3660
    36003661        // coherence request (from CC_RECEIVE FSM)
    36013662        if ( r_cc_receive_dcache_req.read() )
     
    36333694                                // returns to IDLE and flush TLBs when last slot
    36343695    {
     3696        // coherence clack request (from DSPIN CLACK)
     3697        if ( r_dcache_clack_req.read() )
     3698        {
     3699            r_dcache_fsm = DCACHE_CC_CHECK;
     3700            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3701            break;
     3702        }
     3703
    36353704        // coherence request (from CC_RECEIVE FSM)
    36363705        if ( r_cc_receive_dcache_req.read() )
     
    38933962    {
    38943963        if ( m_dreq.valid) m_cost_data_miss_frz++;
     3964
     3965        // coherence clack request (from DSPIN CLACK)
     3966        if ( r_dcache_clack_req.read() )
     3967        {
     3968            r_dcache_fsm = DCACHE_CC_CHECK;
     3969            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3970            break;
     3971        }
    38953972
    38963973        // coherence request (from CC_RECEIVE FSM)
     
    40094086    {
    40104087        if ( m_dreq.valid) m_cost_data_miss_frz++;
     4088
     4089        // coherence clack request (from DSPIN CLACK)
     4090        if ( r_dcache_clack_req.read() )
     4091        {
     4092            r_dcache_fsm = DCACHE_CC_CHECK;
     4093            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4094            break;
     4095        }
    40114096
    40124097        // coherence request (from CC_RECEIVE FSM)
     
    41254210        if ( m_dreq.valid) m_cost_data_miss_frz++;
    41264211
     4212        // coherence clack request (from DSPIN CLACK)
     4213        if ( r_dcache_clack_req.read() )
     4214        {
     4215            r_dcache_fsm = DCACHE_CC_CHECK;
     4216            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4217            break;
     4218        }
     4219
    41274220        // coherence request (from CC_RECEIVE FSM)
    41284221        if ( r_cc_receive_dcache_req.read() )
     
    41994292    case DCACHE_UNC_WAIT:  // waiting a response to an uncacheable read
    42004293    {
     4294        // coherence clack request (from DSPIN CLACK)
     4295        if ( r_dcache_clack_req.read() )
     4296        {
     4297            r_dcache_fsm = DCACHE_CC_CHECK;
     4298            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4299            break;
     4300        }
     4301
    42014302        // coherence request (from CC_RECEIVE FSM)
    42024303        if ( r_cc_receive_dcache_req.read() )
     
    42364337    case DCACHE_LL_WAIT:    // waiting VCI response to a LL transaction
    42374338    {
     4339        // coherence clack request (from DSPIN CLACK)
     4340        if ( r_dcache_clack_req.read() )
     4341        {
     4342            r_dcache_fsm = DCACHE_CC_CHECK;
     4343            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4344            break;
     4345        }
     4346
    42384347        // coherence request (from CC_RECEIVE FSM)
    42394348        if ( r_cc_receive_dcache_req.read() )
     
    42824391    case DCACHE_SC_WAIT:        // waiting VCI response to a SC transaction
    42834392    {
     4393        // coherence clack request (from DSPIN CLACK)
     4394        if ( r_dcache_clack_req.read() )
     4395        {
     4396            r_dcache_fsm = DCACHE_CC_CHECK;
     4397            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4398            break;
     4399        }
     4400
    42844401        // coherence request (from CC_RECEIVE FSM)
    42854402        if ( r_cc_receive_dcache_req.read() )
     
    43744491                                    // - if the CAS is a failure, we just retry the write.
    43754492    {
     4493        // coherence clack request (from DSPIN CLACK)
     4494        if ( r_dcache_clack_req.read() )
     4495        {
     4496            r_dcache_fsm = DCACHE_CC_CHECK;
     4497            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4498            break;
     4499        }
     4500
    43764501        // coherence request (from CC_RECEIVE FSM)
    43774502        if ( r_cc_receive_dcache_req.read() )
     
    44324557#endif
    44334558
    4434         if (r_cc_receive_dcache_type.read() == CC_TYPE_CLACK)
     4559        if (r_dcache_clack_req.read())
    44354560                            // We switch the directory slot to EMPTY state
    44364561                            // and reset r_icache_miss_clack if the cleanup ack
     
    44444569#endif
    44454570            r_dcache.write_dir( 0,
    4446                                 r_cc_receive_dcache_way.read(),
    4447                                 r_cc_receive_dcache_set.read(),
     4571                                r_dcache_clack_way.read(),
     4572                                r_dcache_clack_set.read(),
    44484573                                CACHE_SLOT_STATE_EMPTY);
    44494574
    4450             if ( (r_dcache_miss_set.read() == r_cc_receive_dcache_set.read()) and
    4451                  (r_dcache_miss_way.read() == r_cc_receive_dcache_way.read()) )
     4575            if ( (r_dcache_miss_set.read() == r_dcache_clack_set.read()) and
     4576                 (r_dcache_miss_way.read() == r_dcache_clack_way.read()) )
    44524577                  r_dcache_miss_clack = false;
    44534578
    44544579            r_dcache_fsm = r_dcache_fsm_cc_save.read() ;
    4455             r_cc_receive_dcache_req = false;
     4580            r_dcache_clack_req = false;
    44564581#if DEBUG_DCACHE
    44574582if ( m_debug_activated )
     
    44594584    std::cout << "  <PROC " << name()
    44604585              << " DCACHE_CC_CHECK> CC_TYPE_CLACK Switch slot to EMPTY state"
    4461               << " set = " << r_cc_receive_dcache_set.read()
    4462               << " / way = " << r_cc_receive_dcache_way.read() << std::endl;
     4586              << " set = " << r_dcache_clack_set.read()
     4587              << " / way = " << r_dcache_clack_way.read() << std::endl;
    44634588}
    44644589#endif
     
    45264651                    r_dcache_cc_word      = r_cc_receive_word_idx.read();
    45274652                }
    4528                 else if (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL)   // hit inval
     4653                else if ((r_cc_receive_dcache_type.read() == CC_TYPE_BRDCAST) || // hit broadcast
     4654                         (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL  ))      // hit inval
    45294655                {
    45304656                    r_dcache_fsm          = DCACHE_CC_INVAL;
    4531                 }
    4532                 else if ( r_cc_receive_dcache_type.read() == CC_TYPE_BRDCAST)  // hit broadcast
    4533                 {
    4534                     r_dcache_fsm          = DCACHE_CC_BROADCAST;
    45354657                }
    45364658            }
     
    45654687        break;
    45664688    }
    4567     /////////////////////
    4568     case DCACHE_CC_INVAL:       // hit inval: switch slot to EMPTY state,
    4569                                 // after possible invalidation of copies in TLBs
    4570     {
    4571         size_t   way    = r_dcache_cc_way.read();
    4572         size_t   set    = r_dcache_cc_set.read();
    4573 
    4574         if (r_dcache_cc_need_write.read())
    4575         {
    4576             if ( r_dcache_in_tlb[way*m_dcache_sets+set] )                       // selective TLB inval
    4577             {
    4578                 r_dcache_in_tlb[way*m_dcache_sets+set] = false;
    4579                 r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
    4580                 r_dcache_tlb_inval_set   = 0;
    4581                 r_dcache_fsm_scan_save   = r_dcache_fsm.read();
    4582                 r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
    4583                 break;
    4584             }
    4585             else
    4586             {
    4587                 if ( r_dcache_contains_ptd[way*m_dcache_sets+set] )     // TLB flush
    4588                 {
    4589                     r_itlb.reset();
    4590                     r_dtlb.reset();
    4591                     r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
    4592 
    4593 #if DEBUG_DCACHE
    4594 if ( m_debug_activated )
    4595 {
    4596     std::cout << "  <PROC " << name()
    4597               << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl;
    4598 }
    4599 #endif
    4600                 }
    4601 
    4602                 r_dcache.write_dir( 0,
    4603                                     way,
    4604                                     set,
    4605                                     CACHE_SLOT_STATE_EMPTY );
    4606 
    4607                 r_dcache_cc_need_write = false;
    4608 
    4609 #if DEBUG_DCACHE
    4610 if ( m_debug_activated )
    4611 {
    4612     std::cout << "  <PROC " << name()
    4613               << " DCACHE_CC_INVAL> Switch slot to EMPTY state:" << std::dec
    4614               << " / WAY = " << way
    4615               << " / SET = " << set << std::endl;
    4616 }
    4617 #endif
    4618             }
    4619         }
    4620         // multicast acknowledgement
    4621         // send a request to cc_send_fsm
    4622         if(not r_dcache_cc_send_req.read()) // cc_send is available
    4623         {
    4624             // coherence request completed
    4625             r_cc_receive_dcache_req = false;
    4626             // request multicast acknowledgement
    4627             r_dcache_cc_send_req = true;
    4628             r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
    4629             r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
    4630             r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
    4631 
    4632             r_dcache_fsm          = r_dcache_fsm_cc_save.read();
    4633         }
    4634         //else wait for previous cc_send request to be sent
    4635         break;
    4636     }
    46374689    ///////////////////
    46384690    case DCACHE_CC_UPDT:        // hit update: write one word per cycle,
     
    47294781    }
    47304782    /////////////////////////
    4731     case DCACHE_CC_BROADCAST:   // hit broadcast : switch state to ZOMBI state
    4732                                 // and request a cleanup, after possible
    4733                                 // invalidation of copies in TLBs
     4783    case DCACHE_CC_INVAL:   // hit invalidate : switch state to ZOMBI state
     4784                            // and request a cleanup, after possible
     4785                            // invalidation of copies in TLBs
    47344786    {
    47354787        size_t   way   = r_dcache_cc_way.read();
     
    47604812{
    47614813    std::cout << "  <PROC " << name()
    4762               << " DCACHE_CC_BROADCAST> Flush DTLB & ITLB" << std::endl;
     4814              << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl;
    47634815}
    47644816#endif
     
    47774829{
    47784830    std::cout << "  <PROC " << name()
    4779               << " DCACHE_CC_BROADCAST > Slot goes to ZOMBI state "
     4831              << " DCACHE_CC_INVAL > Slot goes to ZOMBI state "
    47804832              << " SET = " << set
    47814833              << " / WAY = " << way << std::endl;
     
    53895441        {
    53905442            // wait for the first flit to be consumed
    5391             if (p_dspin_out.read.read())
     5443            if (p_dspin_p2m.read.read())
    53925444                r_cc_send_fsm = CC_SEND_CLEANUP_2;
    53935445
     
    53985450        {
    53995451            // wait for the second flit to be consumed
    5400             if (p_dspin_out.read.read())
     5452            if (p_dspin_p2m.read.read())
    54015453            {
    54025454                if (r_cc_send_last_client.read() == 0) // dcache active request
     
    54145466        {
    54155467            // wait for the flit to be consumed
    5416             if(p_dspin_out.read.read())
     5468            if(p_dspin_p2m.read.read())
    54175469            {
    54185470                if(r_cc_send_last_client.read() == 0) // dcache active request
     
    54455497        {
    54465498            // a coherence request has arrived
    5447             if (p_dspin_in.write.read())
     5499            if (p_dspin_m2p.write.read())
    54485500            {
    54495501                // initialize dspin received data
    5450                 uint64_t receive_data = p_dspin_in.data.read();
     5502                uint64_t receive_data = p_dspin_m2p.data.read();
    54515503                // initialize coherence packet type
    54525504                uint64_t receive_type = DspinDhccpParam::dspin_get(receive_data,
     
    54585510                {
    54595511                    r_cc_receive_fsm = CC_RECEIVE_BRDCAST_HEADER;
    5460                 }
    5461                 // test for a CLACK
    5462                 else if ((receive_type == DspinDhccpParam::TYPE_CLACK_DATA) or
    5463                          (receive_type == DspinDhccpParam::TYPE_CLACK_INST))
    5464                 {
    5465                     r_cc_receive_fsm = CC_RECEIVE_CLACK;
    54665512                }
    54675513                // test for a multi updt
     
    54795525            break;
    54805526        }
    5481         //////////////////////
    5482         case CC_RECEIVE_CLACK:
    5483         {
    5484             // initialize dspin received data
    5485             uint64_t receive_data = p_dspin_in.data.read();
    5486 
    5487             // for data CLACK, wait for dcache to take the request
    5488             if ((r_cc_receive_data_ins.read() == 0) and
    5489                    not (r_cc_receive_dcache_req.read()))
    5490             {
    5491                 // request dcache to handle the CLACK
    5492                 r_cc_receive_dcache_req  = true;
    5493                 r_cc_receive_dcache_set  = DspinDhccpParam::dspin_get(receive_data,
    5494                                            DspinDhccpParam::CLACK_SET) &
    5495                                            ((1ULL<<(uint32_log2(m_dcache_sets)))-1);
    5496                 r_cc_receive_dcache_way  = DspinDhccpParam::dspin_get(receive_data,
    5497                                            DspinDhccpParam::CLACK_WAY) &
    5498                                            ((1ULL<<(uint32_log2(m_dcache_ways)))-1);
    5499                 r_cc_receive_dcache_type = CC_TYPE_CLACK;
    5500                 // get back to idle state
    5501                 r_cc_receive_fsm = CC_RECEIVE_IDLE;
    5502                 break;
    5503             }
    5504             // for ins CLACK, wait for icache to take the request
    5505             if ((r_cc_receive_data_ins.read() == 1) and
    5506                    not (r_cc_receive_icache_req.read()))
    5507             {
    5508                 // request icache to handle the CLACK
    5509                 r_cc_receive_icache_req  = true;
    5510                 r_cc_receive_icache_set  = DspinDhccpParam::dspin_get(receive_data,
    5511                                            DspinDhccpParam::CLACK_SET) &
    5512                                            ((1ULL<<(uint32_log2(m_icache_sets)))-1);
    5513                 r_cc_receive_icache_way  = DspinDhccpParam::dspin_get(receive_data,
    5514                                            DspinDhccpParam::CLACK_WAY) &
    5515                                            ((1ULL<<(uint32_log2(m_icache_ways)))-1);
    5516                 r_cc_receive_icache_type = CC_TYPE_CLACK;
    5517                 // get back to idle state
    5518                 r_cc_receive_fsm = CC_RECEIVE_IDLE;
    5519                 break;
    5520             }
    5521             // keep waiting for the correct cache to accept the request
    5522             break;
    5523         }
    55245527        ///////////////////////////////
    55255528        case CC_RECEIVE_BRDCAST_HEADER:
     
    55335536        {
    55345537            // initialize dspin received data
    5535             uint64_t receive_data = p_dspin_in.data.read();
     5538            uint64_t receive_data = p_dspin_m2p.data.read();
    55365539            // wait for both dcache and icache to take the request
    55375540            // TODO maybe we need to wait for both only to leave the state, but
     
    55405543            if (not (r_cc_receive_icache_req.read()) and
    55415544                not (r_cc_receive_dcache_req.read()) and
    5542                 (p_dspin_in.write.read()))
     5545                (p_dspin_m2p.write.read()))
    55435546            {
    55445547                // request dcache to handle the BROADCAST
     
    55635566        {
    55645567            // sample updt tab index in the HEADER, then skip to second flit
    5565             uint64_t receive_data = p_dspin_in.data.read();
     5568            uint64_t receive_data = p_dspin_m2p.data.read();
    55665569            // for data INVAL, wait for dcache to take the request
    55675570            if ((r_cc_receive_data_ins.read() == 0) and
     
    55895592        {
    55905593            // sample nline in the second flit
    5591             uint64_t receive_data = p_dspin_in.data.read();
     5594            uint64_t receive_data = p_dspin_m2p.data.read();
    55925595            // for data INVAL, wait for dcache to take the request
    55935596            if ( (r_cc_receive_data_ins.read() == 0) and
    55945597                 not (r_cc_receive_dcache_req.read()) and
    5595                  (p_dspin_in.write.read()) )
     5598                 (p_dspin_m2p.write.read()) )
    55965599            {
    55975600                // request dcache to handle the INVAL
     
    56045607            }
    56055608            // for ins INVAL, wait for icache to take the request
    5606             if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_in.write.read()))
     5609            if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_m2p.write.read()))
    56075610            {
    56085611                // request icache to handle the INVAL
     
    56215624        {
    56225625            // sample updt tab index in the HEADER, than skip to second flit
    5623             uint64_t receive_data = p_dspin_in.data.read();
     5626            uint64_t receive_data = p_dspin_m2p.data.read();
    56245627            // for data INVAL, wait for dcache to take the request and fifo to
    56255628            // be empty
     
    56455648        {
    56465649            // sample nline and word index in the second flit
    5647             uint64_t receive_data = p_dspin_in.data.read();
     5650            uint64_t receive_data = p_dspin_m2p.data.read();
    56485651            // for data INVAL, wait for dcache to take the request and fifo to
    56495652            // be empty
     
    56515654                 not (r_cc_receive_dcache_req.read()) and
    56525655                 r_cc_receive_updt_fifo_be.empty() and
    5653                  (p_dspin_in.write.read()) )
     5656                 (p_dspin_m2p.write.read()) )
    56545657            {
    56555658                r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE);
     
    56655668                 not (r_cc_receive_icache_req.read()) and
    56665669                 r_cc_receive_updt_fifo_be.empty() and
    5667                  (p_dspin_in.write.read()))
     5670                 (p_dspin_m2p.write.read()))
    56685671            {
    56695672                r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE);
     
    56815684        case CC_RECEIVE_UPDT_DATA:
    56825685        {
    5683             if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read()) and (p_dspin_in.write.read()))
     5686            if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read()) and (p_dspin_m2p.write.read()))
    56845687                r_cc_receive_dcache_req = true;
    5685             if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_in.write.read()))
     5688            if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_m2p.write.read()))
    56865689                r_cc_receive_icache_req = true;
    56875690
    56885691            // wait for the fifo
    5689             if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_in.write.read()))
    5690             {
    5691                 uint64_t receive_data = p_dspin_in.data.read();
    5692                 bool     receive_eop  = p_dspin_in.eop.read();
     5692            if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_m2p.write.read()))
     5693            {
     5694                uint64_t receive_data = p_dspin_m2p.data.read();
     5695                bool     receive_eop  = p_dspin_m2p.eop.read();
    56935696                cc_receive_updt_fifo_be   = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_BE);
    56945697                cc_receive_updt_fifo_data = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_DATA);
     
    57005703        }
    57015704    } // end switch CC_RECEIVE FSM
     5705
     5706    ///////////////// DSPIN CLACK interface ///////////////
     5707   
     5708    uint64_t clack_type = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     5709                                                     DspinDhccpParam::CLACK_TYPE);
     5710
     5711    size_t clack_way  = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     5712                                                   DspinDhccpParam::CLACK_WAY);
     5713
     5714    size_t clack_set  = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     5715                                                   DspinDhccpParam::CLACK_SET);
     5716
     5717    bool dspin_clack_get      = false;
     5718    bool dcache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_DATA);
     5719    bool icache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_INST);
     5720
     5721    if (r_dspin_clack_req.read())
     5722    {
     5723        // CLACK DATA: Send request to DCACHE FSM
     5724        if (dcache_clack_request and not r_dcache_clack_req.read()){
     5725            r_dcache_clack_req = true;
     5726            r_dcache_clack_way = clack_way & ((1ULL<<(uint32_log2(m_dcache_ways)))-1);
     5727            r_dcache_clack_set = clack_set & ((1ULL<<(uint32_log2(m_dcache_sets)))-1);
     5728            dspin_clack_get    = true;
     5729        }
     5730
     5731        // CLACK INST: Send request to ICACHE FSM
     5732        else if (icache_clack_request and not r_icache_clack_req.read()){
     5733            r_icache_clack_req = true;
     5734            r_icache_clack_way = clack_way & ((1ULL<<(uint32_log2(m_dcache_ways)))-1);
     5735            r_icache_clack_set = clack_set & ((1ULL<<(uint32_log2(m_icache_sets)))-1);
     5736            dspin_clack_get    = true;
     5737        }
     5738    }
     5739    else
     5740    {
     5741        dspin_clack_get = true;
     5742    }
     5743
     5744    if (dspin_clack_get)
     5745    {
     5746        r_dspin_clack_req  = p_dspin_clack.write.read();
     5747        r_dspin_clack_flit = p_dspin_clack.data.read();
     5748    }
    57025749
    57035750    ///////////////// Response FIFOs update  //////////////////////
     
    58975944        case CC_SEND_IDLE:
    58985945        {
    5899             p_dspin_out.write = false;
     5946            p_dspin_p2m.write = false;
    59005947            break;
    59015948        }
     
    59596006            }
    59606007            // send flit
    5961             p_dspin_out.data  = dspin_send_data;
    5962             p_dspin_out.write = true;
    5963             p_dspin_out.eop   = false;
     6008            p_dspin_p2m.data  = dspin_send_data;
     6009            p_dspin_p2m.write = true;
     6010            p_dspin_p2m.eop   = false;
    59646011            break;
    59656012        }
     
    59856032            }
    59866033            // send flit
    5987             p_dspin_out.data  = dspin_send_data;
    5988             p_dspin_out.write = true;
    5989             p_dspin_out.eop   = true;
     6034            p_dspin_p2m.data  = dspin_send_data;
     6035            p_dspin_p2m.write = true;
     6036            p_dspin_p2m.eop   = true;
    59906037            break;
    59916038        }
     
    60346081            }
    60356082            // send flit
    6036             p_dspin_out.data  = dspin_send_data;
    6037             p_dspin_out.write = true;
    6038             p_dspin_out.eop   = true;
     6083            p_dspin_p2m.data  = dspin_send_data;
     6084            p_dspin_p2m.write = true;
     6085            p_dspin_p2m.eop   = true;
    60396086
    60406087            break;
     
    60506097        case CC_RECEIVE_IDLE:
    60516098        {
    6052             p_dspin_in.read = false;
     6099            p_dspin_m2p.read = false;
    60536100            break;
    60546101        }
     
    60586105            if (((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) or
    60596106                ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())))
    6060                 p_dspin_in.read = true;
     6107                p_dspin_m2p.read = true;
    60616108            else
    6062                 p_dspin_in.read = false;
     6109                p_dspin_m2p.read = false;
    60636110            break;
    60646111        }
     
    60666113        case CC_RECEIVE_BRDCAST_HEADER:
    60676114        {
    6068             p_dspin_in.read = true;
     6115            p_dspin_m2p.read = true;
    60696116            break;
    60706117        }
     
    60766123            // flip_flop to check that ?
    60776124            if (not (r_cc_receive_icache_req.read()) and not (r_cc_receive_dcache_req.read()))
    6078                 p_dspin_in.read = true;
     6125                p_dspin_m2p.read = true;
    60796126            else
    6080                 p_dspin_in.read = false;
     6127                p_dspin_m2p.read = false;
    60816128            break;
    60826129        }
     
    60866133            if (((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) or
    60876134                ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())))
    6088                 p_dspin_in.read = true;
     6135                p_dspin_m2p.read = true;
    60896136            else
    6090                 p_dspin_in.read = false;
     6137                p_dspin_m2p.read = false;
    60916138            break;
    60926139        }
     
    60946141        case CC_RECEIVE_INVAL_NLINE:
    60956142        {
    6096             p_dspin_in.read = true;
     6143            p_dspin_m2p.read = true;
    60976144            break;
    60986145        }
     
    61076154                not r_cc_receive_icache_req.read()) and
    61086155                r_cc_receive_updt_fifo_be.empty()))
    6109                 p_dspin_in.read = true;
     6156                p_dspin_m2p.read = true;
    61106157            else
    6111                 p_dspin_in.read = false;
     6158                p_dspin_m2p.read = false;
    61126159            break;
    61136160        }
     
    61226169                not (r_cc_receive_icache_req.read()) and
    61236170                r_cc_receive_updt_fifo_be.empty()))
    6124                 p_dspin_in.read = true;
     6171                p_dspin_m2p.read = true;
    61256172            else
    6126                 p_dspin_in.read = false;
     6173                p_dspin_m2p.read = false;
    61276174            break;
    61286175        }
     
    61316178        {
    61326179            if (r_cc_receive_updt_fifo_be.wok())
    6133                 p_dspin_in.read = true;
     6180                p_dspin_m2p.read = true;
    61346181            else
    6135                 p_dspin_in.read = false;
     6182                p_dspin_m2p.read = false;
    61366183            break;
    61376184        }
    61386185    } // end switch CC_RECEIVE FSM
    61396186
     6187    int clack_type = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6188                                                DspinDhccpParam::CLACK_TYPE);
     6189
     6190    bool dspin_clack_get      = false;
     6191    bool dcache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_DATA);
     6192    bool icache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_INST);
     6193
     6194    if (r_dspin_clack_req.read())
     6195    {
     6196        // CLACK DATA: wait if pending request to DCACHE FSM
     6197        if (dcache_clack_request and not r_dcache_clack_req.read())
     6198        {
     6199            dspin_clack_get = true;
     6200        }
     6201
     6202        // CLACK INST: wait if pending request to ICACHE FSM
     6203        else if (icache_clack_request and not r_icache_clack_req.read())
     6204        {
     6205            dspin_clack_get = true;
     6206        }
     6207    }
     6208    else
     6209    {
     6210        dspin_clack_get = true;
     6211    }
     6212
     6213    p_dspin_clack.read = dspin_clack_get;
    61406214} // end genMoore
    61416215
Note: See TracChangeset for help on using the changeset viewer.