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

Overflow Ignored in Accumulator

MediumLogic CircuitDebug

A 16-bit accumulator adder computes the sum of the current accumulator value A and the new operand B. It must assert the Ovf flag when the signed 16-bit addition exceeds the valid two's complement range.

Expected behavior:

The Sum output provides the lower 16 bits of the addition. The Ovf output is 1 if both inputs are positive and the result is negative, or if both inputs are negative and the result is positive. Otherwise, Ovf is 0.

Simulation shows Ovf = 0 for inputs A = 20000 and B = 20000. The output Sum correctly evaluates to 40000 (which represents -25536 in two's complement), but the overflow flag fails to assert. This causes the DSP pipeline to silently drop massive values. Inspect the circuit and correct the fault.

Constraints

  • The circuit must correctly compute the 16-bit sum of A and B.
  • The Ovf flag must be driven high only during a signed overflow condition.
  • Inputs and outputs are represented as 16-bit unsigned integers in the test vectors.

Topics

arithmetictwos-complementoverflowdebugging

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

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks