Hello,
I tried to write a wrapper for a simple_initiator_socket.
Therefore I derived from simple_initiator_socket.
#ifndef SRC_MODELS_INC_INITIATORSOCKETWRAPPER_HPP_
#define SRC_MODELS_INC_INITIATORSOCKETWRAPPER_HPP_
#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"
#include "SpdSyscLog.h"
#include "addressSpace.hpp"
using namespace sc_core;
template<typename MODULE, unsigned int BUSWIDTH>
class initiatorSocketWrapper: public tlm_utils::simple_initiator_socket<MODULE, BUSWIDTH>, public SpdSyscLog
{
private:
bool initiate(tlm::tlm_command direction, uint16_t length, uint16_t addr, uint8_t* data) {
sc_time delay(SC_ZERO_TIME);
tlm::tlm_generic_payload trans;
trans.set_command(direction);
trans.set_data_length(length);
trans.set_byte_enable_ptr(0);
trans.set_streaming_width(trans.get_data_length()); // Streaming unused
trans.set_address(addr);
trans.set_data_ptr(data);
trans.set_dmi_allowed(false);
trans.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
this->b_transport(trans, delay);
if (trans.is_response_error())
{
LOG_ERROR("response: {}", trans.get_response_string().c_str());
return false;
}
return true;
}
public:
initiatorSocketWrapper(const char* name) : tlm_utils::simple_initiator_socket<MODULE, BUSWIDTH>(name), SpdSyscLog(this->name()) {
}
bool write(int16_t length, uint16_t addr, uint16_t* data) {
return initiate(tlm::TLM_WRITE_COMMAND, length, addr, reinterpret_cast<uint8_t*> (data));
}
bool write(int16_t length, uint16_t addr, uint8_t* data) {
return initiate(tlm::TLM_WRITE_COMMAND, length, addr, data);
}
bool read(int16_t length, uint16_t addr, uint16_t* data) {
return initiate(tlm::TLM_READ_COMMAND, length, addr, reinterpret_cast<uint8_t*> (data));
}
bool read(int16_t length, uint16_t addr, uint8_t* data) {
return initiate(tlm::TLM_READ_COMMAND, length, addr, data);
}
};
#endif /* SRC_MODELS_INC_INITIATORSOCKETWRAPPER_HPP_ */
But now, I'm not able to call b_transport inside a method of this new class. The following error is shown:
b_transport is not a member of initiatorSocketWrapper<..>::base_type {aka tlm_utils::simple_initiator_socket<..>}
Any hint is highly appreciated.
Many thanks in advance and kind regards.