CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Arithmetic

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.

Sign in to solveSee what Pro unlocks

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.

Related problems

  • Half Adder Using Only XOR and ANDEasy
  • Floating Point Exception FlagsMedium
  • 1-Bit ALU SliceMedium
  • 4-bit Carry Lookahead BlockHard
  • BCD Adder Correction BlockMedium
  • IEEE 754 Mantissa Alignment ShifterHard
  • Four-Bit Bus AdderEasy
  • Debugging Twos Complement OverflowMedium

Browse all problems · Learning tracks