Jump to content

sc_port sc_export binding issue


Recommended Posts

Hi

 

I am facing an issue with sc_port sc_export binding.

 

My following example compiles fine

class initiator : public sc_module {
    public:
    sc_port<sc_signal_inout_if<bool> > out;
    initiator(sc_module_name name){}
};

class target : public sc_module {
    public:
    sc_port<sc_signal_in_if<bool> > in;
    target(sc_module_name name){}
};

int sc_main(int, char**){
    initiator init("init");
    target targ("targ");
    sc_signal<bool> sig;
    init.out(sig);
    targ.in(sig);
    sc_start();
    return 0;
}

 

But when I move the channel inside the target, and replace sc_port with sc_export, I have following error

 

 

class initiator : public sc_module {
    public:
    sc_port<sc_signal_inout_if<bool> > out;
    initiator(sc_module_name name){}
};

class target : public sc_module {
    public:
    sc_export<sc_signal_in_if<bool> > in;
    sc_signal<bool> sig;
    target(sc_module_name name){in(sig);}
};

int sc_main(int, char**){
    initiator init("init");
    target targ("targ");
    init.out(targ.in);
    sc_start();
    return 0;
}

 

the error is

error: no match for call to ‘(sc_core::sc_port<sc_core::sc_signal_inout_if<bool>, 1, (sc_core::sc_port_policy)0u>) (sc_core::sc_export<sc_core::sc_signal_in_if<bool> >&)’
 

Can you help me in inderstanding this issue ?

 

Thanks

Rahul

 

 

Link to post
Share on other sites

Hi Roman

 

I want to do port to export binding at top so I wrote init.out(targ.in);

 

Thanks

 

 

Than you have a typo in another place:

 

class target : public sc_module {

    public:

    sc_export<sc_signal_in_if<bool> > in;          ---- > Change to   sc_export<sc_signal_inout_if<bool> > in;  

    sc_signal<bool> sig;

    target(sc_module_name name){in(sig);}

};

 

The problem is that you try to bind port and export with different interfaces

Link to post
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.

Guest
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...