Codiode

4-Bit 2's Complement Adder/Subtractor

HardLogic CircuitBuild

Arithmetic logic units compute both addition and subtraction using the same datapath to save silicon area. A unified adder/subtractor block conditionally negates one operand and leverages the carry-in bit to complete a two's complement conversion in a single pass.

The circuit computes A + B when mode is 0, and A - B when mode is 1. The operation uses two's complement arithmetic to perform the subtraction.

mode Operation S Cout
0 Add A + B Carry from MSB
1 Subtract A - B Carry from MSB

Constraints

  • Combinational logic only.
  • Use exactly one 4-bit adder structure.
  • Do not instantiate separate dedicated adder and subtractor blocks multiplexed together.
  • Derive the subtraction using two's complement arithmetic on the B input.

Topics

arithmeticalutwos-complement

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.

Part of Combinational Building Blocks

Problem 9 of 42 in the Combinational Building Blocks track.

Related problems

Browse all problems · Digital logic design practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.