ehsanullah

Error:<E109> complete binding failed: port not bound:

9 posts in this topic

Hi everybody..

Well i am new with systemC and working for the first time on it...

I have tried to implement a basic D Flip Flop circuit. The aim is to connect two D-Flip Flop in series to form a Johnson counter. (But right now i am trying to test only 1 flip flop)

The code is as follows:

SC_MODULE(dff){

sc_in_clk clk;

sc_in<bool>d;

sc_out<bool> q;

void dff::pro_dff()

{q=d;}

SC_CTOR(dff){

SC_METHOD(pro_dff);

sensitive<<clk.pos();}

};

SC_MODULE(my_mod){

sc_in_clk clk;

sc_in<bool>a;

sc_out<bool>b;

dff *d1;

void do_pro()

{

while (true)

{

d1->d(a);

d1->q(B);

wait();

}

}

SC_CTOR(my_mod){

d1 = new dff("My_dff");

d1->clk(clk);

SC_THREAD(do_pro);

sensitive<<clk.pos();

}

};

But when i run this program in sc_main it gives port binding error. what is wrong with the port binding?... and also please tell me that is the correct port binding method in systemC. I am using systemc v 2.1.

The error message is as follows..

Error:<E109> complete binding failed: port not bound: port 'TEST_UNIT.My_dff.port_2' <sc_out>

In file: ....\systemc-2.1.v1\src\sysc\communication\sc_port.cpp196

Please help me to resolve this problem..

thanks in Advance.

Share this post


Link to post
Share on other sites

Hi,

your code's confusing.

You seem to be mixing up port binding and assigning to channels. You don't need the module "my_mod" at all, as far as I can see.

Also I can't see how you're generating any stimulus.

Finally, you haven't shown sc_main.

But the error message is saying

SC_MODULE(my_mod){
sc_in_clk clk;
sc_in<bool>d;
[color=#ee82ee]sc_out<bool> q;[/color]

port q is not bound.

You might want to look at our website tutorial, http://www.doulos.com/knowhow/systemc/tutorial/, for a basic introduction.

Also I would recommend using SystemC 2.3.0 if you've got a choice,

regards

Alan

ehsanullah likes this

Share this post


Link to post
Share on other sites

Hi , I am also getting the same error. Can Any one tell where I am going wrong and how to fix it.

This program is doing convolution.

convo.h

#pragma once
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include "systemc.h"
SC_MODULE(convo)
{
    sc_in<sc_uint<4> > x[4],h[4];
    sc_out<sc_uint<4> > y[8];

    int i, j, k;
    void prc_convo()
    {

        for (i = 0;i<7;i++)
        {
            y = 0;
            for (j = 0;j <= i;j++)
            {
                y.write(y.read() + (x[j].read() * h[i - j].read()));
            }
        }

        for (i = 0;i<7 - 1;i++)
            cout<<"\n The Value of output y["<<i<<"] "<< y;
    }

    SC_CTOR(convo)
    {    
        SC_METHOD(prc_convo);
        for (k= 0;k < 4;k++)
        {
            sensitive << x[k] << h[k];
        }            
    }

};

 

------------------------------------------------------------------------------------------------------------------

convo_driver.h

SC_MODULE(driver)
{
    sc_out<sc_uint<4>> d_x[4],d_h[4];

    sc_uint<4> pattern =0;

    int i,j;

    void prc_driver()
    {
        for (j = 0;j < 4;j++)
        {
            d_x[j].write(pattern);
            d_h[j].write(pattern);
            pattern++;
            wait(10, SC_MS);
        }
    }

    SC_CTOR(driver)
    {
        SC_THREAD(prc_driver);
        for (i = 0;i < 4;i++)
        {
            sensitive << d_x << d_h;
        }
    }
};
---------------------------------------------------------------------------------------------------------

convo_monitor.h

SC_MODULE(monitor)
{
    sc_in<sc_uint<4>> m_x[4], m_h[4], m_y[4];
    int i,j;

    void prc_monitor()
    {
        cout << "At time " << sc_time_stamp() << " :: \n";
        for (j = 0;j < 4;j++)
        {
            cout << "x[" << j << "] =" << m_x[j];
            cout << "h[" << j << "] =" << m_h[j];
            cout << "y[" << j << "] =" << m_y[j];
        }
    }

    SC_CTOR(monitor)
    {    
        SC_METHOD(prc_monitor);
        for (i = 0;i < 4;i++)
        {
            sensitive << m_x << m_h;
        }
    }
};
----------------------------------------------------------------------------------------

convo.cpp

int sc_main(int argc, char* argv[])
{
    sc_signal<sc_uint<4>> t_x[4], t_h[4], t_y[4];
    int i;
    convo cv("Convolution");
    for (i = 0;i < 4;i++)
    {
        cv.x(t_x);
        cv.h(t_h);
        cv.y(t_y);
    }
    
    driver dv("Driver");
    for (i = 0;i < 4;i++)
    {
        dv.d_x(t_x);
        dv.d_h(t_h);
    }

    monitor mt("Monitor");
    for (i = 0;i < 4;i++)
    {
        mt.m_x(t_x);
        mt.m_h(t_h);
        mt.m_y(t_y);
    }

    sc_start(400, SC_MS);
    _getch();
    return (0);

}

 

 

Share this post


Link to post
Share on other sites

hi gavanvari,

   

since iam very new to systemC .. i might not be able to point exact error, but it seems that u have not added any header in your .cpp file. 

 

regards meera

Share this post


Link to post
Share on other sites

Hi,

the reason for the error is that you're not binding all your ports. You bind the ports in this loop:

 

       for(int i=0;i<n;i++)
        {
            for (int j=0;j<=i;j++)
            {
                    std::cout << i << " " << j << " " << std::endl;
                test_CHOL0->chol_in_data[i][j](chol_in_data[i][j]);
                test_CHOL0->chol_out_data[i][j](chol_out_data[i][j]);
            }
        }

but in the second loop you have j <= i. I've added printing and you can see that you only bind 6 of the 9 ports

 

        SystemC 2.3.1-Accellera --- Sep  3 2016 13:00:03
        Copyright (c) 1996-2014 by all Contributors,
        ALL RIGHTS RESERVED
0 0 
1 0 
1 1 
2 0 
2 1 
2 2 

I think you need j < n

 

regards

Alan

maehne likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now