What is the output value of signal bit_signal after the following VHDL process runs?
signal bit_signal : bit := '0'; begin process begin bit_signal <= '1'; wait for 10 ns; wait; end process;
Remember that bit type can only be '0' or '1'.
The bit_signal is assigned '1' explicitly and bit type only supports '0' and '1'. So after assignment, the value is '1'.
Given the following VHDL snippet, what is the value of std_signal after the process?
signal std_signal : std_logic := 'U'; begin process begin std_signal <= '1'; std_signal <= 'Z'; wait for 10 ns; wait; end process;
Consider the last assignment in the process.
The last assignment to std_signal is 'Z', which means high impedance. So the final value is 'Z'.
Which of the following is the main reason engineers prefer std_logic over bit in VHDL designs?
Think about how real hardware signals behave beyond just 0 and 1.
std_logic can represent multiple states such as unknown ('U'), forcing ('X'), and high impedance ('Z'), which helps in accurate hardware modeling. bit only supports '0' and '1'.
What error will occur when trying to assign a bit signal to a std_logic signal directly in VHDL?
signal b : bit := '1';
signal s : std_logic;
begin
s <= b;Check if these types are compatible without conversion.
bit and std_logic are different types. Direct assignment causes a type mismatch error. You must convert explicitly.
Given the following VHDL code, what is the value of unknown_count after execution?
signal vec : std_logic_vector(3 downto 0) := ('1','U','0','X'); signal unknown_count : integer := 0; begin process(vec) begin unknown_count := 0; for i in vec'range loop if vec(i) = 'U' or vec(i) = 'X' then unknown_count := unknown_count + 1; end if; end loop; end process;
Count how many elements are 'U' or 'X' in the vector.
The vector has 'U' at index 2 and 'X' at index 0 (depending on range direction), so total 2 unknown states.