0
0
VHDLprogramming~5 mins

Shift operators in VHDL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AShifts bits left and preserves sign bit
BShifts bits right and fills with zeros
CShifts bits right and preserves sign bit
DShifts bits left and fills with zeros
Which operator shifts bits right and keeps the sign bit unchanged?
Asra
Bsrl
Csll
Dsla
If you apply 'srl 3' to the bit vector "11010", what is the result?
A"00001"
B"00011"
C"11000"
D"00010"
Which shift operator would you use to shift left and preserve the sign bit?
Asll
Bsla
Csrl
Dsra
Can you use shift operators directly on integer types in VHDL?
AYes, always
BNo, never
COnly after converting to bit vectors or unsigned/signed types
DOnly with 'sll' operator
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.