Search the Community
Showing results for tags 'interfaces'.
-
Hi, i am trying to declare an sc_port from which i want to send a struct (ressource) between two different modules. I declared an interface and a channel to implements the send and receive interface methods but i am experiencing two errors. The first one is C2011 'class ' type redefinition, the second one is C2504 base class undefined. Now the Interface is very simple: //comm_interface.h class comm_send_interface : virtual public sc_interface { public: virtual bool send(ressource) = 0; // send a ressource virtual void reset() = 0; // empty ressource list }; class comm_recv_interface : virtual public sc_interface { public: virtual bool recv(ressource &) = 0; // receive a ressource }; The channel where i implement the methods looks like this: //comm_channel.h #include "comm_interface.h" class comm_channel : public sc_module, public comm_send_interface, public comm_recv_interface { private: ressource rdata[9]; int i; //sc_event send_event, recv_event; public: comm_channel(sc_module_name rc_channel) : sc_module(rc_channel), i(0) {} bool send(ressource r); // write bool recv(ressource & r); // read void reset(); //void register_port(sc_port_base & port_, const char * if_typename_); }; bool comm_channel :: send(ressource r) { if (i < 10) { rdata[i++] = r; //recv_event.notify(); return true; } //wait(send_event); return false; } bool comm_channel :: recv(ressource &r) { if (i > 0) { r = rdata[--i]; return true; //read_event.notify; } return false; } void comm_channel :: reset() { i = 0; } And here i declare the sc_port to send and receive the "ressource". #ifndef ROBOT__H #define ROBOT__H #include "systemc.h" #include "ressource.h" //interface #include "comm_interface.h" struct robot : sc_module { sc_port<comm_recv_interface> rinput; sc_port<comm_send_interface> routput; ressource r; void drill(); void insert(); void tight(); SC_CTOR(robot) { //... }; #endif // ROBOT__H Can you help me with the Problem?! Thanks in advanced!
- 1 reply
-
- systemc
- interfaces
-
(and 1 more)
Tagged with:
-
a usual way to do it is to create a wrapper object and push the wrapper into config_db. Then get this wrapper object from config_db and assign it to the virtual interface pointer (not mentioning the details here) Creating the virtual interface container wrapper parameterized to the strongly typed interface helps here. but in the uvm component, a pointer needs to be created for the parameterised interface. If not wanting the classes to be parameterized, how the virtual interface handle can be created without specifying the parameter as either a default parameter in base class or override is necessary for creating handle?. The component will get the wrapper object from config_db and assign it (the virtual interface in the object) to the virtual interface pointer Thanks.
- 4 replies
-
- uvm
- interfaces
-
(and 1 more)
Tagged with: