⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 at_target_4_phase.cpp

📁 SystemC Transaction Level Modelling. 是基于SystemC之上的总线互联协议
💻 CPP
📖 第 1 页 / 共 2 页
字号:
  tlm::tlm_sync_enum        status = tlm::TLM_COMPLETED;//-----------------------------------------------------------------------------  //  Process all transactions scheduled for current time a return value of NULL //  indicates that the PEQ is empty at this time//-----------------------------------------------------------------------------   while ((transaction_ptr = m_end_request_PEQ.get_next_transaction()) != NULL)  {    msg.str("");    msg << "Target: " << m_ID         << " starting end-request method";    sc_core::sc_time delay  = sc_core::SC_ZERO_TIME;        m_target_memory.get_delay(*transaction_ptr, delay); // get memory operation delay    m_response_PEQ.notify(*transaction_ptr, delay);     // put transaction in the PEQ    tlm::tlm_phase phase    = tlm::END_REQ;     delay                   = sc_core::SC_ZERO_TIME;    msg << endl << "      "        << "Target: " << m_ID           << " transaction moved to send-response PEQ "        << endl << "      ";    msg << "Target: " << m_ID         << " nb_transport_bw (GP, "         << report::print(phase) << ", "        << delay << ")" ;    REPORT_INFO(filename,  __FUNCTION__, msg.str());//-----------------------------------------------------------------------------// Call nb_transport_bw with phase END_REQ check the returned status //-----------------------------------------------------------------------------    status = m_memory_socket->nb_transport_bw(*transaction_ptr, phase, delay);        msg.str("");    msg << "Target: " << m_ID        << " " << report::print(status) << " (GP, "        << report::print(phase) << ", "        << delay << ")";     REPORT_INFO(filename,  __FUNCTION__, msg.str());    switch (status)    { //=============================================================================    case tlm::TLM_ACCEPTED:      {           // more phases will follow                break;      }//=============================================================================    case tlm::TLM_COMPLETED:          {                  msg << "Target: " << m_ID             << " TLM_COMPLETED invalid response to END_REQ" << endl            << "      Initiator must receive data before ending transaction";        REPORT_FATAL(filename, __FUNCTION__, msg.str());         break;      }//=============================================================================    case tlm::TLM_UPDATED:         {          msg << "Target: " << m_ID             << " TLM_UPDATED invalid response to END_REQ" << endl            << "      Initiator must receive data before updating transaction";          REPORT_FATAL(filename, __FUNCTION__, msg.str());         break;      } //=============================================================================    default:      {         msg << "Target: " << m_ID              << " Illegal return status";         REPORT_FATAL(filename, __FUNCTION__, msg.str());         break;      }    }// end switch  } // end while} //end end_request_method//=============================================================================/// begin_response method function implementation//// This method is statically sensitive to m_response_PEQ.get_event ////=============================================================================void at_target_4_phase::begin_response_method (void){  std::ostringstream        msg;                    // log message  tlm::tlm_generic_payload  *transaction_ptr;       // generic payload pointer  tlm::tlm_sync_enum        status = tlm::TLM_COMPLETED;//-----------------------------------------------------------------------------  //  Process all transactions scheduled for current time a return value of NULL //  indicates that the PEQ is empty at this time//-----------------------------------------------------------------------------   // set default trigger, will be overridden by TLM_COMPLETED or TLM_UPDATED  next_trigger (m_response_PEQ.get_event());      while ((transaction_ptr = m_response_PEQ.get_next_transaction()) != NULL)  {    msg.str("");    msg << "Target: " << m_ID         << " starting response method";    REPORT_INFO(filename,  __FUNCTION__, msg.str());              sc_core::sc_time delay  = sc_core::SC_ZERO_TIME;      m_target_memory.operation(*transaction_ptr, delay); /// perform memory operation    tlm::tlm_phase  phase = tlm::BEGIN_RESP;                     delay = sc_core::SC_ZERO_TIME;                        msg.str("");    msg << "Target: " << m_ID         << " nb_transport_bw (GP, BEGIN_RESP, SC_ZERO_TIME)";    REPORT_INFO(filename,  __FUNCTION__, msg.str());//-----------------------------------------------------------------------------// Call nb_transport_bw with phase BEGIN_RESP check the returned status //-----------------------------------------------------------------------------    status = m_memory_socket->nb_transport_bw(*transaction_ptr, phase, delay);        msg.str("");    msg << "Target: " << m_ID        << " " << report::print(status) << " (GP, "        << report::print(phase) << ", "        << delay << ")";     REPORT_INFO(filename,  __FUNCTION__, msg.str());    bool bail = false;        switch (status)    { //=============================================================================    case tlm::TLM_COMPLETED:          {                  next_trigger (delay);               // honor the annotated delay         bail = true;        break;      }      //=============================================================================    case tlm::TLM_ACCEPTED:      {             next_trigger (m_end_resp_rcvd_event); // honor end-response rule          bail = true;        break;      }//=============================================================================    case tlm::TLM_UPDATED:         {        msg << "Target: " << m_ID             << " TLM_UPDATED invalid response to BEGIN_RESP" << endl            << "      If the phase has been advanced, transaction should be TLM_COMPLETED";        REPORT_FATAL(filename, __FUNCTION__, msg.str());       break;      } //=============================================================================    default:                        {         msg << "Target: " << m_ID              << " Illegal return status " << status;         REPORT_FATAL(filename, __FUNCTION__, msg.str());         break;      }    }// end switch        if ( bail )    {      break;    }  } // end while} //end begin_response_queue_active//==============================================================================// Methods Required by Target Interface but not Implemented for this Example// Not implemented for this example but required by interfacebool                                            at_target_4_phase::get_direct_mem_ptr      (tlm::tlm_generic_payload   &payload,             ///< address + extensions   tlm::tlm_dmi               &data                 ///< dmi data  ){  // THis is not a fatal, print first as warning  std::ostringstream  msg;  msg.str("");  if(!m_get_dm_ptr_prev_warning)    {      msg << "Target: " << m_ID           << " DMI not implemented for this example";      REPORT_WARNING(filename, __FUNCTION__, msg.str());       m_get_dm_ptr_prev_warning = true;     }	        return false;}// Not implemented for this example but required by interfaceunsigned int                                        // resultat_target_4_phase::transport_dbg            ( tlm::tlm_generic_payload   &payload               ///< debug payload){  std::ostringstream  msg;   msg.str("");  if(!m_trans_dbg_prev_warning)  {    msg << "Target: " << m_ID         << " DBG(debug) not implemented for this example";    REPORT_WARNING(filename, __FUNCTION__, msg.str());     m_trans_dbg_prev_warning = true;  }                return false;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -