Changeset 487


Ignore:
Timestamp:
Aug 8, 2013, 1:33:39 PM (11 years ago)
Author:
haoliu
Message:

Bug fixed in vci_cc_vcache_wrapper component:
1) The r_dcache_paddr_ext is utiliszed in the state DCACHE_XTN_DC_INVAL_VA(DCACHE FSM)
for constructing the physical address when the tlb is not activated.

2) In the ICACHE FSM and DCACHE FSM, the state MISS_SELECT will not be blocked by the
r_icache_cc_send_req (r_dcache_cc_send_req for DCACHE FSM) when a victim solt is found,
because we should assure that the cache L1 can consume the response of the miss read
request when the response has arrived.
(The reason of this condtion comes from a deadlock detected in the above version)

A new filp-flop is utilized in the ICACHE FSM (same in DCACHE FSM) for saving the cleanup victim
request when the r_icache_cc_send_req is true. This saving request will be sent later
in the states MISS_WAIT or MISS_UPDT_DIR when r_icache_cc_send_req is false.

Location:
trunk/modules/vci_cc_vcache_wrapper/caba/source
Files:
2 edited

Legend:

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

    r468 r487  
    175175        CC_RECEIVE_INS_UPDT_HEADER,
    176176        CC_RECEIVE_INS_UPDT_NLINE,
    177         CC_RECEIVE_INS_UPDT_DATA,
    178177        CC_RECEIVE_DATA_INVAL_HEADER,
    179178        CC_RECEIVE_DATA_INVAL_NLINE,
    180179        CC_RECEIVE_DATA_UPDT_HEADER,
    181180        CC_RECEIVE_DATA_UPDT_NLINE,
     181        CC_RECEIVE_INS_UPDT_DATA,
    182182        CC_RECEIVE_DATA_UPDT_DATA,
    183183    };
     
    388388    sc_signal<bool>         r_icache_tlb_rsp_error;      // tlb miss response error
    389389
     390    // Filp-Flop in ICACHE FSM for saving the cleanup victim request
     391    sc_signal<bool>         r_icache_cleanup_victim_req;
     392    sc_signal<paddr_t>      r_icache_cleanup_victim_nline;
     393
    390394    // communication between ICACHE FSM and CC_SEND FSM
    391395    sc_signal<bool>         r_icache_cc_send_req;           // ICACHE cc_send request
     
    480484    sc_signal<bool>         r_dcache_xtn_req;           // xtn request (caused by processor)
    481485    sc_signal<int>          r_dcache_xtn_opcode;        // xtn request type
     486
     487    // Filp-Flop in DCACHE FSM for saving the cleanup victim request
     488    sc_signal<bool>         r_dcache_cleanup_victim_req;
     489    sc_signal<paddr_t>      r_dcache_cleanup_victim_nline;
    482490
    483491    // communication between DCACHE FSM and CC_SEND FSM
  • trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r484 r487  
    277277      r_icache_tlb_rsp_error("r_icache_tlb_rsp_error"),
    278278
     279      r_icache_cleanup_victim_req("r_icache_cleanup_victim_req"),
     280      r_icache_cleanup_victim_nline("r_icache_cleanup_victim_nline"),
     281
    279282      r_icache_cc_send_req("r_icache_cc_send_req"),
    280283      r_icache_cc_send_type("r_icache_cc_send_type"),
     
    349352      r_dcache_xtn_opcode("r_dcache_xtn_opcode"),
    350353
     354      r_dcache_cleanup_victim_req("r_dcache_cleanup_victim_req"),
     355      r_dcache_cleanup_victim_nline("r_dcache_cleanup_victim_nline"),
     356   
    351357      r_dcache_cc_send_req("r_dcache_cc_send_req"),
    352358      r_dcache_cc_send_type("r_dcache_cc_send_type"),
     
    755761        // No request from ICACHE_FSM to CC_SEND FSM
    756762        r_icache_cc_send_req       = false;
     763        r_icache_cleanup_victim_req = false;
    757764
    758765        r_icache_clack_req         = false;
     
    777784        // No request from DCACHE FSM to CC_SEND FSM
    778785        r_dcache_cc_send_req       = false;
     786        r_dcache_cleanup_victim_req = false;
    779787
    780788        r_dcache_clack_req         = false;
     
    15081516    ////////////////////////
    15091517    case ICACHE_MISS_SELECT:       // Try to select a slot in associative set,
    1510                                    // if previous cleanup has been sent.
    15111518                                   // Waiting in this state if no slot available.
    1512                                    // Set the r_icache_cleanup_req flip-flop
    1513                                    // and the r_icache_miss_clack flip-flop,
     1519                                   // If a victim slot has been choosen and the r_icache_cc_send_req is false,
     1520                                   // we send the cleanup request in this state.
     1521                                   // If not, a r_icache_cleanup_victim_req flip-flop is
     1522                                   // utilized for saving this cleanup request, and it will be sent later
     1523                                   // in state ICACHE_MISS_WAIT or ICACHE_MISS_UPDT_DIR.
     1524                                   // The r_icache_miss_clack flip-flop is set
    15141525                                   // when a cleanup is required
    15151526    {
     
    15321543        }
    15331544
    1534         if ( not r_icache_cc_send_req.read() ) // wait for previous cc_send request to be sent
    1535         {
    1536             bool        found;
    1537             bool        cleanup;
    1538             size_t      way;
    1539             size_t      set;
    1540             paddr_t     victim;
     1545
     1546        bool        found;
     1547        bool        cleanup;
     1548        size_t          way;
     1549        size_t          set;
     1550        paddr_t         victim;
    15411551
    15421552#ifdef INSTRUMENTATION
    15431553m_cpt_icache_dir_read++;
    15441554#endif
    1545             r_icache.read_select(r_icache_vci_paddr.read(),
    1546                                  &victim,
    1547                                  &way,
    1548                                  &set,
    1549                                  &found,
    1550                                  &cleanup );
    1551             if ( found )
    1552             {
    1553                 r_icache_miss_way     = way;
    1554                 r_icache_miss_set     = set;
    1555 
    1556                 if ( cleanup )
     1555        r_icache.read_select(r_icache_vci_paddr.read(),
     1556                             &victim,
     1557                             &way,
     1558                             &set,
     1559                             &found,
     1560                             &cleanup );
     1561        if ( not found )
     1562        {
     1563            break;
     1564        }
     1565        else
     1566        {
     1567            r_icache_miss_way     = way;
     1568            r_icache_miss_set     = set;
     1569
     1570            if ( cleanup )
     1571            {
     1572                if ( not r_icache_cc_send_req.read() )
    15571573                {
    1558                     r_icache_fsm           = ICACHE_MISS_CLEAN;
    1559                     r_icache_miss_clack    = true;
    1560                     // request cleanup
    1561                     r_icache_cc_send_req   = true;
    1562                     r_icache_cc_send_nline = victim;
    1563                     r_icache_cc_send_way   = way;
    1564                     r_icache_cc_send_type  = CC_TYPE_CLEANUP;
     1574                    r_icache_cc_send_req    = true;
     1575                    r_icache_cc_send_nline  = victim;
     1576                    r_icache_cc_send_way    = way;
     1577                    r_icache_cc_send_type   = CC_TYPE_CLEANUP;   
    15651578                }
    15661579                else
    15671580                {
    1568                     r_icache_fsm          = ICACHE_MISS_WAIT;
     1581                    r_icache_cleanup_victim_req   = true;
     1582                    r_icache_cleanup_victim_nline = victim;
    15691583                }
     1584
     1585                r_icache_miss_clack           = true;
     1586                r_icache_fsm                  = ICACHE_MISS_CLEAN;
     1587            }
     1588            else
     1589            {
     1590                r_icache_fsm          = ICACHE_MISS_WAIT;
     1591            }
    15701592
    15711593#if DEBUG_ICACHE
     
    15801602}
    15811603#endif
    1582             }
    15831604        }
    15841605        break;
     
    16201641            break;
    16211642        }
     1643       
     1644        // send cleanup victim request
     1645        if ( r_icache_cleanup_victim_req.read() and not r_icache_cc_send_req.read() )
     1646        {
     1647            r_icache_cc_send_req        = true;
     1648            r_icache_cc_send_nline      = r_icache_cleanup_victim_nline;
     1649            r_icache_cc_send_way        = r_icache_miss_way;
     1650            r_icache_cc_send_type       = CC_TYPE_CLEANUP;
     1651            r_icache_cleanup_victim_req = false;
     1652        }   
    16221653
    16231654        // coherence interrupt
    1624         if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read())
     1655        if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read() and not r_icache_cleanup_victim_req.read() )
    16251656        {
    16261657            r_icache_fsm = ICACHE_CC_CHECK;
     
    17001731        }
    17011732
     1733        // send cleanup victim request
     1734        if ( r_icache_cleanup_victim_req.read() and not r_icache_cc_send_req.read() )
     1735        {
     1736            r_icache_cc_send_req        = true;
     1737            r_icache_cc_send_nline      = r_icache_cleanup_victim_nline;
     1738            r_icache_cc_send_way        = r_icache_miss_way;
     1739            r_icache_cc_send_type       = CC_TYPE_CLEANUP;
     1740            r_icache_cleanup_victim_req = false;
     1741        }   
     1742
    17021743        // coherence interrupt
    1703         if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read())
     1744        if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read() and not r_icache_cleanup_victim_req.read() )
    17041745        {
    17051746            r_icache_fsm = ICACHE_CC_CHECK;
     
    18601901        }
    18611902
     1903        assert ( not r_icache_cc_send_req.read() and "CC_SEND must be available in ICACHE_CC_CHECK");
     1904
    18621905        // Match between MISS address and CC address
    1863         // note: In the same cycle we can handle a CLACK and a MISS match
    1864         // because the CLACK access the directory but the MISS match dont.
    18651906        if (r_cc_receive_icache_req.read() and
    18661907          ((r_icache_fsm_save.read() == ICACHE_MISS_SELECT  )  or
     
    18971938#endif
    18981939        }
    1899 
    1900         assert ( not r_icache_cc_send_req.read() and "CC_SEND must be available in ICACHE_CC_CHECK");
    19011940
    19021941        // CC request handler
     
    38233862        {
    38243863            paddr = (paddr_t)r_dcache_save_wdata.read();
     3864            if (vci_param::N > 32)
     3865                paddr = paddr | ((paddr_t)(r_dcache_paddr_ext.read()) << 32);
    38253866            hit   = true;
    38263867        }
     
    39644005    }
    39654006    ////////////////////////
    3966     case DCACHE_MISS_SELECT:   // Try to select a slot in associative set
    3967                                // if previous cleanup has been sent.
    3968                                // Waiting in this state if no slot available
    3969                                // Set the r_dcache_cleanup_req flip-flop
    3970                                // and the r_dcache_miss_clack flip-flop
    3971                                // when a cleanup is required
     4007    case DCACHE_MISS_SELECT:       // Try to select a slot in associative set,
     4008                                   // Waiting in this state if no slot available.
     4009                                   // If a victim slot has been choosen and the r_icache_cc_send_req is false,
     4010                                   // we send the cleanup request in this state.
     4011                                   // If not, a r_icache_cleanup_victim_req flip-flop is
     4012                                   // utilized for saving this cleanup request, and it will be sent later
     4013                                   // in state ICACHE_MISS_WAIT or ICACHE_MISS_UPDT_DIR.
     4014                                   // The r_icache_miss_clack flip-flop is set
     4015                                   // when a cleanup is required
    39724016    {
    39734017        if ( m_dreq.valid) m_cost_data_miss_frz++;
     
    39894033        }
    39904034
    3991         if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request is sent
    3992         {
    3993             bool     found = false;
    3994             bool     cleanup = false;
    3995             size_t   way = 0;
    3996             size_t   set = 0;
    3997             paddr_t  victim = 0;
     4035        bool     found = false;
     4036        bool     cleanup = false;
     4037        size_t   way = 0;
     4038        size_t   set = 0;
     4039        paddr_t  victim = 0;
    39984040
    39994041#ifdef INSTRUMENTATION
    40004042m_cpt_dcache_dir_read++;
    40014043#endif
    4002             r_dcache.read_select( r_dcache_save_paddr.read(),
    4003                                   &victim,
    4004                                   &way,
    4005                                   &set,
    4006                                   &found,
    4007                                   &cleanup );
    4008 
    4009             if ( found )
    4010             {
    4011                 r_dcache_miss_way = way;
    4012                 r_dcache_miss_set = set;
    4013 
    4014                 if ( cleanup )
     4044        r_dcache.read_select( r_dcache_save_paddr.read(),
     4045                              &victim,
     4046                              &way,
     4047                              &set,
     4048                              &found,
     4049                              &cleanup );
     4050
     4051        if (  not found )
     4052        {
     4053            break;
     4054        }
     4055        else
     4056        {
     4057            r_dcache_miss_way = way;
     4058            r_dcache_miss_set = set;
     4059
     4060            if ( cleanup )
     4061            {
     4062                if ( not r_dcache_cc_send_req.read() )
    40154063                {
    4016                     r_dcache_miss_clack   = true;
    4017                     r_dcache_fsm          = DCACHE_MISS_CLEAN;
    4018                     // request cleanup
    4019                     r_dcache_cc_send_req   = true;
    4020                     r_dcache_cc_send_nline = victim;
    4021                     r_dcache_cc_send_way   = way;
    4022                     r_dcache_cc_send_type  = CC_TYPE_CLEANUP;
     4064                    r_dcache_cc_send_req    = true;
     4065                    r_dcache_cc_send_nline  = victim;
     4066                    r_dcache_cc_send_way    = way;
     4067                    r_dcache_cc_send_type   = CC_TYPE_CLEANUP;   
     4068
    40234069                }
    40244070                else
    40254071                {
    4026                     r_dcache_fsm          = DCACHE_MISS_WAIT;
     4072                    r_dcache_cleanup_victim_req   = true;
     4073                    r_dcache_cleanup_victim_nline = victim;
    40274074                }
     4075
     4076                r_dcache_miss_clack           = true;
     4077                r_dcache_fsm                  = DCACHE_MISS_CLEAN;
     4078            }
     4079            else
     4080            {
     4081                r_dcache_fsm          = DCACHE_MISS_WAIT;
     4082            }
    40284083
    40294084#if DEBUG_DCACHE
     
    40394094}
    40404095#endif
    4041             } // end found
    4042         }
     4096        } // end found
    40434097        break;
    40444098    }
     
    41054159        }
    41064160
     4161        // send cleanup victim request
     4162        if ( r_dcache_cleanup_victim_req.read() and not r_dcache_cc_send_req.read() )
     4163        {
     4164            r_dcache_cc_send_req        = true;
     4165            r_dcache_cc_send_nline      = r_dcache_cleanup_victim_nline;
     4166            r_dcache_cc_send_way        = r_dcache_miss_way;
     4167            r_dcache_cc_send_type       = CC_TYPE_CLEANUP;
     4168            r_dcache_cleanup_victim_req = false;
     4169        }   
     4170
    41074171        // coherence request (from CC_RECEIVE FSM)
    4108         if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read())
     4172        if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read() and not r_dcache_cleanup_victim_req.read())
    41094173        {
    41104174            r_dcache_fsm = DCACHE_CC_CHECK;
     
    42284292        }
    42294293
     4294        // send cleanup victim request
     4295        if ( r_dcache_cleanup_victim_req.read() and not r_dcache_cc_send_req.read() )
     4296        {
     4297            r_dcache_cc_send_req        = true;
     4298            r_dcache_cc_send_nline      = r_dcache_cleanup_victim_nline;
     4299            r_dcache_cc_send_way        = r_dcache_miss_way;
     4300            r_dcache_cc_send_type       = CC_TYPE_CLEANUP;
     4301            r_dcache_cleanup_victim_req = false;
     4302        }   
     4303
    42304304        // coherence request (from CC_RECEIVE FSM)
    4231         if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read())
     4305        if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read() and not r_dcache_cleanup_victim_req.read() )
    42324306        {
    42334307            r_dcache_fsm = DCACHE_CC_CHECK;
     
    46044678        }
    46054679
    4606        
     4680        assert ( not r_dcache_cc_send_req.read() and "CC_SEND must be available in DCACHE_CC_CHECK" );
     4681
    46074682        // Match between MISS address and CC address
    4608         // note: In the same cycle we can handle a CLACK and a MISS match
    4609         // because the CLACK access the directory but the MISS match dont.
    46104683        if (r_cc_receive_dcache_req.read() and
    46114684          ((r_dcache_fsm_cc_save == DCACHE_MISS_SELECT  )  or
     
    46434716#endif
    46444717        }
    4645 
    4646 
    4647         assert ( not r_dcache_cc_send_req.read() and "CC_SEND must be available in DCACHE_CC_CHECK" );
    46484718
    46494719        // CC request handler
Note: See TracChangeset for help on using the changeset viewer.