Write a One-Hot SystemVerilog Constraint Without $onehot

Write a SystemVerilog constraint for an N-bit randomized variable a such that a is one-hot: exactly one bit is 1 and all other bits are 0.

Requirements:

  • Do not use the SystemVerilog b...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: