Search the Community
Showing results for tags 'sc_object'.
-
let's assume there are two classes , A and B and in sc_main i am creating the object of A "only" and in class B i am using sc_find_object(hierarchical name of A) then the result from sc_find_object is sc_object type but class A is sc_module so, i typecast-ed into sc_module but still i am not able to call the Api's of class A inside class B. below code is just psedo code . sorry if there is any mistake . it is just for explaining the scenario. sc_main { A obj=new A("objectA"); } class A: sc_core:: sc_module { public: void fun() { cout<<"Hello world"; } }; class B { public: void function() { sc_core::sc_object* obj = sc_core::sc_find_object("objectA"); sc_core::sc_module* ObjNew ObjNew = dynamic_cast<sc_core::sc_module*> (obj); ObjNew->fun() - i.e fun exist in class B . but it is showing error } }; please help
-
Hello All, I wrote a class as follows: # ifndef ALLESGUTE_H_ # define ALLESGUTE_H_ # include <cstdint> # include <systemc> template < typename T > class allesGute final : public sc_core::sc_object { private : T vData ; T someOtherVData ; public : explicit allesGute(const char* name_) : sc_core::sc_object { name_ } , vData { 0 } {} const char* kind() const override { return "allesGute" ; } // Helpers : T read() const { return vData ; } void write(const T& var_) { vData = var_ ; } ~allesGute() final = default ; allesGute(const allesGute& other) = delete ; allesGute& operator=(const allesGute& other) = delete ; allesGute(allesGute&& other) = delete ; allesGute&& operator=(allesGute&& other) = delete ; }; # endif How shall I register vData with tracing system ? Thanks in advance, Regards, Sumit
-
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 ??