caki Posted February 13 Report Posted February 13 Hi, I'm trying to write an abstract module and create concrete modules to apply polymorphism. I created a MWE to reproduce the error: #include <systemc> using namespace sc_core; class AbstractModule : public sc_module { public: sc_in<double> input; sc_out<double> output; SC_HAS_PROCESS(AbstractModule); AbstractModule(const sc_module_name &name) : sc_module(name) {} }; class Module1 : public AbstractModule { public: SC_HAS_PROCESS(Module1); Module1(const sc_module_name &name) : AbstractModule(name) { } }; class Module2 : public AbstractModule { public: SC_HAS_PROCESS(Module2); Module2(const sc_module_name &name) : AbstractModule(name) { } }; int sc_main(int argc, char *argv[]) { Module1 m1("Module1"); Module2 m2("Module2"); AbstractModule *am1 = &m1, *am2 = &m2; sc_start(); return 0; } And when I run this code, I get the error below: Error: (E109) complete binding failed: port not bound: port 'Module2.port_1' (sc_out) In file: ../../../src/sysc/communication/sc_port.cpp:235 What am I doing wrong? Quote
Eyck Posted February 14 Report Posted February 14 Both modules m1 and m2 in sc_main have signal ports. These ports have to be connected to signals in sc_main. Quote
caki Posted February 15 Author Report Posted February 15 17 hours ago, Eyck said: Both modules m1 and m2 in sc_main have signal ports. These ports have to be connected to signals in sc_main. Thank you. I've been binding the ports(not in the code above) but I was getting the error. Your reply made me see my error, I was trying to bind the ports of m2 after the simulation has been started. Binding all before the simulation start solved my problem. Quote
Recommended Posts
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.