9#ifndef _GREENSOCS_GSUTILS_TESTS_INITIATOR_TESTER_H 
   10#define _GREENSOCS_GSUTILS_TESTS_INITIATOR_TESTER_H 
   16#include <tlm_utils/simple_initiator_socket.h> 
   17#include <module_factory_registery.h> 
   18#include <tlm_sockets_buswidth.h> 
   62    using TlmGenericPayload = tlm::tlm_generic_payload;
 
   63    using TlmResponseStatus = tlm::tlm_response_status;
 
   64    using TlmDmi = tlm::tlm_dmi;
 
   69    sc_core::sc_time m_last_txn_delay;
 
   70    unsigned int m_last_transport_debug_ret;
 
   71    bool m_last_dmi_hint = 
false;
 
   73    TlmDmi m_last_dmi_data;
 
   75    InvalidateDirectMemPtrFn m_dmi_inval_cb;
 
   77    void invalidate_direct_mem_ptr(sc_dt::uint64 start, sc_dt::uint64 end)
 
   80            m_dmi_inval_cb(start, end);
 
   93        txn.set_data_ptr(data);
 
   95        txn.set_streaming_width(
len);
 
   96        txn.set_byte_enable_ptr(
nullptr);
 
  101    tlm_utils::simple_initiator_socket<InitiatorTester, DEFAULT_TLM_BUSWIDTH> socket;
 
  103    InitiatorTester(
const sc_core::sc_module_name& 
n): sc_core::sc_module(
n), socket(
"initiator_socket")
 
  105        socket.register_invalidate_direct_mem_ptr(
this, &InitiatorTester::invalidate_direct_mem_ptr);
 
  128        socket->b_transport(
txn, m_last_txn_delay);
 
  129        m_last_dmi_hint = 
txn.is_dmi_allowed();
 
  131        return txn.get_response_status();
 
 
  147        m_last_transport_debug_ret = socket->transport_dbg(
txn);
 
  149        return txn.get_response_status();
 
 
  236        TlmGenericPayload 
txn;
 
 
  255        TlmGenericPayload 
txn;
 
 
  388        TlmGenericPayload 
txn;
 
  390        prepare_txn(
txn, 
true, 
addr, 
nullptr, 0);
 
  391        return socket->get_direct_mem_ptr(
txn, m_last_dmi_data);
 
 
 
A TLM initiator to do testing on a target.
Definition initiator-tester.h:60
 
const TlmDmi & get_last_dmi_data() const
Get the DMI data returned by the last get_direct_mem_ptr call.
Definition initiator-tester.h:399
 
TlmResponseStatus do_transport_dbg(TlmGenericPayload &txn)
Perform a transport_dbg TLM transaction using the txn TLM payload.
Definition initiator-tester.h:145
 
TlmResponseStatus do_read_with_txn_and_ptr(TlmGenericPayload &txn, uint64_t addr, uint8_t *data, size_t len, bool debug=false)
Perform a simple read into the buffer pointed by data with a pre-set payload.
Definition initiator-tester.h:191
 
TlmResponseStatus do_write_with_ptr(uint64_t addr, const uint8_t *data, size_t len, bool debug=false)
Perform a simple write with data pointed by data
Definition initiator-tester.h:253
 
TlmResponseStatus do_transaction(TlmGenericPayload &txn, bool debug=false)
Perform a TLM transaction using the txn TLM payload.
Definition initiator-tester.h:164
 
void register_invalidate_direct_mem_ptr(InvalidateDirectMemPtrFn cb)
Register a callback on invalidate_direct_mem_ptr event.
Definition initiator-tester.h:409
 
bool get_last_dmi_hint() const
Get the DMI hint value of the last transaction (the is_dmi_allowed() flag in the payload)
Definition initiator-tester.h:371
 
bool do_dmi_request(uint64_t addr)
Perform a get_direct_mem_ptr call by specifying an address.
Definition initiator-tester.h:386
 
const sc_core::sc_time & get_last_txn_delay() const
Get the delay value resulting of the last b_transport call.
Definition initiator-tester.h:356
 
TlmResponseStatus do_write(uint64_t addr, const T &data, bool debug=false)
Perform a simple write.
Definition initiator-tester.h:337
 
TlmResponseStatus do_read_with_txn(TlmGenericPayload &txn, uint64_t addr, T &data, bool debug=false)
Perform a simple read with a pre-set payload.
Definition initiator-tester.h:276
 
TlmResponseStatus do_write_with_txn(TlmGenericPayload &txn, uint64_t addr, const T &data, bool debug=false)
Perform a simple write with a pre-set payload.
Definition initiator-tester.h:301
 
unsigned int get_last_transport_debug_ret() const
Get the return value of the last transport_dbg call.
Definition initiator-tester.h:363
 
void set_next_txn_delay(const sc_core::sc_time &delay)
Set the delay value to use for the next b_transport call.
Definition initiator-tester.h:349
 
TlmResponseStatus do_b_transport(TlmGenericPayload &txn)
Perform a b_transport TLM transaction using the txn TLM payload.
Definition initiator-tester.h:126
 
TlmResponseStatus do_read(uint64_t addr, T &data, bool debug=false)
Perform a simple read into data
Definition initiator-tester.h:318
 
TlmResponseStatus do_read_with_ptr(uint64_t addr, uint8_t *data, size_t len, bool debug=false)
Perform a simple read into the buffer pointed by data
Definition initiator-tester.h:234
 
TlmResponseStatus do_write_with_txn_and_ptr(TlmGenericPayload &txn, uint64_t addr, const uint8_t *data, size_t len, bool debug=false)
Perform a simple write with data pointed by data with a pre-set payload.
Definition initiator-tester.h:217