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:
- //added data member
- tlm_status m_status;
- //added member functions
- inline DATA& get_data(const unsigned int index = 0);
- inline DATA * get_data_ptr();
- inline const tlm_status& get_status() const;
- inline tlm_status& get_status();
- 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:
- template < typename TRANSACTION >
- class tlm_transact_if : public virtual sc_interface
- {
- public:
- virtual void transact( TRANSACTION &transaction ) = 0;
- };
And the pv_example from the TLM kit was changed to use this interface. Examples of changes:
- - public tlm::tlm_initiator_port<tlm::tlm_transport_if<tlm::tlm_request<ADDRESS,DATA>, tlm::tlm_response<DATA> >, N>,
- + public tlm::tlm_initiator_port<tlm::tlm_transact_if<tlm::tlm_transaction<ADDRESS,DATA> >, N>,
- - void do_transport(request_type& request,
- - response_type& response,
- - unsigned int target_port_rank = 0);
- + void do_transact(transaction_type& transaction,
- + unsigned int target_port_rank = 0);
- - (*this)[target_port_rank]->transport(request,response);
- + (*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)
Posted January 8th, 2008 by MarkBurton