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

📄 at_initiator_annotated.cpp

📁 SystemC Transaction Level Modelling. 是基于SystemC之上的总线互联协议
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//=============================================================================tlm::tlm_sync_enum    at_initiator_annotated::nb_transport_bw                  // inbound nb_transport_bw( tlm::tlm_generic_payload&  transaction_ref            // generic payload , tlm::tlm_phase&            phase                     // tlm phase , sc_time&                   delay                     // delay ){  tlm::tlm_sync_enum        status = tlm::TLM_COMPLETED;  // return status reject by default  std::ostringstream        msg;                          // log message  //=============================================================================// Check waiting backward path map of valid transaction  //=============================================================================  waiting_bw_path_map::iterator transaction_inter;      // create interator for map  transaction_inter  = m_waiting_bw_path_map.find(&transaction_ref);     if (transaction_inter == m_waiting_bw_path_map.end() ) {               //=============================================================================//  The transaction pointer used by the backward path call does not belong //  to this initiator, this is a major error //=============================================================================    msg << "      "    << "Initiator: " << m_ID     << " Received invalid transaction pointer";    REPORT_FATAL (filename, __FUNCTION__, msg.str() );  }//=============================================================================//  Normal operation  //    Decode backward path phase //=============================================================================    else {     msg.str ("");    msg << "Initiator: " << m_ID                       << " nb_transport_bw (GP, "         << report::print(phase) << ", "        << delay << ")"        << endl;    switch (phase) {//-----------------------------------------------------------------------------// Target has responded with END_REQ //    notify enable next request event//-----------------------------------------------------------------------------    case tlm::END_REQ:  {        msg << "      "            << "Initiator: " << m_ID            << " transaction waiting begin-response on backward path"             << endl;                      m_enable_next_request_event.notify(SC_ZERO_TIME);                 transaction_inter->second = Rcved_END_REQ_enum;           status = tlm::TLM_ACCEPTED;                msg << "      "            << "Initiator: " << m_ID            << " " << report::print(status) <<  " (GP, "            << report::print(phase) << ", "            << delay << ")";         REPORT_INFO (filename, __FUNCTION__, msg.str() );        break;      }//-----------------------------------------------------------------------------//  Target has responded with BEGIN_RESP //    Use payload event queue to schedule sending end response  //    If there was no END REQUEST this ends the request phase notify//    enable next request event//-----------------------------------------------------------------------------    case tlm::BEGIN_RESP: {       msg << "      "          << "Initiator: " << m_ID           << " transaction moved to send-end-response PEQ "          << endl;         // check for a synthetic 3-phase transaction (BEGIN_RESP without END_REQ) ?????      if (transaction_inter->second == Rcved_ACCEPTED_enum) {        m_enable_next_request_event.notify(SC_ZERO_TIME);         }              m_waiting_bw_path_map.erase(&transaction_ref);    // erase from map       phase   = tlm::END_RESP;                          // set appropriate return phase      delay   = m_end_rsp_delay;                        // wait for the response delay      status  = tlm::TLM_COMPLETED;                     // return status            response_out_port->write(&transaction_ref);     // transaction to rsp fifo port      msg << "      "          << "Initiator: " << m_ID          << " " << report::print(status) <<  " (GP, "          << report::print(phase) << ", "          << delay << ")" ;       REPORT_INFO (filename, __FUNCTION__, msg.str() );      break;    }  // end case BEGIN_RESP//-----------------------------------------------------------------------------// Invalid phase for backward path //-----------------------------------------------------------------------------    case tlm::BEGIN_REQ:     case tlm::END_RESP:       {        msg.str ("");        msg << m_ID << " Illegal phase on backward path ";        REPORT_FATAL(filename, __FUNCTION__, msg.str() );        break;         }//-----------------------------------------------------------------------------// Unknown phase on backward path  //-----------------------------------------------------------------------------    default:       {                             msg.str ("");        msg << m_ID << " Unknown phase on the backward path ";        REPORT_WARNING (filename, __FUNCTION__, msg.str() );        break;         }    } // end switch (phase)  }    return status;} // end backward nb transport //=============================================================================///  @fn at_initiator_annotated::send_end_rsp_method/////  @brief send end response method/////  @details This method is scheduled to send the end-response timing point.///           It is sensitive to the m_send_end_rsp_PEQ.get_event() event. ////=============================================================================void at_initiator_annotated::send_end_rsp_method(void) // send end response method{  tlm::tlm_generic_payload* transaction_ptr;  std::ostringstream        msg;                      // log message//-----------------------------------------------------------------------------  //  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_send_end_rsp_PEQ.get_next_transaction()) != NULL)  {    tlm::tlm_phase phase  = tlm::END_RESP;          // set the appropriate phase    sc_time delay         = SC_ZERO_TIME;    msg.str("");    msg   << "Initiator: " << m_ID        << " starting send-end-response method"        << endl << "      "         << "Initiator: " << m_ID                       << " nb_transport_fw (GP, "         << report::print(phase) << ", "        << delay << ")";    REPORT_INFO(filename,  __FUNCTION__, msg.str());    // call begin response and then decode return status    tlm::tlm_sync_enum     return_value = initiator_socket->nb_transport_fw(*transaction_ptr, phase, delay);        msg.str("");    msg << "Initiator: " << m_ID      << " " << report::print(return_value) <<  " (GP, "      << report::print(phase) << ", "      << delay << ")";     switch (return_value)        {      case tlm::TLM_COMPLETED:                        // transaction complete      {        response_out_port->write(transaction_ptr);    // send GP to output rsp fifo                REPORT_INFO (filename, __FUNCTION__, msg.str() );        break;      }      case tlm::TLM_ACCEPTED:       case tlm::TLM_UPDATED:         {        msg << "      "             << "Initiator: " << m_ID            << report::print(return_value) << " Invalid return value for END_RESP ";        REPORT_FATAL(filename,  __FUNCTION__, msg.str());         break;      }            default:       {        msg << "      "             << "Initiator: " << m_ID            << report::print(return_value) << " Unknown return value for END_RESP ";        REPORT_FATAL(filename,  __FUNCTION__, msg.str());         break;      }    } // end switch   } // end while     return;} // end send_end_rsp_method//=============================================================================///  @fn at_initiator_annotated::invalidate_direct_mem_ptr/////  @brief invalidate direct memory pointer Not implemented //=============================================================================void at_initiator_annotated::invalidate_direct_mem_ptr  // invalidate_direct_mem_ptr( sc_dt::uint64 start_range                             // start range, sc_dt::uint64 end_range                               // end range) {  std::ostringstream       msg;                         // log message  msg.str ("");  msg << m_ID << " invalidate_direct_mem_ptr: not implemented";  REPORT_INFO(filename, __FUNCTION__, msg.str());}

⌨️ 快捷键说明

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