Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

VHDL Type duplicate definition in different file, won't connect?

Status
Not open for further replies.

legendbb

Member level 1
Joined
Nov 16, 2013
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,516
Dear Experts,

I have some unique data type used through my project.

In order to make some IP source file independent of the common package.

I redefined TYPEs in local package with the identical text.
Code:
TYPE MY_Array IS ARRAY (0 TO 2) OF STD_LOGIC_VECTOR(3 DOWNTO 0)

Back in integration, receive error from Vivado, expected MY_Array.

I understand, there are two definitions of the "MY_Array", but I just don't want to reference the common package.

What's the right way of doing this, give the fact I have to use my data type.

Thanks,
 

In order to make some IP source file independent of the common package.
This doesn't make any sense and is the root cause of your problem. You create a package so that it can be commonly used.

I redefined TYPEs in local package with the identical text.
Code:
TYPE MY_Array IS ARRAY (0 TO 2) OF STD_LOGIC_VECTOR(3 DOWNTO 0)

Back in integration, receive error from Vivado, expected MY_Array.

I understand, there are two definitions of the "MY_Array", but I just don't want to reference the common package.
I suggest you get over your not wanting to reference the common package. You haven't given any reason for this want.

What's the right way of doing this, give the fact I have to use my data type.
The right way is to define the type once in a package and then use the package, end of story.

Kevin Jennings

Thanks,
 
Thanks for being straight. I understand the rule back from school. But never tested in real design. Now it bites. I will switch back to common package.
 

This comes about because you have used the same name in two packages. A local type declaration will override anything included in packages, unless you specifically ask for the "other" one.
To differentiate and make this error go away, when you include the same type from two different packages, you need to specify which one you mean:

signal a : package1.my_array;
signal b : package2.my_array;

But remember, the are different types, so the following would be illegal:

a <= b;
 
Indeed, VHDL is very type safe.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top