Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ567
Page ↗
Q567FWASIC interview problem

Isolate the lowest set bit

TechniquesBitsTwo's complement
DifficultyEasy
TopicBit Manipulation
LanguageSystemVerilog
Requirements2 checkpoints
01

Problem

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

Example input and output

Use this case to check your interpretation
Input
value = 8'b1011_0000
Output
8'b0001_0000
Explanation

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

02

Requirements (2)

  • Return zero when x is zero.
  • Use two's-complement arithmetic.