On Jan 12, 8:13*am, Alan Fitch <
[email protected]> wrote:
> P.S. If you end up requiring a lot of arithmetic operations, then it
> would make sense to declare some of your signals unsigned instead of
> std_logic_vector, as that avoids a lot of type conversions. However if
> this is the only line that requires arithmetic, there's no problem doing
> type conversion as you need it.
Rather than only using unsigned when you need to do arithmetic, I
would think about how the contents of an SLV are interpreted. If they
are interpreted numerically, then use unsigned or signed types as
appropriate. If they are interpreted as a collection of bits, without
a consistent numerical interpretation, then use SLV. For instance, an
address bus would be a good place to use unsigned types. A data bus
might need to be SLV because at different times it may contain signed,
unsigned, or non-numeric quantities. But you can do pretty much
anything with unsigned or signed that you can with SLV.
The only place to be careful about non-SL or non-SLV types is at the
top level entity of your design. The reason is that the post-synthesis
(and/or post-P&R) VHDL will almost certainly use SL & SLV, so using
them in your RTL makes it easier to swap RTL for post-synthesis code
in your testbench.
Andy