Ignore:
Timestamp:
Apr 11, 2014, 3:09:22 PM (10 years ago)
Author:
haoliu
Message:

MESI bug fixed

Location:
branches/MESI/modules/vci_mem_cache/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/MESI/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h

    r670 r675  
    850850      sc_signal<bool>     r_read_to_cc_send_brdcast_req;    // bd inval
    851851      sc_signal<bool>     r_read_to_cc_send_type;    //cc inval or cc updt     
     852      sc_signal<bool>     r_read_to_cc_send_is_shared;    //line is or not shared     
    852853
    853854      //RWT: Buffer between READ fsm and CLEANUP fsm (wait for the data coming from L1 cache)
     
    10391040      sc_signal<size_t>   r_cleanup_to_tgt_rsp_pktid; // transaction pktid
    10401041      sc_signal<addr_t>   r_cleanup_to_tgt_rsp_ll_key;
     1042      sc_signal<addr_t>   r_cleanup_to_tgt_rsp_nline;
    10411043
    10421044      sc_signal<bool>     r_cleanup_to_tgt_rsp_type;
  • branches/MESI/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r674 r675  
    31953195                        bool last_multi_req     = multi_req and (r_read_count.read() == 1);
    31963196                        bool not_last_multi_req = multi_req and (r_read_count.read() != 1);
    3197                         bool match_send         = (r_read_copy.read() == m_cmd_read_srcid_fifo.read()) and
    3198                                                   (r_read_copy_inst.read() == 0);
    3199 
    3200                         if(last_multi_req and match_send)
    3201                         {
    3202                             std::cout << "last_multi_req and match srcid are true" << std::endl;
    3203                             exit(0);
    3204                         }
     3197                        //bool match_send         = (r_read_copy.read() == m_cmd_read_srcid_fifo.read()) and
     3198                        //                          (r_read_copy_inst.read() == 0);
     3199
    32053200                        size_t ivt_send_count   = 0;
    32063201
     
    32403235                            r_read_to_cc_send_nline         = nline;
    32413236                            r_read_to_cc_send_srcid         = m_cmd_read_srcid_fifo.read();
     3237                            r_read_to_cc_send_is_shared     = r_read_state.read() == ENTRY_SHARED;
     3238
    32423239                            if(r_read_need_block.read())
    32433240                            {
     
    32483245                                r_read_to_cleanup_req           = true;
    32493246                            }
    3250                             r_read_to_cc_send_type          = true;
    3251 
    3252                             if(not match_send)
    3253                             {
    3254                                 read_to_cc_send_fifo_srcid      = r_read_copy.read();
    3255                                 read_to_cc_send_fifo_inst       = r_read_copy_inst.read();
    3256                                 read_to_cc_send_fifo_put        = multi_req;
    3257                             }   
     3247                            r_read_to_cc_send_type              = true; //CC_INVAL
     3248
     3249                         //   if(not match_send)
     3250                         //   {
     3251                            read_to_cc_send_fifo_srcid      = r_read_copy.read();
     3252                            read_to_cc_send_fifo_inst       = r_read_copy_inst.read();
     3253                            read_to_cc_send_fifo_put        = multi_req;
     3254                         //   }   
    32583255                            r_read_next_ptr                 = r_read_ptr.read();
    32593256
    3260                             if(((m_cmd_read_pktid_fifo.read() & 0x8) == 0x8) and (r_read_state.read() == ENTRY_SHARED)) 
    3261                                 ivt_send_count = r_read_count.read() - 1;
    3262                             else
    3263                                 ivt_send_count = r_read_count.read();
     3257                          //  if(((m_cmd_read_pktid_fifo.read() & 0x8) == 0x8) and (r_read_state.read() == ENTRY_SHARED)) 
     3258                          //      ivt_send_count = r_read_count.read() - 1;
     3259                          //  else
     3260                          //      ivt_send_count = r_read_count.read();
     3261                         
    32643262                            m_ivt.set(false,            // it's an inval transaction
    32653263                                      not multi_req,    // multi_inval or brdcast 
     
    32703268                                      m_cmd_read_pktid_fifo.read() & 0x7,
    32713269                                      nline,
    3272                                       ivt_send_count,
     3270                                      r_read_count.read(),
    32733271                                      index);
    32743272                               
     
    33183316                        HeapEntry entry = m_heap.read(r_read_next_ptr.read());
    33193317
    3320                         bool match_send         = ( entry.owner.srcid == m_cmd_read_srcid_fifo.read()) and
    3321                                                   ( entry.owner.inst  == 0);
    3322                         if(not match_send)
    3323                         {
    3324                             read_to_cc_send_fifo_srcid    = entry.owner.srcid;
    3325                             read_to_cc_send_fifo_inst     = entry.owner.inst;
    3326                             read_to_cc_send_fifo_put      = true;
    3327                         }
     3318                       // bool match_send         = ( entry.owner.srcid == m_cmd_read_srcid_fifo.read()) and
     3319                       //                           ( entry.owner.inst  == 0);
     3320                       // if(not match_send)
     3321                       // {
     3322                        read_to_cc_send_fifo_srcid    = entry.owner.srcid;
     3323                        read_to_cc_send_fifo_inst     = entry.owner.inst;
     3324                        read_to_cc_send_fifo_put      = true;
     3325                       // }
    33283326                     //   if(read_to_cc_send_inst_fifo.wok()) always not full
    33293327                        r_read_next_ptr = entry.next;
     
    34353433                            r_read_to_cc_send_brdcast_req   = false;
    34363434                            r_read_to_cc_send_nline         = nline;
    3437                             r_read_to_cc_send_type          = false;
     3435                            r_read_to_cc_send_type          = false;  //CC_UPDT
    34383436           
    34393437                            read_to_cc_send_fifo_srcid      = r_read_copy.read();
     
    67816779                    r_cleanup_to_tgt_rsp_srcid   = r_cleanup_locked_srcid.read();
    67826780                    r_cleanup_to_tgt_rsp_trdid   = r_cleanup_locked_trdid.read();
     6781                    r_cleanup_to_tgt_rsp_nline   = r_cleanup_nline.read();
    67836782                   
    67846783                    r_cleanup_to_tgt_rsp_pktid   = 0x8 + r_cleanup_locked_pktid.read(); // there is not a brdcast for cas operation. in cache L1, the line can be in M state
     
    82798278            case CC_SEND_CONFIG_IDLE:    // XRAM_RSP FSM has highest priority
    82808279                {
     8280                    bool cc_send_updt_delay = not r_read_to_cc_send_type.read() and r_tgt_rsp_fsm.read() == TGT_RSP_CLEANUP and
     8281                                              r_read_to_cc_send_nline.read() == r_cleanup_to_tgt_rsp_nline.read() and
     8282                                              m_read_to_cc_send_srcid_fifo.read() == r_cleanup_to_tgt_rsp_srcid.read();
    82818283                    // XRAM_RSP
    82828284                    if(m_xram_rsp_to_cc_send_inst_fifo.rok() or
     
    83058307
    83068308                    // READ
    8307                     if(m_read_to_cc_send_inst_fifo.rok() or
    8308                             r_read_to_cc_send_multi_req.read())
     8309                    if((m_read_to_cc_send_inst_fifo.rok() or
     8310                            r_read_to_cc_send_multi_req.read()) and not cc_send_updt_delay)
    83098311                    {
    83108312                        r_cc_send_fsm = CC_SEND_READ_MULTI_HEADER;
     
    83518353            case CC_SEND_WRITE_IDLE:     // CONFIG FSM has highest priority
    83528354                {
     8355                    bool cc_send_updt_delay = not r_read_to_cc_send_type.read() and r_tgt_rsp_fsm.read() == TGT_RSP_CLEANUP and
     8356                                              r_read_to_cc_send_nline.read() == r_cleanup_to_tgt_rsp_nline.read() and
     8357                                              m_read_to_cc_send_srcid_fifo.read() == r_cleanup_to_tgt_rsp_srcid.read();
    83538358                    // CONFIG
    83548359                    if(r_config_to_cc_send_multi_req.read())
     
    83878392                    }
    83888393                    // READ
    8389                     if(m_read_to_cc_send_inst_fifo.rok() or
    8390                             r_read_to_cc_send_multi_req.read())
     8394                    if((m_read_to_cc_send_inst_fifo.rok() or
     8395                            r_read_to_cc_send_multi_req.read()) and not cc_send_updt_delay)
    83918396                    {
    83928397                        r_cc_send_fsm = CC_SEND_READ_MULTI_HEADER;
     
    84208425            case CC_SEND_XRAM_RSP_IDLE:   // CAS FSM has highest priority
    84218426                {
     8427                    bool cc_send_updt_delay = not r_read_to_cc_send_type.read() and r_tgt_rsp_fsm.read() == TGT_RSP_CLEANUP and
     8428                                              r_read_to_cc_send_nline.read() == r_cleanup_to_tgt_rsp_nline.read() and
     8429                                              m_read_to_cc_send_srcid_fifo.read() == r_cleanup_to_tgt_rsp_srcid.read();
    84228430                    // CAS
    84238431                    if(m_cas_to_cc_send_inst_fifo.rok() or
     
    84338441                    }
    84348442                    // READ
    8435                     if(m_read_to_cc_send_inst_fifo.rok() or
    8436                             r_read_to_cc_send_multi_req.read())
     8443                    if((m_read_to_cc_send_inst_fifo.rok() or
     8444                            r_read_to_cc_send_multi_req.read()) and not cc_send_updt_delay)
    84378445                    {
    84388446                        r_cc_send_fsm = CC_SEND_READ_MULTI_HEADER;
     
    84848492            case CC_SEND_CAS_IDLE:   // CLEANUP FSM has highest priority
    84858493                {
     8494                    bool cc_send_updt_delay = not r_read_to_cc_send_type.read() and r_tgt_rsp_fsm.read() == TGT_RSP_CLEANUP and
     8495                                              r_read_to_cc_send_nline.read() == r_cleanup_to_tgt_rsp_nline.read() and
     8496                                              m_read_to_cc_send_srcid_fifo.read() == r_cleanup_to_tgt_rsp_srcid.read();
    84868497                    // READ
    8487                     if(m_read_to_cc_send_inst_fifo.rok() or
    8488                             r_read_to_cc_send_multi_req.read())
     8498                    if((m_read_to_cc_send_inst_fifo.rok() or
     8499                            r_read_to_cc_send_multi_req.read()) and not cc_send_updt_delay)
    84898500                    {
    84908501                        r_cc_send_fsm = CC_SEND_READ_MULTI_HEADER;
     
    85488559            case CC_SEND_READ_IDLE:    // WRITE FSM has highest priority 
    85498560                {
     8561                    bool cc_send_updt_delay = not r_read_to_cc_send_type.read() and r_tgt_rsp_fsm.read() == TGT_RSP_CLEANUP and
     8562                                              r_read_to_cc_send_nline.read() == r_cleanup_to_tgt_rsp_nline.read() and
     8563                                              m_read_to_cc_send_srcid_fifo.read() == r_cleanup_to_tgt_rsp_srcid.read();
    85508564                    //WRITE
    85518565                    if(m_write_to_cc_send_inst_fifo.rok() or
     
    85968610                    }
    85978611                    // READ
    8598                     if(m_read_to_cc_send_inst_fifo.rok() or
    8599                             r_read_to_cc_send_multi_req.read())
     8612                    if((m_read_to_cc_send_inst_fifo.rok() or
     8613                            r_read_to_cc_send_multi_req.read()) and not cc_send_updt_delay)
    86008614                    {
    86018615                        r_cc_send_fsm = CC_SEND_READ_MULTI_HEADER;
     
    86138627            case CC_SEND_CONFIG_INVAL_HEADER:   // send first flit multi-inval (from CONFIG FSM)
    86148628                {
     8629
    86158630                    if(m_config_to_cc_send_inst_fifo.rok())
    86168631                    {
     
    1149911514                    DspinDhccpParam::dspin_set( flit,
    1150011515                            1,
    11501                             DspinDhccpParam::MULTI_INVAL_IS_CONFIG);
     11516                            DspinDhccpParam::BRDCAST_IS_CONFIG);
    1150211517
    1150311518                    DspinDhccpParam::dspin_set( flit,
     
    1154611561                            r_read_to_cc_send_srcid.read(),    // send the srcid itself which demands the request getM
    1154711562                            DspinDhccpParam::BROADCAST_SRCID);
     11563
     11564                    DspinDhccpParam::dspin_set( flit,
     11565                            r_read_to_cc_send_is_shared.read(),    // send the actuel line state in memcache
     11566                            DspinDhccpParam::BRDCAST_IS_SHARED);
    1154811567
    1154911568                    DspinDhccpParam::dspin_set( flit,
     
    1161811637                    DspinDhccpParam::dspin_set(
    1161911638                            flit,
    11620                             r_read_to_cc_send_srcid.read(),
    11621                             DspinDhccpParam::MULTI_INVAL_SRCID);
     11639                            r_read_to_cc_send_is_shared.read(),
     11640                            DspinDhccpParam::MULTI_INVAL_IS_SHARED);
    1162211641
    1162311642                    if(r_read_to_cc_send_type.read())
Note: See TracChangeset for help on using the changeset viewer.