As Andy said, it would give you a 16-bit unsigned integer.
You can represent anything <= 31 bits in VHDL by using a suitable
integer SUBTYPE. 32 bits is somewhat doubtful, because the
VHDL language standard does not require implementations to
handle the most negative twos complement value -(2**31)
(usually represented as 16#8000_0000#). And anything wider
than 32 bits is unlikely to work with integer subtypes.
So, here are the tradeoffs that I perceive between using
integer subtypes vs. UNSIGNED/SIGNED vectors from numeric_std:
Benefits of vector types
~~~~~~~~~~~~~~~~~~~~~~~~
* Any reasonable bit width is OK - not limited to 31/32 bits,
and (in particular) 32-bit unsigned is easy and reliable
* Trivially easy conversion to/from std_logic_vector
* Trivially easy bit-picking, slicing, logic (AND/OR) operations
* Fuss-free wraparound modulo 2**N (e.g. 8-bit counter contains
255, increment it, 255+1=0 just like real hardware)
* Unknown, uninitialized and tri-state values can be handled
Benefits of integer subtypes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Faster simulation (even in simulators that have accelerated
implementations of numeric_std)
* Trivially easy arithmetic between signed and unsigned values
* Run-time detection of integer overflow in simulation
* Trivially easy to capture the carry output from +/-
* You can assign numeric constants to them directly
Significant drawbacks of vector types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Can't directly assign numeric values to them
* Unsigned vs. signed arithmetic is tricky
* Capturing carry/overflow bits from an arithmetic
operation requires some care
Significant drawbacks of integer subtypes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Anything >=32 bits is unreliable and/or broken
* Messy conversion to/from std_logic_vector (though you
can easily sugar-coat it with custom functions)
* Modelling modulo-2**N wraparound behaviour is tricky
* Bitwise masking and logic is hopelessly messy
My personal preference has been strongly in favour of
the numeric_std vector types for many years now, primarily
because of the problem with representing unsigned 32-bit
integers using the integer types in VHDL. Others
have taken the opposite stance. Make up your own mind -
but please do it on the basis of reasoned evaluation
rather than guesswork. I make heavy use of integer
types in VHDL when it serves my purposes, especially
in testbench code.
I'd be delighted if anyone else could add to this
pro/con checklist.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)://
www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.