VHDL types and subtypes

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
In VHDl, Is it possible to do arithmetic operations between a subtype and it's father type ?

For example:
If signals A and C are definded as integers and signal B is defined as a natural.
Is it legal to write:
C <= A + B;
 

Yes you can. A subtype is still of the same type of the base type.

Note, that because the in built functions have no knowledge of subtypes, the returned value (like C in this case) will be the base type. You will have to write your own function for it to return the subtype.
 
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
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…