Jump to content

Error: (E513) an sc_module_name parameter for your constructor is required


VanTeo

Recommended Posts

Hi all,

I have a problem with my assignment.

I have "General_Register" class, this class has constructor which will receive arguments:

General_Reg(sc_module_name reg_Name_, sc_uint<N> reg_DataDefault_, int reg_BitRangeNum_, string bit_Name_[], int bit_Start_[], int bit_Length_[], int bit_Status_[]):
	  sc_module(reg_Name_), reg_Name(reg_Name_), reg_DataDefault(reg_DataDefault_), reg_BitRangeNum(reg_BitRangeNum_), bit_Name(bit_Name_), bit_Start(bit_Start_), bit_Length(bit_Length_), bit_Status(bit_Status_)

I have "Generator_Register" class, too. This class has constructor which will receive arguments:

Generator_Register(sc_module_name reg_Name_, string file_name_): sc_module(reg_Name_), reg_Name(reg_Name_), file_name(file_name_)

and instance the object of "General_Register" class:

General_Reg<N> reg_Name(reg_Name, reg_Default, bit_RangeNum, bit_Name, bit_Start, bit_Length, bit_Status);

when I run it, it have error:

Error: (E513) an sc_module_name parameter for your constructor is required
In file: ..\..\src\sysc\kernel\sc_module.cpp:220

Help me, please!

My codes were attach below

general_register.txt

generator_register.txt

Link to post
Share on other sites

Hi, I've got a couple of comments.

Firstly, in

template <int N>
class Generator_Register: public sc_module
{
public:
	Generator_Register(sc_module_name reg_Name_, string file_name_): sc_module(reg_Name_), reg_Name(reg_Name_), file_name(file_name_)
	{
//...
		General_Reg<N> reg_Name(reg_Name_, reg_Default, bit_RangeNum, bit_Name, bit_Start, bit_Length, bit_Status);
	}

public:
	int reg_Num;
	int bit_RangeNum;
	sc_module_name reg_Name;
	string *bit_Name;
	int *bit_Start;
	int *bit_Length;
	int *bit_Status;
	sc_bv<N> reg_Default;
	string file_name;
};

the declaration of the variable General_Reg<N> reg_Name is a local variable inside the constructor - so it will disappear when the constructor completes. You should make it a class member if you want it to persist.

 

Secondly from section 5.3.3 of IEEE 1666-2011

 

 

Class sc_module_name shall only be used as the type of a parameter of a constructor of a class derived from
class sc_module.

 

In other words you're not allowed to declare a variable of type sc_module_name, which you've done in both your classes. That's because sc_module_name is "magic", it helps build the hierarchical names of all modules during elaboration.

 

If you need to keep the name inside a class, store it in a string.

 

kind regards

Alan

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...