Changeset 678


Ignore:
Timestamp:
Apr 15, 2014, 1:41:08 PM (10 years ago)
Author:
haoliu
Message:

MESI bug fixed: in multi_ack fsm:
Can't release the directory allocation while the multi ack fsm access the ivt table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MESI/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r677 r678  
    19761976                    else
    19771977                    {
    1978                         r_multi_ack_fsm = MULTI_ACK_IVT_LOCK;
     1978                        r_multi_ack_fsm = MULTI_ACK_DIR_REQ;
    19791979                        r_multi_ack_need_data = false;
    19801980                    }
     
    20242024                        {
    20252025                            assert( eop && "the last word has been received in multi ack data");
    2026                             r_multi_ack_fsm       = MULTI_ACK_IVT_LOCK;
     2026                            r_multi_ack_fsm       = MULTI_ACK_DIR_REQ;
    20272027                        }
    20282028
     
    20342034                {
    20352035                    if(r_alloc_ivt_fsm.read() != ALLOC_IVT_MULTI_ACK)  break;
     2036                    assert( r_alloc_dir_fsm.read() == ALLOC_DIR_MULTI_ACK && " BAD ALLOC_DIR_MULTI_ACK IN MULTI_ACK_IVT_LOCK STATE");
    20362037                    size_t index  = r_multi_ack_ivt_index.read();
    20372038                    size_t count  = m_ivt.count(index);
     
    20442045                    //bool is_valid = m_ivt.is_valid(index);
    20452046
    2046                     if(r_multi_ack_miss_updt.read())
    2047                     {
    2048                         r_multi_ack_fsm = MULTI_ACK_DIR_REQ;
    2049                     }                   
    2050                     else
    2051                     {
     2047                    // if(r_multi_ack_miss_updt.read())
     2048                    //{
     2049                        r_multi_ack_fsm = MULTI_ACK_DIR_LOCK; // this way may be bring about the problem of critical path
     2050                    //}                   
     2051                    //else
     2052                    //{
    20522053                        bool is_updt  = m_ivt.is_update(index);
    20532054                   
     
    20552056                        assert(count == 1 && "there is only one copy in the memc");
    20562057
    2057                         r_multi_ack_fsm = MULTI_ACK_IVT_CLEAR;
     2058                    //  r_multi_ack_fsm = MULTI_ACK_IVT_CLEAR;
    20582059
    20592060#if DEBUG_MEMC_MULTI_ACK
    20602061                    if(m_debug)
    20612062                        std::cout << "  <MEMC " << name()
    2062                             << " MULTI_ACK_IVT_LOCK> Decrement the responses counter for UPT:"
     2063                            << " MULTI_ACK_IVT_LOCK> "
    20632064                            << " entry = "       << r_multi_ack_ivt_index.read()
    20642065                            << " / count = " << std::dec << count << std::endl;
    20652066#endif
    2066                     }
    20672067                    break;
    20682068                }
     
    20742074                        std::cout
    20752075                            << "VCI_MEM_CACHE ERROR " << name()
    2076                             << " MULTI_ACK_IVT_LOCK state"
     2076                            << " MULTI_ACK_IVT_CLEAR state"
    20772077                            << " bad IVT allocation" << std::endl;
    20782078
     
    20812081
    20822082                    m_ivt.clear(r_multi_ack_ivt_index.read());
    2083                     r_multi_ack_fsm = MULTI_ACK_DIR_REQ;       
     2083                    r_multi_ack_fsm = MULTI_ACK_RSP;       
    20842084           
    20852085#if DEBUG_MEMC_MULTI_ACK
     
    20972097                    if(r_alloc_dir_fsm.read() != ALLOC_DIR_MULTI_ACK) break;
    20982098
    2099                     r_multi_ack_fsm = MULTI_ACK_DIR_LOCK;
     2099                    r_multi_ack_fsm = MULTI_ACK_IVT_LOCK;
    21002100                    //std::cout << " MEM_CACHE : CLEANUP_DIR_REQ" << std::endl;
    21012101
     
    21522152                    assert( (entry.state == ENTRY_LOCKED) && "mutli rsp check the entry, the line is not locked!!!");
    21532153                       
    2154                     if(r_multi_ack_miss_updt.read()) //cache L1 has sent the cleanup when it receives the cc_updt request,
    2155                     {
    2156                         if(not entry.count)
    2157                         {
    2158                             r_multi_ack_fsm = MULTI_ACK_IVT_LOCK;
    2159                             r_multi_ack_miss_updt = false;
    2160                         }
    2161                         else
    2162                         {
    2163                             r_multi_ack_fsm = MULTI_ACK_IVT_CHANGE;
    2164                         }
     2154                    if(r_multi_ack_miss_updt.read() and entry.count) //cache L1 has sent the cleanup when it receives the cc_updt request,
     2155                    {
     2156                        r_multi_ack_fsm = MULTI_ACK_IVT_CHANGE;
    21652157                    }
    21662158                    else if( not entry.count or match_ll) // The line has been already evicted from cache L1
     
    21802172            case MULTI_ACK_IVT_CHANGE:   // release all locks and retry from beginning
    21812173                {                 
    2182                     if(r_alloc_ivt_fsm.read() != ALLOC_IVT_MULTI_ACK)  break;
    2183                    
     2174                    //if(r_alloc_ivt_fsm.read() != ALLOC_IVT_MULTI_ACK)  break;
     2175                    if(r_alloc_ivt_fsm.read() != ALLOC_IVT_MULTI_ACK )
     2176                    {
     2177                        std::cout
     2178                            << "VCI_MEM_CACHE ERROR " << name()
     2179                            << " MULTI_ACK_IVT_CHANGE state"
     2180                            << " bad IVT allocation" << std::endl;
     2181
     2182                        exit(0);
     2183                    }
    21842184                    m_ivt.change(r_multi_ack_ivt_index.read());
    21852185#if DEBUG_MEMC_MULTI_ACK
     
    22652265                   
    22662266                    assert( r_multi_ack_rsp.read() && "Multi ack: must be send the rsp");
    2267                     r_multi_ack_fsm      = MULTI_ACK_RSP;
     2267                    r_multi_ack_fsm      = MULTI_ACK_IVT_CLEAR;
    22682268#if DEBUG_MEMC_MULTI_ACK
    22692269                    if(m_debug)
     
    23992399                            entry.owner.inst     = false;
    24002400                            entry.ptr            = 0;
    2401                             r_multi_ack_fsm      = MULTI_ACK_RSP;
     2401                            r_multi_ack_fsm      = MULTI_ACK_IVT_CLEAR;
    24022402                           
    24032403                        }
     
    24462446                        if(r_multi_ack_last_free.read())  m_heap.set_full();
    24472447
    2448                         r_multi_ack_fsm = MULTI_ACK_RSP;
     2448                        r_multi_ack_fsm = MULTI_ACK_IVT_CLEAR;
    24492449
    24502450#if DEBUG_MEMC_MULTI_ACK
     
    98809880                        r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
    98819881
    9882                     else if ((r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK) or
    9883                             (r_multi_ack_fsm.read() == MULTI_ACK_IVT_CHANGE))
     9882                    else if (r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK)
    98849883                        r_alloc_ivt_fsm = ALLOC_IVT_MULTI_ACK;
    98859884
     
    99089907                        r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
    99099908
    9910                     else if ((r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK) or
    9911                             (r_multi_ack_fsm.read() == MULTI_ACK_IVT_CHANGE))
     9909                    else if (r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK)
    99129910                        r_alloc_ivt_fsm = ALLOC_IVT_MULTI_ACK;
    99139911
     
    99359933                        r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
    99369934
    9937                     else if ((r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK) or
    9938                             (r_multi_ack_fsm.read() == MULTI_ACK_IVT_CHANGE))
     9935                    else if (r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK)
    99399936                        r_alloc_ivt_fsm = ALLOC_IVT_MULTI_ACK;
    99409937
     
    99659962                        r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
    99669963
    9967                     else if ((r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK) or
    9968                             (r_multi_ack_fsm.read() == MULTI_ACK_IVT_CHANGE))
     9964                    else if (r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK)
    99699965                        r_alloc_ivt_fsm = ALLOC_IVT_MULTI_ACK;
    99709966
     
    99929988                        r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
    99939989
    9994                     else if ((r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK) or
    9995                             (r_multi_ack_fsm.read() == MULTI_ACK_IVT_CHANGE))
     9990                    else if (r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK)
    99969991                        r_alloc_ivt_fsm = ALLOC_IVT_MULTI_ACK;
    99979992
     
    1001910014                if (r_config_fsm.read() != CONFIG_IVT_LOCK)
    1002010015                {
    10021                     if ((r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK) or
    10022                             (r_multi_ack_fsm.read() == MULTI_ACK_IVT_CHANGE))
     10016                    if (r_multi_ack_fsm.read() == MULTI_ACK_IVT_LOCK)
    1002310017                        r_alloc_ivt_fsm = ALLOC_IVT_MULTI_ACK;
    1002410018
     
    1004810042            case ALLOC_IVT_MULTI_ACK:           // allocated to MULTI ACK FSM
    1004910043                if ((r_multi_ack_fsm.read() != MULTI_ACK_IVT_LOCK) and
    10050                     (r_multi_ack_fsm.read() != MULTI_ACK_IVT_CHANGE))
     10044                    (r_multi_ack_fsm.read() != MULTI_ACK_DIR_LOCK) and
     10045                    (r_multi_ack_fsm.read() != MULTI_ACK_DIR_UPDT) and
     10046                    (r_multi_ack_fsm.read() != MULTI_ACK_HEAP_LOCK) and
     10047                    (r_multi_ack_fsm.read() != MULTI_ACK_HEAP_WRITE))
    1005110048                {
    1005210049                    if ((r_write_fsm.read() == WRITE_INVAL_IVT_LOCK))
     
    1026210259                if(((r_multi_ack_fsm.read() != MULTI_ACK_DIR_REQ) and
    1026310260                    (r_multi_ack_fsm.read() != MULTI_ACK_DIR_LOCK) and
     10261                    (r_multi_ack_fsm.read() != MULTI_ACK_IVT_LOCK) and
    1026410262                    (r_multi_ack_fsm.read() != MULTI_ACK_DIR_UPDT)  and
    1026510263                    (r_multi_ack_fsm.read() != MULTI_ACK_HEAP_REQ)  and
Note: See TracChangeset for help on using the changeset viewer.