VHDL generics question - an error occurs

Status
Not open for further replies.

dohzer

Member level 1
Joined
Oct 25, 2008
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,636
vhdl generics

I'm declaring the following interface and getting the following error:

Code:
entity entity_a is
	generic 
	(
		SIG_A_WIDTH 		: integer := 16;
		SIG_B_WIDTH 		: integer := 2;
		SIG_C_WIDTH		: integer := SIG_WIDTH_A - SIG_WIDTH_B;
	);

	port 
	(
		...
		blah
		...
	);
end entity_a;

Code:
Object 'sig_a_width' cannot be used within the same interface as it is declared

I want to be able to define "SIG_C_WIDTH" as a function of the other two widths, so is there an easier and/or more correct way to do it? Should I be declaring it in a separate package or somewhere else in the code?
 

VHDL generics question

Yes, a package is the only option, it can be also placed in the same file as the entity
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…