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

Arithmetic versus Logical Shift Right

HardLogic CircuitDebug

A digital audio filter scales incoming 8-bit signed integer samples by dividing them by two. The circuit takes an 8-bit input DataIn and shifts it right by one bit position to compute the 8-bit output DataOut, maintaining the two's complement sign.

Expected behavior:

Positive values halve and remain positive. Negative values halve and remain negative. The most significant bit must replicate to preserve the sign of the original sample.

Simulation shows DataOut = 124 (binary 01111100) for input DataIn = 248 (binary 11111000, representing -8). The output incorrectly becomes positive when a negative sample is processed. Inspect the circuit and correct the fault.

Constraints

  • The circuit must correctly scale both positive and negative two's complement numbers.
  • Do not use explicit division or multiplication components.

Topics

arithmeticshiftdebuglogicalsigned

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

  • Binary to HexEasy
  • 1-to-4 Demultiplexer from AND and NOT GatesEasy
  • 2-to-4 Line Decoder with Active-High EnableEasy
  • Hex Nibble to BinaryEasy
  • Odd Parity Bit Generator for 3-bit DataEasy
  • Full Adder from Half AddersEasy
  • Modulo ArithmeticMedium
  • Two's Complement: Encode a Negative DecimalEasy

Browse all problems · Learning tracks