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

Four Bit Absolute Value Circuit

MediumLogic CircuitBuild

DSP pipelines constantly calculate magnitudes for signal strength analysis and error metrics. The absolute value function strips the sign from a two's complement number to return its positive magnitude.

The circuit takes a 4-bit two's complement input A and produces a 4-bit unsigned output Y. When A is positive or zero, Y equals A. When A is negative, Y equals the two's complement negation of A.

| A (Decimal) | A (Binary) | Y (Binary) | Y (Decimal) | |---------------|--------------|--------------|---------------| | 0 | 0000 | 0000 | 0 | | 7 | 0111 | 0111 | 7 | | -1 | 1111 | 0001 | 1 | | -8 | 1000 | 1000 | 8 |

Constraints

  • Implement combinational logic only.
  • Do not use clocks or sequential elements.
  • Construct the datapath using XOR gates and a 4-bit adder.
  • Drive the conditional inversion and adder carry-in directly from the sign bit of A.

Topics

arithmetictwos-complementdsp

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