Bidirectional Barrel Shifter Control
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
Dbefore shifting, and reversing the result before drivingY. - Use only combinational logic.
Topics
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.