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

IEEE 754 Leading Zero Counter

HardLogic CircuitBuild

Floating point arithmetic units require normalization of the mantissa after addition or subtraction. Determining the exact left-shift amount to restore the hidden bit is the critical path in a modern FPU.

The circuit takes a 4-bit input A and calculates the number of leading zeros starting from the most significant bit. It outputs a 2-bit count representing the shift amount. It also outputs a 1-bit valid signal that asserts high when the input contains at least one high bit, indicating the count is meaningful. When A is entirely zero, valid must be 0 and count must be 0.

| A | valid | count | |-----|---------|---------| | 0000 | 0 | 00 | | 0001 | 1 | 11 | | 0010 | 1 | 10 | | 0011 | 1 | 10 | | 0100 | 1 | 01 | | 0101 | 1 | 01 | | 0110 | 1 | 01 | | 0111 | 1 | 01 | | 1000 | 1 | 00 | | 1001 | 1 | 00 | | 1010 | 1 | 00 | | 1011 | 1 | 00 | | 1100 | 1 | 00 | | 1101 | 1 | 00 | | 1110 | 1 | 00 | | 1111 | 1 | 00 |

Constraints

  • Use only combinational logic gates.
  • Do not use any sequential elements or clocks.

Topics

CombinationalArithmeticALU

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