Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Isolate the lowest set bit

Hardware interview practice

Isolate the lowest set bit

EasyBit ManipulationSystemVerilog

Return a mask containing only the least-significant 1 bit of x.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
value = 8'b1011_0000
Expected output
8'b0001_0000

value & -value isolates bit 4, the least-significant set bit.

What to cover

Requirements

  1. Return zero when x is zero.
  2. Use two's-complement arithmetic.
asic.fyi · Learn silicon end to end.info@asic.fyi