Jump to content

Error: (E112) get interface failed: port is not bound: port 'Target1.int_o' (sc_out)


Ming

Recommended Posts

I have a port defined as 'sc_out<sc_int<1> > outa' in module A, a port defined as 'sc_in<sc_int<1> > inb' in module B, then a channel defined as 'sc_signal<sc_int<1> > sig' in sc_main, then in sc_main 'A.outa(sig); B.inb(sig);'.

Then I got an error message attached below.

Error: (E112) get interface failed: port is not bound: port 'Target1.int_o' (sc_out)
In file: ../../../src/sysc/communication/sc_port.cpp:235

Could you please help? Thanks.

Link to comment
Share on other sites

Thanks for your quick response. Related code is attached below. Could you please help take a look?

(I'm building a simple SoC, all codes will be messy, so just list related codes here)

 

module A:

struct uart: sc_module
{
  sc_out<sc_int<1> > int_o;
...

module B:

SC_MODULE(tb) {
        
  sc_out<sc_int<6> > int_o;
  sc_in<sc_int<1> > int_timer_i;
  sc_in<sc_int<1> > int_uart_i;
        
  void gen() {
    int_o.write(((int_timer_i.read()) & 0x1) | ((int_uart_i.read() & 0x1)<<1));
  }   
        
  SC_CTOR(tb) {
    SC_METHOD(gen)
    sensitive << int_timer_i << int_uart_i;                                                                                                                                                                         
    dont_initialize();
  }   
        
};   

sc_main:

int sc_main(int argc, char ** argv) {
   
  sc_signal<sc_int<6> > int_vector;
  sc_signal<sc_int<1> > int_timer;
  sc_signal<sc_int<1> > int_uart;
  sc_signal<sc_int<1> > int_uart_pc;
   
  uart        * target1_uart;  
  tb          * testbench;
  
  target1_uart = new uart       ("Target1");
  testbench    = new tb         ("testbench");
   
  target1_uart->int_o(int_uart);
   
  testbench->int_o(int_vector);
  testbench->int_timer_i(int_timer);
  testbench->int_uart_i(int_uart);                                            

 

Regards,

Ming

Link to comment
Share on other sites

Oh Thanks.

I found my issue. I initialized the sc_out port in the constructor of module A.

 SC_CTOR(uart): int_o("int_o")
  {
    int_o = 0;  
...

After removing that line, the model run successfully.

I notice while we initialize sc_out in SC_CTOR, the sc_out port is actually not bound. So we can't initialize port in constructor.

 

Thanks again. Regards,

Ming

 

Link to comment
Share on other sites

  • 1 year later...

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