Jump to content
VanTeo

Error: (E100) port specified outside of module

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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);
}

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...