Changes between Version 85 and Version 86 of Writing Rules/Tlmt


Ignore:
Timestamp:
Nov 17, 2008, 12:18:54 PM (15 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Tlmt

    v85 v86  
    423423////////////////////////// my_target.h ////////////////////////////////
    424424
    425 #ifndef __MY_TARGET_H__
    426 #define __MY_TARGET_H__
    427 
    428425#include "tlm.h"                        // TLM headers
    429426#include "tlmt_transactions.h"          // TLM-T headers
     
    438435  typedef soclib::tlmt::VciParams<uint32_t,uint32_t,4> vci_param;
    439436
     437///////////////////////
     438// Member variables
     439///////////////////////
    440440  uint32_t m_targetid;
    441441  soclib::common::MappingTable m_mt;
    442442
    443 
    444   /////////////////////////////////////////////////////////////////////////////////////
    445   // Interface Fuction  tlm::tlm_fw_transport_if (VCI SOCKET)
    446   /////////////////////////////////////////////////////////////////////////////////////
    447 
    448   // receive command from initiator
    449   tlm::tlm_sync_enum vci_cmd_received                 ///
    450   ( soclib_vci_types::tlm_payload_type &payload,      /// VCI payload pointer
    451     soclib_vci_types::tlm_phase_type   &phase,        /// transaction phase
    452     sc_core::sc_time                   &time);        /// time
     443  //////////////////////
     444  // Interface Function
     445  //////////////////////
     446  tlm::tlm_sync_enum vci_cmd_received         
     447  ( soclib_vci_types::tlm_payload_type &payload,      //  payload
     448    soclib_vci_types::tlm_phase_type   &phase,        //  phase
     449    sc_core::sc_time                   &time);        // time
    453450
    454451 protected:
    455452  SC_HAS_PROCESS(my_target);
     453
     454//////////////////////
     455// ports
     456//////////////////////
    456457 public:
    457   tlmt_simple_target_socket<my_target,32,soclib_vci_types> p_vci_target;        ///<  VCI target socket
    458 
     458  tlmt_simple_target_socket<my_target,32,soclib_vci_types> p_vci_target; 
     459
     460/////////////////////
     461// constructor
     462/////////////////////
    459463  my_target(sc_core::sc_module_name            name,
    460464         const soclib::common::IntTab       &index,
    461465         const soclib::common::MappingTable &mt);
    462 
    463   ~my_target();
    464466};
    465467
    466 #endif
    467 
    468468////////////////////////// my_target.cpp ////////////////////////////////
    469469
    470 #include "my_target.h"
    471 
    472 #ifndef MY_TARGET_DEBUG
    473 #define MY_TARGET_DEBUG 1
    474 #endif
    475 
    476 #define tmpl(x) x my_target
    477 
    478 //////////////////////////////////////////////////////////////////////////////////////////
    479 // CONSTRUCTOR
    480 //////////////////////////////////////////////////////////////////////////////////////////
    481 tmpl(/**/)::my_target
     470/////////////////////
     471// constructor
     472/////////////////////
     473my_target::my_target
    482474           ( sc_core::sc_module_name name,
    483475             const soclib::common::IntTab &index,
     
    487479           p_vci_target("p_vci_target")
    488480{
    489   //register callback fuction
     481  // link the interface function to the VCI port
    490482  p_vci_target.register_nb_transport_fw(this, &my_target::vci_cmd_received);
    491483
     
    493485}
    494486
    495 tmpl(/**/)::~my_target(){}
    496 
    497 /////////////////////////////////////////////////////////////////////////////////////
    498 // Virtual Fuctions  tlm::tlm_fw_transport_if VCI SOCKET
    499 /////////////////////////////////////////////////////////////////////////////////////
    500 
    501 //nb_transport_fw implementation calls from initiators
    502 tmpl(tlm::tlm_sync_enum)::vci_cmd_received                              //
    503                          ( soclib_vci_types::tlm_payload_type &payload, // VCI payload pointer
    504                            soclib_vci_types::tlm_phase_type   &phase,   // transaction phase
     487//////////////////////
     488// Interface function
     489//////////////////////
     490tlm::tlm_sync_enum my_target::vci_cmd_received           
     491                         ( soclib_vci_types::tlm_payload_type &payload, // payload
     492                           soclib_vci_types::tlm_phase_type   &phase,   //  phase
    505493                           sc_core::sc_time                   &time)    // time
    506494{
     
    512500  case soclib::tlmt::VCI_STORE_COND_COMMAND:
    513501      {
    514 #if MY_TARGET_DEBUG
    515         std::cout << "[RAM " << m_targetid << "] Receive from source " << payload.get_src_id() <<" a packet "<< payload.get_pkt_id() << " Time = "  << time.value() << std::endl;
    516 #endif
    517 
    518         payload.set_response_status(soclib::tlmt::TLMT_OK_RESPONSE);
     502
     503        payload.set_response_status(soclib::tlm::TLM_OK_RESPONSE);
    519504        phase = soclib::tlmt::TLMT_RSP;
    520505        time = time + (nwords * UNIT_TIME);