Changes between Version 125 and Version 126 of Writing Rules/Tlmt


Ignore:
Timestamp:
Mar 3, 2009, 11:21:40 AM (15 years ago)
Author:
alinevieiramello@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Tlmt

    v125 v126  
    251251    p_vci_init("socket")                  // vci initiator socket name
    252252{
    253   //register callback function VCI INITIATOR SOCKET
     253  //register callback function (VCI INITIATOR SOCKET)
    254254  p_vci_init.register_nb_transport_bw(this, &my_initiator::my_nb_transport_bw);
    255255   //initiator identification
     
    281281  time = m_pdes_local_time->get();
    282282  //send a message with command equals to PDES_ACTIVE or PDES_INACTIVE
    283   p_vci_initiator->nb_transport_fw(*payload_ptr, phase, time);
     283  p_vci_init->nb_transport_fw(*payload_ptr, phase, time);
    284284  //wait a response
    285285  wait(m_rspEvent);
     
    303303  time = m_pdes_local_time->get();
    304304  //send a null message
    305   p_vci_initiator->nb_transport_fw(*payload_ptr, phase, time);
     305  p_vci_init->nb_transport_fw(*payload_ptr, phase, time);
    306306  //deschedule the initiator thread
    307307  wait(sc_core::SC_ZERO_TIME);
     
    345345    time = m_pdes_local_time->get();
    346346    // send the transaction and wait a response
    347     p_vci_initiator->nb_transport_fw(*payload_ptr, phase, time);
     347    p_vci_init->nb_transport_fw(*payload_ptr, phase, time);
    348348    wait(m_rspEvent);
    349349 
     
    433433== E.5) VCI target example ==
    434434{{{
    435 #include "my_target.h"
     435#include "my_target.h"                              // header
    436436
    437437my_target::my_target
    438 ( sc_core::sc_module_name name,
    439   const soclib::common::IntTab &index,
    440   const soclib::common::MappingTable &mt)
    441   : sc_module(name),
    442     m_mt(mt),
    443     p_vci_target("socket")
     438( sc_core::sc_module_name name,                     // module name
     439  const soclib::common::IntTab &index,              // index of mapping table
     440  const soclib::common::MappingTable &mt)           // mapping table
     441  : sc_module(name),                                // init module name
     442    m_mt(mt),                                       // mapping table
     443    p_vci_target("socket")                          // vci target socket name
    444444{
    445   //register callback fuction
     445  // register callback fuction (VCI TARGET SOCKET)
    446446  p_vci_target.register_nb_transport_fw(this, &my_target::my_nb_transport_fw);
    447  
    448   //identification
     447  // identification
    449448  m_tgtid = m_mt.indexForId(index);
    450449}
    451450
    452 my_target::~my_target(){}
    453 
    454 /////////////////////////////////////////////////////////////////////////////////////
    455 // Virtual Fuctions  tlm::tlm_fw_transport_if (VCI TARGET SOCKET)
    456 /////////////////////////////////////////////////////////////////////////////////////
    457 tlm::tlm_sync_enum my_target::my_nb_transport_fw          // non-blocking transport call through Bus
    458 ( tlm::tlm_generic_payload &payload,                      // generic payoad pointer
    459   tlm::tlm_phase           &phase,                       // transaction phase
    460   sc_core::sc_time         &time)                        // time it should take for transport
     451// inbound nb_transport_fw (VCI TARGET SOCKET)
     452tlm::tlm_sync_enum my_target::my_nb_transport_fw
     453( tlm::tlm_generic_payload &payload,                // payload
     454  tlm::tlm_phase           &phase,                  // phase
     455  sc_core::sc_time         &time)                   // time
    461456{
     457  // get the payload extension
    462458  soclib_payload_extension *extension_pointer;
    463459  payload.get_extension(extension_pointer);
    464460
    465   //this target does not treat the null message
     461  // this target does not treat the null message
    466462  if(extension_pointer->is_null_message()){
    467463    return tlm::TLM_COMPLETED;
    468464  }
    469    
    470   uint32_t srcid = extension_pointer->get_src_id();
     465  // get the number of words   
    471466  uint32_t nwords = payload.get_data_length() / vci_param::nbytes;
    472   uint32_t address = payload.get_address();
    473  
     467 
    474468  switch(extension_pointer->get_command()){
    475469  case soclib::tlmt::VCI_READ_COMMAND:
     
    479473    ...
    480474   
    481     //set response status
     475    //set ok to response status
    482476    payload.set_response_status(tlm::TLM_OK_RESPONSE);
    483     //modify the phase
    484     phase = tlm::BEGIN_RESP;
    485     //increment the target processing time
    486     time = time + (nwords * UNIT_TIME);
    487     //send the response
    488     p_vci_target->nb_transport_bw(payload, phase, time);
    489     return tlm::TLM_COMPLETED;
    490477    break;
    491478  default:
     479    //set error to response status
     480    payload.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);
    492481    break;
    493482  }
    494483 
    495   //send error message
    496   payload.set_response_status(tlm::TLM_COMMAND_ERROR_RESPONSE);
    497484  //modify the phase
    498485  phase = tlm::BEGIN_RESP;
    499486  //increment the target processing time
    500   time = time + nwords * UNIT_TIME;
     487  time = time + (nwords * UNIT_TIME);
    501488  //send the response
    502489  p_vci_target->nb_transport_bw(payload, phase, time);