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

Debug 2-Bit Adder/Subtractor

HardLogic CircuitDebug

A programmable adder/subtractor is the core arithmetic unit in any basic ALU.

Expected behavior:

The circuit computes a 2-bit addition (Sum = A + B) when Mode = 0 and a 2-bit two's complement subtraction (Sum = A - B) when Mode = 1.

Simulation shows that all addition operations pass, but subtraction operations produce results that are exactly one less than expected. For example, testing A = 2 (A1=1, A0=0), B = 1 (B1=0, B0=1), and Mode = 1 yields output S1=0, S0=0 instead of the correct S1=0, S0=1. Inspect the circuit and correct the fault.

Constraints

  • Do not replace the existing full adder components.
  • Modify only the incorrect routing to restore full functionality.

Topics

arithmetictwos-complementdebuggingmultiplexers

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