What is the difference between type
and subtype
in VHDL and where should I use them ?
My understanding is that subtype
is just narrowed down version of one of the primary types, such as integer
: subtype small_integer is integer range -128 to 127;
All the operations possible on primary type, are also possible on subtypes
(of course, with certain limitations) . Also, it is better to use subtypes
to prevent errors.
So what is the purpose of the type
?
What is the difference between donwto
and to
for the integers
? (To get the point across, here is an example)
subtype bit_index is integer range 31 downto 0;
subtype bit_index is integer range 0 to 31;
Thanks !
type unconstrained_t is array(natural range <>) of std_logic_vector(1 downto 0);
andsubtype constrained_t is unconstrained_t(5 downto 0);
– Linker