Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a process sensitive to clock and reset signals.
VHDL
process([1]) begin if reset = '1' then output <= '0'; elsif rising_edge(clock) then output <= input_signal; end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out reset from the sensitivity list causes the process not to respond to reset changes.
Including signals unrelated to the process sensitivity.
✗ Incorrect
The process must be sensitive to both clock and reset signals to avoid unintended latches.
2fill in blank
mediumComplete the code to assign a default value to avoid latch inference.
VHDL
process(clock) begin if rising_edge(clock) then output_signal <= [1]; end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Not assigning a value within the rising_edge block causes latch inference.
Using high impedance 'Z' as default in synchronous logic.
✗ Incorrect
Assigning a default value like '0' ensures the signal is always driven, preventing latch inference.
3fill in blank
hardFix the error in the process to avoid unintended latch inference by completing the missing assignment.
VHDL
process(clock) begin if rising_edge(clock) then if enable = '1' then output_signal <= input_signal; else [1]; end if; end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the else branch empty causes latch inference.
Assigning a constant value may not preserve the intended behavior.
✗ Incorrect
Assigning output_signal to itself in the else branch prevents latch inference by ensuring it is always assigned.
4fill in blank
hardFill both blanks to complete the combinational process without causing latch inference.
VHDL
process(a, b) begin if a = '1' then y <= [1]; else y <= [2]; end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving one branch without assignment causes latch inference.
Using 'Z' in combinational logic can cause unexpected behavior.
✗ Incorrect
Assigning '1' and '0' in all branches ensures y is always assigned, avoiding latch inference.
5fill in blank
hardFill all three blanks to complete the process that avoids unintended latch inference by proper default assignment and sensitivity list.
VHDL
process([1]) begin if reset = '1' then output <= '0'; elsif rising_edge([2]) then if enable = '1' then output <= input_signal; else output <= [3]; end if; end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting reset from sensitivity list.
Using wrong signal in rising_edge.
Not assigning output in else branch.
✗ Incorrect
The sensitivity list must include reset; rising_edge uses clock; default assignment in else is '0' to avoid latches.
