Many thanks for all those who took time and effor to answer my question .
Be well
EC
"Dave" <
[email protected]> ???
??????:
[email protected]...
Hi all
There is some dilema that allways confuses me.
When I define signals and ports , which declaration is to be used ?
BIT , STD_LOGIC or STD_ULOGIC ???
What is the exact criterion to follow in the first stages of design and
declarations ?
Thanks in advance
EC
Almost everyone uses std_logic and std_ulogic instead of the bit type,
because they are so much more flexible. They allow not only the values
of '1' and '0', but also a host of other values to represent other
states such as a high-impedance state ('Z'), a weak pull-up ('W'),
pull-ups and pull-downs ('H' and 'L'), unknown ('X'), don't care
('-'), and undefined ('U'). So I would definitely say not to use bit.
Most of the time, std_logic is all you need. It is a resolved type,
meaning that if you have multiple drivers of the same net, there is a
function which defines what the overall value of the signal will be.
For instance, if I have a std_logic signal some_sig, and I drive it
with a 'L' pull-down in one process, but drive it with a '1' in
another process, the signal will have the value '1', since the
resolution function dictates that driving a signal overrides the pull-
down, which is exactly the behavior that would happen in real life.
The resolution function provides the complete set of rules for any
combination of drivers.
Sometimes, you may want to guarantee that a signal does not have
multiple drivers on it, and in that case, you might choose to use
std_ulogic. This type is exactly like std_logic in that is has 9
values, but no resolution function, so if there are multiple drivers,
an error will result in both simulation and synthesis.
When you're doing math, it is often most convenient to use the signed
and unsigned types from the ieee.numeric_std library. These are base
on std_logic, and are resolved the same way that std_logic is, but
have the added benefit that mathematical operators are defined for
them. Do not ever use the std_logic_arith, std_logic_signed, or
std_logic_unsigned libraries.
Hope this helps.
Dave