Codiode

Floating Point Exception Flags

MediumLogic CircuitBuild

Floating-point units must flag special numerical cases immediately to prevent processor pipeline stalls or silent data corruption. These exception flags inform the control logic when an arithmetic operation results in infinity, zero, or an invalid number.

The circuit receives a 4-bit exponent E and a 4-bit mantissa M. The output flags must assert under specific conditions derived from standard floating-point behavior:

  • is_zero is 1 when both E and M are strictly zero.
  • is_inf is 1 when E is at its maximum value (all ones) and M is zero.
  • is_nan is 1 when E is at its maximum value and M contains at least one non-zero bit.
E M is_zero is_inf is_nan
0000 0000 1 0 0
0000 0001 0 0 0
1111 0000 0 1 0
1111 0001 0 0 1
1000 0000 0 0 0

Constraints

  • Implement using only combinational logic.
  • Do not use high-level comparison blocks: build the detection logic using primitive logic gates.

Topics

ALUCombinational LogicFloating Point

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 Arithmetic and ALU Design

Problem 30 of 32 in the Arithmetic and ALU Design track.

Related problems

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

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