Changeset 336 for branches/v5/modules


Ignore:
Timestamp:
Mar 27, 2013, 2:25:37 PM (12 years ago)
Author:
cfuguet
Message:

Bug fix in the vci_cc_vcache_wrapper and vci_mem_cache components
(and the corresponding dspin coherence versions)

vci_cc_vcache_wrapper:

In the VCI_CMD FSM of the cc_vcache, for the SC command as for the
CAS command, we must set the CONS bit in the VCI packet. In the
same manner we must unset the CONTIG bit in the VCI packet for these
two commands.
These two kind of commands have two flits with the same VCI address.

vci_mem_cache

In the state WRITE_DIR_REQ, we don't have to rewrite the registers
address or word index because they will be assigned with the correct
values in the WRITE_IDLE or WRITE_RSP states.

Location:
branches/v5/modules
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/v5/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r304 r336  
    56525652    // it depends on the CMD FSM state
    56535653
     5654    bool is_sc_or_cas  = (r_vci_cmd_fsm.read() == CMD_DATA_CAS) or
     5655                         (r_vci_cmd_fsm.read() == CMD_DATA_SC );
     5656
    56545657    p_vci_ini_d.pktid  = 0;
    56555658    p_vci_ini_d.srcid  = m_srcid_d;
    5656     p_vci_ini_d.cons   = (r_vci_cmd_fsm.read() == CMD_DATA_CAS);
    5657     p_vci_ini_d.contig = not (r_vci_cmd_fsm.read() == CMD_DATA_CAS);
     5659    p_vci_ini_d.cons   = is_sc_or_cas;
     5660    p_vci_ini_d.contig = not is_sc_or_cas;
    56585661    p_vci_ini_d.wrap   = false;
    56595662    p_vci_ini_d.clen   = 0;
  • branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/src/vci_cc_vcache_wrapper_dspin_coherence.cpp

    r333 r336  
    56765676    // it depends on the CMD FSM state
    56775677
     5678    bool is_sc_or_cas  = (r_vci_cmd_fsm.read() == CMD_DATA_CAS) or
     5679                         (r_vci_cmd_fsm.read() == CMD_DATA_SC );
     5680
    56785681    p_vci_ini_d.pktid  = 0;
    56795682    p_vci_ini_d.srcid  = m_srcid_d;
    5680     p_vci_ini_d.cons   = (r_vci_cmd_fsm.read() == CMD_DATA_CAS);
    5681     p_vci_ini_d.contig = not (r_vci_cmd_fsm.read() == CMD_DATA_CAS);
     5683    p_vci_ini_d.cons   = is_sc_or_cas;
     5684    p_vci_ini_d.contig = not is_sc_or_cas;
    56825685    p_vci_ini_d.wrap   = false;
    56835686    p_vci_ini_d.clen   = 0;
  • branches/v5/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r335 r336  
    17931793        // consume a word in the FIFO & write it in the local buffer
    17941794        cmd_write_fifo_get  = true;
    1795         r_write_pending_sc  = false;
    17961795        size_t index        = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())];
    17971796
     
    18031802        r_write_trdid       = m_cmd_write_trdid_fifo.read();
    18041803        r_write_pktid       = m_cmd_write_pktid_fifo.read();
     1804        r_write_pending_sc  = false;
    18051805
    18061806        // initialize the be field for all words
     
    18601860        // consume a word in the FIFO & write it in the local buffer
    18611861        cmd_write_fifo_get  = true;
    1862         r_write_pending_sc  = false;
    18631862        size_t index        = r_write_word_index.read() + r_write_word_count.read();
    18641863
     
    18771876    ////////////////////
    18781877    case WRITE_DIR_REQ:
    1879     // Get the lock to the directory
    18801878    {
    1881       if ( r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE )
    1882       {
    1883         if(((r_write_pktid.read() & 0x7) == TYPE_SC) && not r_write_pending_sc.read()) // check for an SC command (and check that its second flit is not already consumed)
    1884         {
    1885           if ( m_cmd_write_addr_fifo.rok() )
    1886           {
    1887             size_t index    = m_x[(vci_addr_t)(r_write_address.read())];
    1888             bool sc_success = m_llsc_table.sc(r_write_address.read(),r_write_data[index].read());
    1889             r_write_sc_fail = !sc_success;
    1890 
    1891             assert(m_cmd_write_eop_fifo.read() && "Error in VCI_MEM_CACHE : invalid packet format for SC command");
    1892             // consume a word in the FIFO & write it in the local buffer
    1893             cmd_write_fifo_get  = true;
    1894             r_write_pending_sc  = true;
    1895             index               = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())];
    1896 
    1897             r_write_address     = (addr_t)(m_cmd_write_addr_fifo.read());
    1898             r_write_word_index  = index;
    1899             r_write_word_count  = 1;
    1900             r_write_data[index] = m_cmd_write_data_fifo.read();
    1901             if (!sc_success)
    1902             {
    1903               r_write_fsm = WRITE_RSP;
    1904               break;
    1905             }
    1906           }
    1907           else break;
    1908         }
    1909         //else it is a TYPE_WRITE, need a simple sw access to the
    1910         // llsc_global_table
    1911         else
    1912         {
    1913           m_llsc_table.sw(r_write_address.read());
    1914         }
     1879      // Get the lock to the directory
     1880      // and access the llsc_global_table
     1881      if(r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE)
     1882      {
     1883        ///////////////////////////////////////////////////////////////////////
     1884        // SC command treatment
     1885        // We test the r_write_pending_sc register to know if we are returning
     1886        // from the WAIT state.
     1887        // In this case, the SC has already succeed and we cannot consume
     1888        // another time from the FIFO. Also, we don't have to test another
     1889        // time if the SC has succeed
     1890        if(((r_write_pktid.read() & 0x7) == TYPE_SC) and not r_write_pending_sc.read())
     1891        {
     1892          if(not m_cmd_write_addr_fifo.rok()) break;
     1893
     1894          assert(m_cmd_write_eop_fifo.read() &&
     1895                 "Error in VCI_MEM_CACHE : "
     1896                 "invalid packet format for SC command");
     1897
     1898          size_t index    = r_write_word_index.read();
     1899          bool sc_success = m_llsc_table.sc(r_write_address.read()    ,
     1900                                            r_write_data[index].read());
     1901
     1902          // consume a word in the FIFO & write it in the local buffer
     1903          cmd_write_fifo_get  = true;
     1904          r_write_data[index] = m_cmd_write_data_fifo.read();
     1905          r_write_sc_fail     = not sc_success;
     1906          r_write_pending_sc  = true;
     1907
     1908          if(not sc_success) r_write_fsm = WRITE_RSP;
     1909          else               r_write_fsm = WRITE_DIR_LOCK;
     1910
     1911          break;
     1912        }
     1913
     1914        ///////////////////////////////////////////////////////////////////////
     1915        // WRITE command or SC command treatment returning from the WAIT state
     1916        // In the second case, we must access the LL/SC global table to
     1917        // erase any possible new reservation when we release the lock on the
     1918        // directory
     1919        m_llsc_table.sw(r_write_address.read());
     1920
    19151921        r_write_fsm = WRITE_DIR_LOCK;
    19161922      }
    19171923
    19181924#if DEBUG_MEMC_WRITE
    1919       if( m_debug_write_fsm )
    1920       {
    1921         std::cout 
    1922           << "  <MEMC " << name() << ".WRITE_DIR_REQ> Requesting DIR lock "
    1923           << std::endl;
     1925      if(m_debug_write_fsm)
     1926      {
     1927        std::cout
     1928            << "  <MEMC " << name() << ".WRITE_DIR_REQ> Requesting DIR lock "
     1929            << std::endl;
    19241930      }
    19251931#endif
     
    23922398          // consume a word in the FIFO & write it in the local buffer
    23932399          cmd_write_fifo_get  = true;
    2394           r_write_pending_sc  = false;
    23952400          size_t index        = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())];
    23962401
     
    24022407          r_write_trdid       = m_cmd_write_trdid_fifo.read();
    24032408          r_write_pktid       = m_cmd_write_pktid_fifo.read();
     2409          r_write_pending_sc  = false;
    24042410
    24052411          // initialize the be field for all words
  • branches/v5/modules/vci_mem_cache_dspin_coherence/caba/source/include/vci_mem_cache_dspin_coherence.h

    r331 r336  
    565565      sc_signal<size_t>   r_write_upt_index;  // index in Update Table
    566566      sc_signal<bool>     r_write_sc_fail;    // sc command failed
    567       sc_signal<bool>     r_write_pending_sc; // sc command pending in WRITE fsm
     567      sc_signal<bool>     r_write_pending_sc; // sc command pending
    568568
    569569      // Buffer between WRITE fsm and TGT_RSP fsm (acknowledge a write command from L1)
  • branches/v5/modules/vci_mem_cache_dspin_coherence/caba/source/src/vci_mem_cache_dspin_coherence.cpp

    r335 r336  
    19401940        // consume a word in the FIFO & write it in the local buffer
    19411941        cmd_write_fifo_get  = true;
    1942         r_write_pending_sc  = false;
    19431942        size_t index        = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())];
    19441943
     
    19501949        r_write_trdid       = m_cmd_write_trdid_fifo.read();
    19511950        r_write_pktid       = m_cmd_write_pktid_fifo.read();
     1951        r_write_pending_sc  = false;
    19521952
    19531953        // initialize the be field for all words
     
    19551955        {
    19561956          if(word == index) r_write_be[word] = m_cmd_write_be_fifo.read();
    1957           else                 r_write_be[word] = 0x0;
    1958         }
    1959 
    1960         if(m_cmd_write_eop_fifo.read() || ((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC))
     1957          else              r_write_be[word] = 0x0;
     1958        }
     1959
     1960        if (m_cmd_write_eop_fifo.read() || ((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC))
    19611961        {
    19621962          r_write_fsm = WRITE_DIR_REQ;
     
    19891989        if(m_debug_write_fsm)
    19901990        {
    1991           std::cout << "  <MEMC " << name() << ".WRITE_NEXT> Write another word in local buffer"
     1991          std::cout << "  <MEMC " << name()
     1992                    << ".WRITE_NEXT> Write another word in local buffer"
    19921993                    << std::endl;
    19931994        }
     
    20072008        // consume a word in the FIFO & write it in the local buffer
    20082009        cmd_write_fifo_get  = true;
    2009         r_write_pending_sc  = false;
    20102010        size_t index        = r_write_word_index.read() + r_write_word_count.read();
    20112011
     
    20242024    ////////////////////
    20252025    case WRITE_DIR_REQ:
     2026    {
    20262027      // Get the lock to the directory
    2027     {
     2028      // and access the llsc_global_table
    20282029      if(r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE)
    20292030      {
    2030         if(((r_write_pktid.read() & 0x7) == TYPE_SC) && not r_write_pending_sc.read())    // check for an SC command (and check that its second flit is not already consumed)
    2031         {
    2032           if(m_cmd_write_addr_fifo.rok())
    2033           {
    2034             size_t index    = m_x[(vci_addr_t)(r_write_address.read())];
    2035             bool sc_success = m_llsc_table.sc(r_write_address.read(),r_write_data[index].read());
    2036             r_write_sc_fail = !sc_success;
    2037 
    2038             assert(m_cmd_write_eop_fifo.read() && "Error in VCI_MEM_CACHE : invalid packet format for SC command");
    2039             // consume a word in the FIFO & write it in the local buffer
    2040             cmd_write_fifo_get  = true;
    2041             r_write_pending_sc  = true;
    2042             index               = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())];
    2043 
    2044             r_write_address     = (addr_t)(m_cmd_write_addr_fifo.read());
    2045             r_write_word_index  = index;
    2046             r_write_word_count  = 1;
    2047             r_write_data[index] = m_cmd_write_data_fifo.read();
    2048             if(!sc_success)
    2049             {
    2050               r_write_fsm = WRITE_RSP;
    2051               break;
    2052             }
    2053           }
    2054           else break;
    2055         }
    2056         //else it is a TYPE_WRITE, need a simple sw access to the
    2057         // llsc_global_table
    2058         else
    2059         {
    2060           m_llsc_table.sw(r_write_address.read());
    2061         }
     2031        ///////////////////////////////////////////////////////////////////////
     2032        // SC command treatment
     2033        // We test the r_write_pending_sc register to know if we are returning
     2034        // from the WAIT state.
     2035        // In this case, the SC has already succeed and we cannot consume
     2036        // another time from the FIFO. Also, we don't have to test another
     2037        // time if the SC has succeed
     2038        if(((r_write_pktid.read() & 0x7) == TYPE_SC) and not r_write_pending_sc.read())
     2039        {
     2040          if(not m_cmd_write_addr_fifo.rok()) break;
     2041
     2042          assert(m_cmd_write_eop_fifo.read() &&
     2043                 "Error in VCI_MEM_CACHE : "
     2044                 "invalid packet format for SC command");
     2045
     2046          size_t index    = r_write_word_index.read();
     2047          bool sc_success = m_llsc_table.sc(r_write_address.read()    ,
     2048                                            r_write_data[index].read());
     2049
     2050          // consume a word in the FIFO & write it in the local buffer
     2051          cmd_write_fifo_get  = true;
     2052          r_write_data[index] = m_cmd_write_data_fifo.read();
     2053          r_write_sc_fail     = not sc_success;
     2054          r_write_pending_sc  = true;
     2055
     2056          if(not sc_success) r_write_fsm = WRITE_RSP;
     2057          else               r_write_fsm = WRITE_DIR_LOCK;
     2058
     2059          break;
     2060        }
     2061
     2062        ///////////////////////////////////////////////////////////////////////
     2063        // WRITE command treatment or SC command returning from the WAIT state
     2064        // In the second case, we must access the LL/SC global table to
     2065        // erase any possible new reservation when we release the lock on the
     2066        // directory
     2067        m_llsc_table.sw(r_write_address.read());
     2068
    20622069        r_write_fsm = WRITE_DIR_LOCK;
    20632070      }
     
    22312238
    22322239      if(no_update)
    2233         // Write transaction completed
     2240      // Write transaction completed
    22342241      {
    22352242        r_write_fsm = WRITE_RSP;
    22362243      }
    22372244      else
    2238         // coherence update required
     2245      // coherence update required
    22392246      {
    22402247        if(!r_write_to_cc_send_multi_req.read()   &&
     
    23232330        //  releases the lock protecting UPT and the DIR if no entry...
    23242331        if(wok) r_write_fsm = WRITE_UPT_HEAP_LOCK;
    2325         else       r_write_fsm = WRITE_WAIT;
     2332        else    r_write_fsm = WRITE_WAIT;
    23262333      }
    23272334      break;
     
    25392546          // consume a word in the FIFO & write it in the local buffer
    25402547          cmd_write_fifo_get  = true;
    2541           r_write_pending_sc  = false;
    25422548          size_t index        = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())];
    25432549
     
    25492555          r_write_trdid       = m_cmd_write_trdid_fifo.read();
    25502556          r_write_pktid       = m_cmd_write_pktid_fifo.read();
     2557          r_write_pending_sc  = false;
    25512558
    25522559          // initialize the be field for all words
Note: See TracChangeset for help on using the changeset viewer.