0
0
VHDLprogramming~10 mins

Shift operators in VHDL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to perform a left shift by 2 bits on the signal data_in.

VHDL
data_out <= data_in [1] 2;
Drag options to blanks, or click blank then click option'
Asrl
Bsll
Crol
Dror
Attempts:
3 left
💡 Hint
Common Mistakes
Using srl which shifts bits to the right.
Using rotate operators rol or ror instead of shift.
2fill in blank
medium

Complete the code to perform a right shift by 3 bits on the signal data_in.

VHDL
data_out <= data_in [1] 3;
Drag options to blanks, or click blank then click option'
Asll
Bror
Crol
Dsrl
Attempts:
3 left
💡 Hint
Common Mistakes
Using sll which shifts bits left.
Using rotate operators rol or ror instead of shift.
3fill in blank
hard

Fix the error in the code to rotate the signal data_in left by 1 bit.

VHDL
data_out <= data_in [1] 1;
Drag options to blanks, or click blank then click option'
Arol
Bsrl
Cror
Dsll
Attempts:
3 left
💡 Hint
Common Mistakes
Using sll which shifts bits but does not wrap.
Using ror which rotates right instead of left.
4fill in blank
hard

Fill both blanks to shift data_in right logically by 4 bits and assign to data_out.

VHDL
data_out <= data_in [1] [2];
Drag options to blanks, or click blank then click option'
Asrl
Bsll
C4
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using sll which shifts left.
Using wrong number of bits like 1.
5fill in blank
hard

Fill both blanks to rotate data_in right by 2 bits and assign to data_out.

VHDL
data_out <= data_in [1] [2];
Drag options to blanks, or click blank then click option'
Asrl
Bror
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using srl which shifts but does not rotate.
Using wrong number of bits like 3.