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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×