Complete the code to perform a left shift by 2 bits.
assign result = data [1] 2;
The left shift operator in Verilog is <<. It shifts bits to the left.
Complete the code to perform a right shift by 3 bits.
assign shifted = value [1] 3;
The right shift operator in Verilog is >>. It shifts bits to the right.
Fix the error in the code to correctly shift bits left by 1.
assign out = in [1] 1;
The correct operator for left shift is <<. Using >> shifts bits right, which is incorrect here.
Fill both blanks to create a mask that shifts bits right by 4 and then left by 2.
assign masked = (data [1] 4) [2] 2;
The first operator shifts bits right by 4 (>>), then the second shifts bits left by 2 (<<).
Fill all three blanks to shift bits left by 3, then right by 1, and finally left by 2.
assign result = ((val [1] 3) [2] 1) [3] 2;
The code first shifts left by 3 (<<), then right by 1 (>>), and finally left by 2 (<<).
