Jump to content

TLM2 extending tlm::tlm_fw_transport_if and tlm::tlm_bw_transport_if to add custome methods to interfaces

Recommended Posts



Is it possible to add another set of function to what is already provided by  tlm::tlm_fw_transport_if and  tlm::tlm_bw_transport_if


Actually I tried to create a new interface like the following (see two additional functions read and write)


class target_interface : public virtual tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types> {
   void write(uint64_t add, uint32_t data){
        cout<<"inside write\n";

    uint32_t read(uint64_t add){
        cout<<"inside read\n";
        return 0x0;

    void print(){
        cout<<"nside print\n";

    bool get_direct_mem_ptr(tlm::tlm_generic_payload& trans,tlm::tlm_dmi&  dmi_data){
        cout<<"[iNITIATOR] get_direct_mem_ptr\n";
        return 0;
    unsigned int transport_dbg(tlm::tlm_generic_payload& r){
        cout<<"[iNITIATOR] transport_dbg\n";
        return 0;
    void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time &t){
        cout<<"[iNITIATOR] b_transport\n";
    tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_core::sc_time& t){
        cout<<"[iNITIATOR] nb_transport_fw\n";
        return tlm::TLM_ACCEPTED;





But when I call read as following,


class ufs_initiator :public sc_module, public initiator_interface {
    public :
    //tlm::tlm_initiator_socket<32,ufs_if<uint32_t> > initiator_port;
    tlm::tlm_initiator_socket<32> initiator_port;
    //initiator_interface initiator_port;
    ufs_initiator(sc_module_name name):sc_module(name),
        cout<<"Component Creation: "<<sc_object::name()<<"\n";
    void run() {
        wait(10, SC_NS);
        tlm::tlm_generic_payload        transaction;
        sc_time                         t = SC_ZERO_TIME;

        //initiator_port.write(0x0, 0XFF);
    tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &,tlm::tlm_phase &,sc_core::sc_time & ){return tlm::TLM_ACCEPTED;};
    void invalidate_direct_mem_ptr(sc_dt::uint64 start_range,sc_dt::uint64 end_range){};

I get the error 

'class tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types>' has no member named 'read'


Did I missed something here ?






Link to comment
Share on other sites

When you declare the initiator socket, it expects to access an implementation of the functions in the tlm_fw_transport_if - there is no read() function in the tlm_transport_fw_if.


If you wanted to follow this approach, you'd have to declare your own sockets.




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...