Codiode

Bidirectional Barrel Shifter Control

HardLogic CircuitBuild

High-performance ALUs avoid instantiating separate left and right barrel shifters to conserve massive amounts of routing resources and silicon area. A single unidirectional shifter can perform both operations by conditionally reversing the input and output bit orders.

Implement a 4-bit bidirectional logical shifter. The circuit receives a 4-bit data input D, a 2-bit shift amount S, and a 1-bit direction control R. When R is 0, the circuit performs a logical left shift. When R is 1, the circuit performs a logical right shift. The 4-bit result is driven to Y.

R S D Y
0 1 3 6
0 2 3 12
1 1 6 3
1 2 12 3

Constraints

  • Implement a single 4-bit left shift structure.
  • Execute right shifts by reversing the bit order of D before shifting, and reversing the result before driving Y.
  • Use only combinational logic.

Topics

alumultiplexerdatapathrouting

Solve this problem

Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.

This problem is part of Codiode Pro. The statement above is free to read.

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Part of Arithmetic and ALU Design

Problem 19 of 32 in the Arithmetic and ALU Design track.

Related problems

Browse all problems · Digital logic design practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.