Jump to content
Ronex

Retrieve a pointer to an interface of a port

Recommended Posts

I am trying to get an interface binded with a vector of port declared as sc_vector<sc_in<bool> > :

 

std::vector<sc_object*> children = get_child_objects();
sc_signal<bool> *s = NULL;
const char *tmp = "sc_vector";

 

for (unsigned i = 0; i < children.size(); i++) {

        if (strcmp(nm, children->basename()) == 0) {

               if (strcmp(children->kind(), tmp) == 0) {

                    sc_vector<sc_in<bool> > *v = dynamic_cast<sc_vector<sc_in<bool> > * > (children);
                    if (v != 0) {
                         s = dynamic_cast<sc_signal<bool> *> (&v->at(0));
                    }

               }

        }

}

 

In the above code, I got the value of s as NULL. I have binded a port with signal, but still it's unexpected behavior.

 

Am I doing something wrong here ??

 

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

×