Arithmetic Right Shifter
Two's complement arithmetic requires specialized shift operations to maintain negative values. An arithmetic right shift divides a signed integer by two by duplicating the sign bit as it shifts the bus.
Route a 4-bit input A to a 4-bit output Y such that the value is shifted right by one bit position. The most significant bit of A must be duplicated to preserve the sign of the number.
| A | Y | |-----|-----| | 0000 | 0000 | | 0001 | 0000 | | 0010 | 0001 | | 0011 | 0001 | | 0100 | 0010 | | 0101 | 0010 | | 0110 | 0011 | | 0111 | 0011 | | 1000 | 1100 | | 1001 | 1100 | | 1010 | 1101 | | 1011 | 1101 | | 1100 | 1110 | | 1101 | 1110 | | 1110 | 1111 | | 1111 | 1111 |
Constraints
- Combinational logic only.
- Do not use logic gates.
- Implement the shift using only wire routing, splitters, and combiners.
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.