CollapseReqResIntoTransaction

Collapse REQ and RES into one Transaction structure

Both OSCI TLM versions 1 and 2 uses a pair of structs. From master to slave a tlm_request is used. The other way around use tlm_response. How does it compare to the GreenBus idea of using only one struct Transaction?

We did an experiment implementing tlm_transaction struct. There are only few differences from this struct to the existing tlm_request struct:

  1. //added data member
  2. tlm_status m_status;
  3.  
  4. //added member functions
  5. inline DATA& get_data(const unsigned int index = 0);
  6. inline DATA * get_data_ptr();
  7. inline const tlm_status& get_status() const;
  8. inline tlm_status& get_status();
  9. inline void set_status(const tlm_status& status);

Then an interface transact was added to use a transaction instead of transport() that uses request+response:

  1. template < typename TRANSACTION >
  2. class tlm_transact_if : public virtual sc_interface
  3. {
  4. public:
  5.   virtual void transact( TRANSACTION &transaction ) = 0;
  6.  
  7. };

And the pv_example from the TLM kit was changed to use this interface. Examples of changes:

  1. -  public tlm::tlm_initiator_port<tlm::tlm_transport_if<tlm::tlm_request<ADDRESS,DATA>, tlm::tlm_response<DATA> >, N>,
  2. +  public tlm::tlm_initiator_port<tlm::tlm_transact_if<tlm::tlm_transaction<ADDRESS,DATA> >, N>,
  3.  
  4. -  void do_transport(request_type& request,
  5. -      response_type& response,
  6. -      unsigned int target_port_rank = 0);
  7. +  void do_transact(transaction_type& transaction,
  8. +     unsigned int target_port_rank = 0);
  9.  
  10. -  (*this)[target_port_rank]->transport(request,response);
  11. +  (*this)[target_port_rank]->transact(transaction);

The example was looped 500000 times, and the runtime without optimization when running ./pv_example >/dev/null is about the same (30 sec) for both separate and unified structs. With GCC optimization -O3, the results (user time) are:

REQ+RES

user 0m21.905s

user 0m20.769s

user 0m21.189s

user 0m20.709s

user 0m22.033s (after change desktops to copy the 4 initial results to here)

TRANSACTION

user 0m20.921s

user 0m20.613s

user 0m20.645s

user 0m20.533s

user 0m20.729s (after change desktops to copy the 4 initial results to here)