Recall & Review
beginner
What does the 'sll' operator do in VHDL?
The 'sll' operator shifts bits to the left by a specified number of positions, filling the right with zeros. It stands for 'shift left logical'.
Click to reveal answer
intermediate
Explain the difference between 'srl' and 'sla' in VHDL.
'srl' (shift right logical) shifts bits to the right and fills the left with zeros. 'sla' (shift left arithmetic) shifts bits to the left and preserves the sign bit for signed types.
Click to reveal answer
beginner
What is the result of shifting the binary value "1001" srl 2 in VHDL?
Shifting "1001" srl 2 results in "0010". The bits move right by 2, and zeros fill the left.
Click to reveal answer
intermediate
How does the 'sra' operator behave differently from 'srl'?
'sra' (shift right arithmetic) shifts bits to the right but keeps the leftmost bit (sign bit) unchanged to preserve the number's sign in signed numbers, unlike 'srl' which fills with zeros.
Click to reveal answer
beginner
Can shift operators be used on all VHDL data types?
No, shift operators are mainly used on bit vectors and signed or unsigned types. They do not work on all data types such as reals.
Click to reveal answer
What does the 'sll' operator do in VHDL?
✗ Incorrect
'sll' means shift left logical, which moves bits left and fills the right side with zeros.
Which operator shifts bits right and keeps the sign bit unchanged?
✗ Incorrect
'sra' is shift right arithmetic, which preserves the sign bit for signed numbers.
If you apply 'srl 3' to the bit vector "11010", what is the result?
✗ Incorrect
Shifting "11010" right by 3 with 'srl' moves bits right 3 places and fills left with zeros, resulting in "00001".
Which shift operator would you use to shift left and preserve the sign bit?
✗ Incorrect
'sla' is shift left arithmetic, which shifts left and preserves the sign bit.
Can you use shift operators directly on integer types in VHDL?
✗ Incorrect
Shift operators are defined for bit vectors and unsigned/signed types; for integers, you need to convert them first.
Describe the main shift operators in VHDL and how they differ.
Think about direction and how zeros or sign bits are handled.
You got /6 concepts.
Explain when and why you would use an arithmetic shift instead of a logical shift in VHDL.
Consider how negative numbers are represented in binary.
You got /4 concepts.