Changeset 616


Ignore:
Timestamp:
Jan 7, 2014, 4:26:39 PM (10 years ago)
Author:
haoliu
Message:

Modification in vci_cc_vcache_wrapper:
a) Non cacheable write request will not any more be sent by multi_write_buffer.

A write non cacheable access is retreated with a synchronous way, like the
read non cacheable access. When Cache L1 receives a write non cacheable request,
it will block the processor until the response of this request arrives.
The advantage of this method is that the cache L1 can supply the virtual address
to OS when it receives a bus error response.

b) In VCI_CMD_STATE, the unc_read request will not check the multi_write_buffer for

an matching address. But the CAS and SC request must be check this point
before sent to the target.

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

    r549 r616  
    148148        CMD_INS_UNC,
    149149        CMD_DATA_MISS,
    150         CMD_DATA_UNC,
     150        CMD_DATA_UNC_READ,
     151        CMD_DATA_UNC_WRITE,
    151152        CMD_DATA_WRITE,
    152153        CMD_DATA_LL,
     
    202203        //  b1 accÚs table llsc type SW / other
    203204        //  b2 WRITE/CAS/LL/SC
    204         TYPE_READ_DATA_UNC          = 0x0,
     205        TYPE_DATA_UNC               = 0x0,
    205206        TYPE_READ_DATA_MISS         = 0x1,
    206207        TYPE_READ_INS_UNC           = 0x2,
     
    274275    };
    275276
    276     enum transaction_type_d_e
    277     {
    278         // b0 : 1 if cached
    279         // b1 : 1 if instruction
    280         TYPE_DATA_UNC     = 0x0,
    281         TYPE_DATA_MISS    = 0x1,
    282         TYPE_INS_UNC      = 0x2,
    283         TYPE_INS_MISS     = 0x3,
    284     };
     277//    enum transaction_type_d_e
     278//    {
     279//        // b0 : 1 if cached
     280//        // b1 : 1 if instruction
     281//        TYPE_DATA_UNC     = 0x0,
     282//        TYPE_DATA_MISS    = 0x1,
     283//        TYPE_INS_UNC      = 0x2,
     284//        TYPE_INS_MISS     = 0x3,
     285//    };
    285286
    286287public:
     
    412413    sc_signal<uint32_t>     r_dcache_save_be;           // byte enable (from proc)
    413414    sc_signal<paddr_t>      r_dcache_save_paddr;        // physical address
    414     sc_signal<bool>         r_dcache_save_cacheable;    // address cacheable
    415415    sc_signal<size_t>       r_dcache_save_cache_way;    // selected way (from dcache)
    416416    sc_signal<size_t>       r_dcache_save_cache_set;    // selected set (from dcache)
     
    423423    // communication between DCACHE FSM and VCI_CMD FSM
    424424    sc_signal<paddr_t>      r_dcache_vci_paddr;             // physical address for VCI command
     425    sc_signal<uint32_t>     r_dcache_vci_wdata;             // write unc data for VCI command
    425426    sc_signal<bool>         r_dcache_vci_miss_req;      // read miss request
    426     sc_signal<bool>         r_dcache_vci_unc_req;       // uncacheable read request
    427     sc_signal<uint32_t>     r_dcache_vci_unc_be;        // uncacheable read byte enable
     427    sc_signal<bool>         r_dcache_vci_unc_req;       // uncacheable request (read/write)
     428    sc_signal<uint32_t>     r_dcache_vci_unc_be;        // uncacheable byte enable
     429    sc_signal<uint32_t>     r_dcache_vci_unc_write;     // uncacheable data write request
    428430    sc_signal<bool>         r_dcache_vci_cas_req;       // atomic write request CAS
    429431    sc_signal<uint32_t>     r_dcache_vci_cas_old;       // previous data value for a CAS
     
    436438    sc_signal<size_t>       r_dcache_xtn_way;               // selected way (from dcache)
    437439    sc_signal<size_t>       r_dcache_xtn_set;               // selected set (from dcache)
    438 
    439     // write buffer state extension
    440     sc_signal<bool>         r_dcache_pending_unc_write; // pending uncacheable write in WBUF
    441440
    442441    // handling dcache miss
  • trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r583 r616  
    119119        "CMD_INS_UNC",
    120120        "CMD_DATA_MISS",
    121         "CMD_DATA_UNC",
     121        "CMD_DATA_UNC_READ",
     122        "CMD_DATA_UNC_WRITE",
    122123        "CMD_DATA_WRITE",
    123124        "CMD_DATA_LL",
     
    127128
    128129const char *vci_pktid_type_str[] = {
    129         "TYPE_READ_DATA_UNC",
     130        "TYPE_DATA_UNC",
    130131        "TYPE_READ_DATA_MISS",           
    131132        "TYPE_READ_INS_UNC",         
     
    296297      r_dcache_save_be("r_dcache_save_be"),
    297298      r_dcache_save_paddr("r_dcache_save_paddr"),
    298       r_dcache_save_cacheable("r_dcache_save_cacheable"),
    299299      r_dcache_save_cache_way("r_dcache_save_cache_way"),
    300300      r_dcache_save_cache_set("r_dcache_save_cache_set"),
     
    306306
    307307      r_dcache_vci_paddr("r_dcache_vci_paddr"),
     308      r_dcache_vci_wdata("r_dcache_vci_wdata"),
    308309      r_dcache_vci_miss_req("r_dcache_vci_miss_req"),
    309310      r_dcache_vci_unc_req("r_dcache_vci_unc_req"),
     311      r_dcache_vci_unc_write("r_dcache_vci_unc_write"),
    310312      r_dcache_vci_unc_be("r_dcache_vci_unc_be"),
    311313      r_dcache_vci_cas_req("r_dcache_vci_cas_req"),
     
    318320      r_dcache_xtn_way("r_dcache_xtn_way"),
    319321      r_dcache_xtn_set("r_dcache_xtn_set"),
    320 
    321       r_dcache_pending_unc_write("r_dcache_pending_unc_write"),
    322322
    323323      r_dcache_miss_type("r_dcache_miss_type"),
     
    775775        r_dcache_vci_ll_req        = false;
    776776        r_dcache_vci_sc_req        = false;
    777 
    778         // No uncacheable write pending
    779         r_dcache_pending_unc_write = false;
    780777
    781778        // No processor XTN request pending
     
    21452142    //    This component implement a strong order between non cacheable access
    21462143    //    (read or write) : A new non cacheable VCI transaction starts only when
    2147     //    the previous non cacheable transaction is completed. Both cacheable and
    2148     //    non cacheable transactions use the write buffer, but the DCACHE FSM registers
    2149     //    a non cacheable write transaction posted in the write buffer by setting the
    2150     //    r_dcache_pending_unc_write flip_flop. All other non cacheable requests
    2151     //    are stalled until this flip-flop is reset by the VCI_RSP_FSM (when the
    2152     //    pending non cacheable write transaction completes).
     2144    //    the previous non cacheable transaction is completed. After send the VCI
     2145    //    transaction, the DCACHE FSM wait for the respone in the DCACHE_UNC_WAIT state.
     2146    //    So the processor is blocked until the respone arrives in CACHE L1.
    21532147    //
    21542148    // 6/ Error handling:
    21552149    //    When the MMU is not activated, Read Bus Errors are synchronous events,
    2156     //    but Write Bus Errors are asynchronous events (processor is not frozen).
    2157     //    - If a Read Bus Error is detected, the VCI_RSP FSM sets the
     2150    //    Some Write Bus Errors are synchronous events when the request is a non cacheable access
     2151    //    but some Write Bus Errors are asynchronous events when the request is cacheable access
     2152    //    (processor is not frozen).
     2153    //    - If a Read Bus Error or a Non Cacheable Write Bus Error is detected, the VCI_RSP FSM sets the
    21582154    //      r_vci_rsp_data_error flip-flop, without writing any data in the
    21592155    //      r_vci_rsp_fifo_dcache FIFO, and the synchronous error is signaled
    21602156    //      by the DCACHE FSM.
    2161     //    - If a Write Bus Error is detected, the VCI_RSP FSM  signals
    2162     //      the asynchronous error using the setWriteBerr() method.
     2157    //    - If a Cacheable Write Bus Error is detected, the VCI_RSP_FSM signals
     2158    //    the asynchronous error using the setWriteBerr() method.
    21632159    //    When the MMU is activated bus error are rare events, as the MMU
    21642160    //    checks the physical address before the VCI transaction starts.
     
    23342330        if ( r_dcache_wbuf_req.read() )
    23352331        {
    2336             // miss if write not cacheable, and previous non cacheable write registered
    2337             if ( not r_dcache_save_cacheable.read() and r_dcache_pending_unc_write.read() )
    2338             {
    2339                 wbuf_write_miss = true;
    2340             }
    2341             else                // try a registration into write buffer
    2342             {
    2343                 bool wok = r_wbuf.write( r_dcache_save_paddr.read(),
    2344                                          r_dcache_save_be.read(),
    2345                                          r_dcache_save_wdata.read(),
    2346                                          r_dcache_save_cacheable.read() );
     2332            bool wok = r_wbuf.write( r_dcache_save_paddr.read(),
     2333                                     r_dcache_save_be.read(),
     2334                                     r_dcache_save_wdata.read(),
     2335                                     true);
    23472336#ifdef INSTRUMENTATION
    23482337m_cpt_wbuf_write++;
    23492338#endif
    2350                 if ( not wok ) // miss if write buffer full
    2351                 {
    2352                     wbuf_write_miss = true;
    2353                 }
    2354                 else          // update the write_buffer state extension
    2355                 {
    2356                     if(not r_dcache_pending_unc_write.read())
    2357                         r_dcache_pending_unc_write = not r_dcache_save_cacheable.read();
    2358                 }
     2339            if ( not wok ) // miss if write buffer full
     2340            {
     2341                wbuf_write_miss = true;
    23592342            }
    23602343        } // end WBUF update
     
    27122695                if ( valid_req )        // processor request is valid (after MMU check)
    27132696                {
    2714                     r_dcache_save_cacheable  = cacheable;
    2715 
    27162697                    // READ request
    27172698                    // The read requests are taken only if there is no cache update.
     
    27702751                        else                                    // uncacheable read
    27712752                        {
    2772                             r_dcache_vci_paddr    = paddr;
    2773                             r_dcache_vci_unc_be   = m_dreq.be;
    2774                             r_dcache_vci_unc_req  = true;
    2775                             r_dcache_fsm          = DCACHE_UNC_WAIT;
     2753                            r_dcache_vci_paddr      = paddr;
     2754                            r_dcache_vci_unc_be     = m_dreq.be;
     2755                            r_dcache_vci_unc_write  = false;
     2756                            r_dcache_vci_unc_req    = true;
     2757                            r_dcache_fsm            = DCACHE_UNC_WAIT;
    27762758#if DEBUG_DCACHE
    27772759if ( m_debug_activated )
     
    28372819                                r_dcache_llsc_valid = false;
    28382820
    2839                             // response to processor
    2840                             m_drsp.valid        = true;
    2841 
    2842                             // activating P1 stage
    2843                             wbuf_request = true;
    2844                             updt_request = (cache_state == CACHE_SLOT_STATE_VALID);
     2821                            if (not cacheable)
     2822                            {                           
     2823                                r_dcache_vci_paddr      = paddr;
     2824                                r_dcache_vci_wdata      = m_dreq.wdata;
     2825                                r_dcache_vci_unc_write  = true;
     2826                                r_dcache_vci_unc_be     = m_dreq.be;
     2827                                r_dcache_vci_unc_req    = true;
     2828                                r_dcache_fsm            = DCACHE_UNC_WAIT;
     2829                            }
     2830                            else
     2831                            {
     2832                                // response to processor
     2833                                m_drsp.valid        = true;
     2834                                // activating P1 stage
     2835                                wbuf_request = true;
     2836                                updt_request = (cache_state == CACHE_SLOT_STATE_VALID);
     2837                            }
    28452838                        }
    28462839                    } // end WRITE
     
    44164409        if ( r_vci_rsp_data_error.read() )      // bus error
    44174410        {
    4418             r_mmu_detr           = MMU_READ_DATA_ILLEGAL_ACCESS;
     4411            if(r_dcache_vci_unc_write.read())
     4412                r_mmu_detr           = MMU_WRITE_DATA_ILLEGAL_ACCESS;
     4413            else
     4414                r_mmu_detr           = MMU_READ_DATA_ILLEGAL_ACCESS;
     4415               
    44194416            r_mmu_dbvar          = m_dreq.addr;
    44204417            r_vci_rsp_data_error = false;
     
    50935090            size_t      wbuf_max;
    50945091
    5095             bool dcache_unc_req = r_dcache_vci_unc_req.read() and
    5096                  ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() );
    5097 
    50985092            bool dcache_miss_req = r_dcache_vci_miss_req.read() and
    50995093                 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() );
     
    51025096                 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() );
    51035097
     5098            bool dcache_sc_req   = r_dcache_vci_sc_req.read() and
     5099                 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() );
     5100
     5101            bool dcache_cas_req   = r_dcache_vci_cas_req.read() and
     5102                 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() );
     5103
    51045104            bool icache_miss_req = r_icache_miss_req.read() and
    51055105                 ( not (r_dcache_vci_miss_req.read() or
    5106                         r_dcache_vci_ll_req.read() or
    5107                         r_dcache_vci_unc_req.read())
     5106                        r_dcache_vci_ll_req.read()   or
     5107                        r_dcache_vci_cas_req.read()  or
     5108                        r_dcache_vci_sc_req.read())
    51085109                     or r_vci_cmd_imiss_prio.read() );
    51095110
    5110             // 1 - Data Read Miss
    5111             if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) )
     5111            // 1 - Data unc write
     5112            if ( r_dcache_vci_unc_req.read() and r_dcache_vci_unc_write.read())
     5113            {
     5114                r_vci_cmd_fsm        = CMD_DATA_UNC_WRITE;
     5115                r_dcache_vci_unc_req = false;
     5116//                m_cpt_dunc_transaction++;
     5117            }
     5118            // 2 data read miss
     5119            else if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) )
    51125120            {
    51135121                r_vci_cmd_fsm         = CMD_DATA_MISS;
     
    51165124//                m_cpt_dmiss_transaction++;
    51175125            }
    5118             // 2 - Data Read Uncachable
    5119             else if ( dcache_unc_req and r_wbuf.miss(r_dcache_vci_paddr.read()))
    5120             {
    5121                 r_vci_cmd_fsm        = CMD_DATA_UNC;
     5126            // 3 - Data Read Uncachable
     5127            else if ( r_dcache_vci_unc_req.read() and not r_dcache_vci_unc_write.read() )
     5128            {
     5129                r_vci_cmd_fsm        = CMD_DATA_UNC_READ;
    51225130                r_dcache_vci_unc_req = false;
    51235131//                m_cpt_dunc_transaction++;
    51245132            }
    5125             // 3 - Data Linked Load
     5133            // 4 - Data Linked Load
    51265134            else if ( dcache_ll_req and r_wbuf.miss(r_dcache_vci_paddr.read()))
    51275135            {
    5128                 r_dcache_vci_ll_req = false;
    5129                 r_vci_cmd_fsm       = CMD_DATA_LL;
     5136                r_vci_cmd_fsm         = CMD_DATA_LL;
     5137                r_dcache_vci_ll_req   = false;
     5138                r_vci_cmd_imiss_prio  = true;
    51305139//              m_cpt_ll_transaction++;
    51315140            }
    5132             // 4 - Instruction Miss
     5141            // 5 - Instruction Miss
    51335142            else if ( icache_miss_req and r_wbuf.miss(r_icache_vci_paddr.read()) )
    51345143            {
     
    51385147//                m_cpt_imiss_transaction++;
    51395148            }
    5140             // 5 - Instruction Uncachable
     5149            // 6 - Instruction Uncachable
    51415150            else if ( r_icache_unc_req.read() )
    51425151            {
     
    51455154//                m_cpt_iunc_transaction++;
    51465155            }
    5147             // 6 - Data Write
     5156            // 7 - Data Write
    51485157            else if ( r_wbuf.rok(&wbuf_min, &wbuf_max) )
    51495158            {
     
    51555164//                m_length_write_transaction += (wbuf_max-wbuf_min+1);
    51565165            }
    5157             // 7 - Data Store Conditionnal
    5158             else if ( r_dcache_vci_sc_req.read() )
    5159             {
    5160                 r_dcache_vci_sc_req = false;
    5161                 r_vci_cmd_cpt  = 0;
    5162                 r_vci_cmd_fsm  = CMD_DATA_SC;
     5166            // 8 - Data Store Conditionnal
     5167            else if ( dcache_sc_req and r_wbuf.miss(r_dcache_vci_paddr.read()) )
     5168            {
     5169                r_vci_cmd_fsm           = CMD_DATA_SC;
     5170                r_dcache_vci_sc_req     = false;
     5171                r_vci_cmd_imiss_prio    = true;
     5172                r_vci_cmd_cpt           = 0;
    51635173//              m_cpt_sc_transaction++;
    51645174            }
    5165             // 8 - Compare And Swap
    5166             else if ( r_dcache_vci_cas_req.read() )
    5167             {
    5168                 r_vci_cmd_fsm        = CMD_DATA_CAS;
    5169                 r_dcache_vci_cas_req = false;
    5170                 r_vci_cmd_cpt        = 0;
     5175            // 9 - Compare And Swap
     5176            else if ( dcache_cas_req and r_wbuf.miss(r_dcache_vci_paddr.read()) )
     5177            {
     5178                r_vci_cmd_fsm           = CMD_DATA_CAS;
     5179                r_dcache_vci_cas_req    = false;
     5180                r_vci_cmd_imiss_prio    = true;
     5181                r_vci_cmd_cpt           = 0;
    51715182//              m_cpt_cas_transaction++;
    51725183            }
     
    52135224        case CMD_INS_UNC:
    52145225        case CMD_DATA_MISS:
    5215         case CMD_DATA_UNC:
     5226        case CMD_DATA_UNC_READ:
     5227        case CMD_DATA_UNC_WRITE:
    52165228        case CMD_DATA_LL:
    52175229        {
     
    52615273            r_vci_rsp_cpt = 0;
    52625274
    5263             if      ( (p_vci.rpktid.read() & 0x7) ==  TYPE_READ_DATA_UNC  )
     5275            if      ( (p_vci.rpktid.read() & 0x7) ==  TYPE_DATA_UNC  )
    52645276            {
    52655277                r_vci_rsp_fsm = RSP_DATA_UNC;
     
    54705482                r_vci_rsp_fsm = RSP_IDLE;
    54715483                uint32_t   wbuf_index = p_vci.rtrdid.read();
    5472                 bool       cacheable  = r_wbuf.completed(wbuf_index);
    5473                 if ( not cacheable ) r_dcache_pending_unc_write = false;
     5484                r_wbuf.completed(wbuf_index);
    54745485                if ( (p_vci.rerror.read()&0x1) != 0 ) r_iss.setWriteBerr();
    54755486            }
     
    59705981        break;
    59715982
    5972     case CMD_DATA_UNC:
     5983    case CMD_DATA_UNC_READ:
    59735984        p_vci.cmdval  = true;
    59745985        p_vci.address = r_dcache_vci_paddr.read() & ~0x3;
     
    59765987        p_vci.be      = r_dcache_vci_unc_be.read();
    59775988        p_vci.trdid   = 0;
    5978         p_vci.pktid   = TYPE_READ_DATA_UNC;
     5989        p_vci.pktid   = TYPE_DATA_UNC;
    59795990        p_vci.plen    = 4;
    59805991        p_vci.cmd     = vci_param::CMD_READ;
     5992        p_vci.eop     = true;
     5993        break;
     5994
     5995    case CMD_DATA_UNC_WRITE:
     5996        p_vci.cmdval  = true;
     5997        p_vci.address = r_dcache_vci_paddr.read() & ~0x3;
     5998        p_vci.wdata   = r_dcache_vci_wdata.read();
     5999        p_vci.be      = r_dcache_vci_unc_be.read();
     6000        p_vci.trdid   = 0;
     6001        p_vci.pktid   = TYPE_DATA_UNC;
     6002        p_vci.plen    = 4;
     6003        p_vci.cmd     = vci_param::CMD_WRITE;
    59816004        p_vci.eop     = true;
    59826005        break;
Note: See TracChangeset for help on using the changeset viewer.