Reputation: 1
I am trying to use TLM2 for a simulation project but for some reason I can't use b_transport the same way I see it used in other projects, here is the code snippet that doesn't build due to this error(error C2039 : 'b_transport' : is not a member of 'tlm_utils::simple_initiator_socket<Initiator,32,tlm::tlm_base_protocol_types>'
)
#include <systemc.h>
#include <tlm_utils/simple_target_socket.h>
#include <tlm_utils/simple_initiator_socket.h>
SC_MODULE(Memory) {
tlm_utils::simple_target_socket<Memory> targetSocket;
SC_CTOR(Memory) {
targetSocket.register_b_transport(this, &BTransportCallback);
}
void BTransportCallback(tlm::tlm_generic_payload& payload, sc_time& delay) {
// ...
}
};
SC_MODULE(Initiator) {
tlm_utils::simple_initiator_socket<Initiator> initiatorSocket;
SC_CTOR(Initiator) {
}
};
SC_MODULE(TopLevel) {
Memory* memory;
Initiator* initiator;
SC_CTOR(TopLevel) {
memory = new Memory("Memory");
initiator = new Initiator("Initiator");
initiator->initiatorSocket.bind(memory->targetSocket);
// this is just an example for build test, obviously this isn't a correct call
tlm::tlm_generic_payload p;
initiator->initiatorSocket.b_transport(p, SC_ZERO);
}
};
I know what this error implies, but I don't understand why the systemc includes with tlm2 doesn't find this method.
I use SystemC 2.3.3 (Includes TLM), and there are no issues at includes, since I can use other systemc things normally.
Please let me know if you encountered something similar or what I might've overlooked(maybe I am using the wrong headers ?).
Upvotes: 0
Views: 285
Reputation: 1
I found the issue. I had to use the arrow (->
) operator, so this is the correct usage
SC_MODULE(TopLevel) {
Memory* memory;
Initiator* initiator;
SC_CTOR(TopLevel) {
memory = new Memory("Memory");
initiator = new Initiator("Initiator");
sc_time delay = SC_ZERO_TIME;
tlm::tlm_generic_payload p;
initiator->initiatorSocket.bind(memory->targetSocket);
initiator->initiatorSocket->b_transport(p, delay);
}
};
Upvotes: 0