VanTeo Posted August 7, 2016 Report Share Posted August 7, 2016 Hi all, I have a problem with my project Error: (E100) port specified outside of module: port 'RXDi' (sc_port_base) In file: ..\..\src\sysc\communication\sc_port.cpp:231 this is my codes #include "SCI.h" #include "conio.h" int sc_main(int argc,char* argv[]) { SCI SCI_01("SCI_01"); sc_signal<sc_bv<8>> RXDi; SCI_01.RXDi(RXDi); SCI_01.SCI_setting("asynchronous", "external_clock", "7-bit", "parity", "even", "two_stopbit", "1/1", "MSB"); SCI_01.SCI_BitRate(32); //RXDi.write("00000000"); sc_start(); //sc_stop(); getch(); return 0; } #include "SCI_function.h" class SCI: public SCI_func { public: sc_in<sc_bv<8>> RXDi; //sc_out<sc_bv<8>> TXDi; //sc_inout<sc_bv<1>> SCKi; sc_event recei_done; //sc_bv<8> recei_temp; public: SC_CTOR(SCI): RXDi("RXDi"), SCI_func("sci_func") { cout << "in constructor of " << name() << endl; //SCI_setting("asynchronous", "external_clock", "7-bit", "parity", "even", "two_stopbit", "1/1", "MSB"); //SCI_BitRate(32); //SCI_WBuffTrans("11111111"); //SCI_setting("synchronous", "external_clock", "1/4", "LSB", "polarity", "delay_clock"); SC_THREAD(SCI_trans_synchronous); //sensitive << recei_data; SC_METHOD(SCI_recei_synchronous); sensitive << RXDi; } void SCI_trans_synchronous(); void SCI_recei_synchronous(); }; void SCI::SCI_trans_synchronous() { wait(recei_done); cout << "OK!!!!"; } void SCI::SCI_recei_synchronous() { //processing data receive if(reg_SCiSR->read_bit<1>("TBEF") == 1) { reg_SCiTB->write(RXDi.read()); } recei_done.notify(); } the SCI_func class inherit from SCI_reg class, SCI_reg class inherit from sc_module class thanks all, VanTeo Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted August 9, 2016 Report Share Posted August 9, 2016 Hi VanTeo, to me, the following line looks suspicious: SC_CTOR(SCI): RXDi("RXDi"), SCI_func("sci_func") You said, SCI_func inherits from sc_module, but you pass in a string constant to its constructor from the derived SCI class. This will disrupt the SystemC object hierarchy, as the corresponding sc_module_name argument will be destroyed too early. If you want to use the SC_CTOR macro, you should add a protected default constructor to the SCI_func base class, allowing to take the name from the current top of the naming stack. See IEEE 1666-2011, section 5.3.3 for more details about passing sc_module_name arguments through the inheritance hierarchy. Hope that helps, Philipp Quote Link to comment Share on other sites More sharing options...
VanTeo Posted August 10, 2016 Author Report Share Posted August 10, 2016 Sorry Philipp, because I'm a beginer so I understand your mind clearly. When I remove SCI_func("sci_func"), it's error error C2512: 'SCI_func' : no appropriate default constructor available Thanks, VanTeo Quote Link to comment Share on other sites More sharing options...
fyyyf Posted August 11, 2016 Report Share Posted August 11, 2016 you can change SC_CTOR(SCI): RXDi("RXDi"), SCI_func("sci_func") to SC_HAS_PROCESS(SCI) SCI(const sc_module_name nm) : RXDi("RXDi"), SCI_func(nm) Quote Link to comment Share on other sites More sharing options...
VanTeo Posted August 11, 2016 Author Report Share Posted August 11, 2016 Oh thanks Cliffe Fei, I have understand Quote Link to comment Share on other sites More sharing options...
iman Posted October 29, 2019 Report Share Posted October 29, 2019 what is wrong with my code ??? i get this error (E100) port specified outside of module: port 'sca_lsf_out_0' (sc_port_base) #include "systemc.h" #include "systemc-ams.h" SC_MODULE(my_lsf_source) { // port declaration sca_lsf::sca_out y; // child module declaration sca_lsf::sca_source src; SC_CTOR(my_lsf_source) : y("y"), src("src", 0.0, 0.0, 1.0e-3, 1.0e3) // 1 kHz sinusoidal source with an amplitude of 1e-3 { src.set_timestep(0.5, sc_core::SC_MS); // set module timestep of source to 0.5 ms src.y(y); } }; #include "systemc.h" #include "systemc-ams.h" #include "sin.h" // sc_main in top level function like in C++ main int sc_main(int argc, char* argv[]) { sca_lsf::sca_out y; my_lsf_source my_lsf_source("my_lsf_source"); my_lsf_source.y(y); sca_util::sca_trace_file* tf = sca_util::sca_create_tabular_trace_file("trace.dat"); //sca_util::sca_trace(tf, y, "y"); sca_util::sca_write_comment(tf, "user-defined comments"); sca_util::sca_close_tabular_trace_file(tf); return(0); } Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted November 4, 2019 Report Share Posted November 4, 2019 On 10/29/2019 at 6:35 PM, iman said: sca_lsf::sca_out y; As mentioned by the error message, you define a port outside of a module in the line above. Quote Link to comment Share on other sites More sharing options...
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.