Recall & Review
beginner
What is a conditional assignment using
when-else in VHDL?It is a way to assign a value to a signal based on a condition. The syntax uses
when to specify the condition and else for the default value.Click to reveal answer
beginner
Write the syntax of a simple conditional assignment using
when-else in VHDL.signal_name <= value1 when condition else value2;This means if
condition is true, assign value1, otherwise assign value2.Click to reveal answer
intermediate
Can you chain multiple conditions using
when-else in VHDL?Yes, you can chain multiple
when-else statements to check several conditions in order. For example:<br>signal_name <= value1 when cond1 else value2 when cond2 else value3;
Click to reveal answer
beginner
What happens if none of the conditions in a
when-else chain are true?The last
else value is assigned as a default. This ensures the signal always gets a value.Click to reveal answer
intermediate
Why use
when-else conditional assignment instead of an if statement in VHDL?Because
when-else is a concurrent statement, it can be used outside processes and is simpler for simple conditional assignments. if statements are sequential and used inside processes.Click to reveal answer
What does the following VHDL code do?<br>
out_signal <= '1' when in_signal = '0' else '0';
✗ Incorrect
The code assigns '1' to out_signal when in_signal equals '0'. Otherwise, it assigns '0'.
Which statement is true about
when-else in VHDL?✗ Incorrect
when-else is a concurrent statement and can be used outside processes.How do you write a conditional assignment with multiple conditions in VHDL?
✗ Incorrect
Multiple conditions can be handled by chaining when-else statements.
What is the default value in a
when-else chain?✗ Incorrect
The last else value acts as the default if no conditions match.
Which of these is a valid conditional assignment in VHDL?
✗ Incorrect
The correct syntax uses <= with when-else for conditional assignment.
Explain how conditional assignment using when-else works in VHDL and give a simple example.
Think about assigning a signal based on a true or false condition.
You got /3 concepts.
Describe how to handle multiple conditions using when-else in VHDL and why the else part is important.
Consider what happens if none of the conditions are true.
You got /3 concepts.