DescriptionQ156
Q156FWASIC interview problem
Clear the lowest set bit
TechniquesBitsMask
DifficultyEasy
TopicBit Manipulation
LanguageSystemVerilog
Requirements2 checkpoints
01
Problem
Return x with its least-significant 1 bit cleared.
Example input and output
Use this case to check your interpretationInput
value = 8'b1011_0000Output
8'b1010_0000Explanation
ANDing with value - 1 clears only the lowest set bit, which is bit 4 here.
02
Requirements (2)
- Return zero when x is zero.
- Use one arithmetic and one bitwise operation.
