0
0
VHDLprogramming~5 mins

Selected assignment (with-select) in VHDL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a selected assignment in VHDL?
A selected assignment in VHDL is a way to assign values to a signal based on the value of another signal, using the with-select statement. It is like a switch-case for signals.
Click to reveal answer
beginner
Write the syntax structure of a selected assignment using with-select.
The syntax is:<br>
with <expression> select<br>  <target_signal> <assignment_operator> <value_1> when <choice_1>, <br>  <value_2> when <choice_2>, <br>  ...<br>  <default_value> when others;
Click to reveal answer
beginner
What happens if none of the choices in a selected assignment match the expression value?
The value assigned is the one specified by the when others clause, which acts as a default case to cover all unmatched values.
Click to reveal answer
intermediate
Can a selected assignment be used for signals of any type?
No, the expression used in with-select must be of a discrete type like enumeration, integer, or std_logic, and the choices must cover all possible values or use when others.
Click to reveal answer
beginner
Example: What is the output of this code?<br>
with sel select<br>  out_sig <= '1' when '1',<br>             '0' when others;
<br>If sel = '0'?
The output out_sig will be '0' because sel is '0' and the when others clause covers all values except '1'.
Click to reveal answer
What keyword is used in VHDL for selected assignment?
Aif-else
Bcase-when
Cwith-select
Dloop
In a selected assignment, what does when others mean?
AIt is the default case for unmatched values
BIt repeats the last value
CIt causes an error
DIt assigns a null value
Which of these is NOT valid in a selected assignment expression?
AInteger
BReal number
CEnumeration
Dstd_logic_vector
What happens if you omit when others and not all values are covered?
ASignal keeps previous value
BDefault value assigned
CSimulation runs but output is undefined
DCompilation error
Which signal type is commonly used with selected assignment?
AAll of the above
BBoolean
Cstd_logic
DInteger
Explain how a selected assignment with with-select works in VHDL.
Think of it like choosing an output based on a signal's value.
You got /4 concepts.
    Describe the importance of the when others clause in selected assignments.
    What happens if the expression value is not listed explicitly?
    You got /3 concepts.