Jump to content

sc_port sc_export binding issue


rahuljn

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...