std_logic has a resolution function
Not only does std_logic have more useful states besides 1 and 0, it also has a resolution function defined.
A resolution function is a VHDL language concept. It is a function that is associated to a type, and it determines what happens when multiple values of that type are applied to a single signal. The syntax is:
SUBTYPE std_logic IS resolved std_ulogic;
where std_ulogic is the unresolved (and thus much less useful) version of std_logic.
In particular, this implies nice things like 0 and 1 leads to X:
library ieee;
use ieee.std_logic_1164.all;
entity std_logic_tb is
end std_logic_tb;
architecture behav of std_logic_tb is
signal s0 : std_logic;
begin
s0 <= '0';
s0 <= '1';
process
begin
wait for 1 ns;
assert s0 = 'X';
wait;
end process;
end behav;
This makes intuitive sense, as we understand X to be the state where multiple incompatible values are applied to a single wire.
std_logic also knows how to resolve every other possible pair of input signals according to a table present on the LRM.
bit on the other hand, does not have a resolution function, and if we had used it on the above example, it would lead to a simulation error on GHDL 0.34.
The possible values of std_logic are a good choice because they are standardized by IEEE 1164 and deal with many common use cases.
Related: https://stackoverflow.com/questions/12504884/what-is-the-purpose-of-the-std-logic-enumerated-type-in-vhdl
Xfor finding multiple drivers.std_logicis indeed the industry standard type for VHDL, but it is also on of the most misused feature of VHDL.std_logicis a resolved signal, which mean that a function is used to resolve the value of the signal in case of multiple drivers. But in the vast majority of cases multiple drivers is an error. By using an unresolved type such asstd_ulogicthis would be marked by the compiler as an error. – trondd Dec 20 '12 at 19:16std_ulogic. But keep in mind many cores will be written withstd_logicso you will likely see some of it. – Brian Carlton Dec 20 '12 at 19:29std_logicis indeed the most common type around; I'm just arguing that it's use is not according to the original intention: Modeling of multi-state signals. For internal designs we usually only consider1or0and a single driver. See http://electronics.stackexchange.com/questions/17524/std-logic-or-std-ulogic?rq=1 for a thorough discussion on the topic. – trondd Dec 24 '12 at 07:33