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

Two's Complement Inverter

EasyLogic CircuitBuild

ALUs and DSP pipelines frequently need to negate signed integer values on the fly. The standard method for negating a binary number in hardware is taking its two's complement.

The circuit receives a 4-bit input A and must produce a 4-bit output Y representing the negative value of A. The two's complement operation consists of a bitwise inversion followed by an addition of one.

| A[3:0] | Y[3:0] | |----------|----------| | 0000 | 0000 | | 0001 | 1111 | | 0111 | 1001 | | 1000 | 1000 |

Constraints

  • Use exactly one 4-bit adder.
  • Do not instantiate a second adder or incrementer block.
  • Drive the carry-in port of the adder to perform the plus-one operation.

Topics

ArithmeticALUTwo's 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.

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

  • Half Adder Using Only XOR and ANDEasy
  • Floating Point Exception FlagsMedium
  • 1-Bit ALU SliceMedium
  • 4-bit Carry Lookahead BlockHard
  • BCD Adder Correction BlockMedium
  • IEEE 754 Mantissa Alignment ShifterHard
  • Four-Bit Bus AdderEasy
  • Debugging Twos Complement OverflowMedium

Browse all problems · Learning tracks