DescriptionQ167
Q167DVDesignASIC interview problem
Prove an elastic one-hot checker
TechniquesDVSVAReady/validGhost modelBit manipulation
DifficultyEasy
TopicTemporal Checks
LanguageSystemVerilog
Requirements5 checkpoints
01
Problem
Write a checker for a one-entry elastic pipeline that classifies a grant mask as one-hot and reports the selected index. Prove function, ordering, stability, and reset behavior under arbitrary backpressure.
Example input and output
Use this case to check your interpretationInput
accept mask=5'b00100 and stall its output; on retirement simultaneously accept replacement mask=5'b00110Output
first output onehot=1,index=2 stays stable; replacement output onehot=0,index=0Explanation
The ghost queue preserves ordering across simultaneous retire-and-replace, and a two-bit mask is classified invalid with deterministic index zero.
02
Requirements (5)
- Treat a mask as one-hot only when it is nonzero and mask AND mask-minus-one is zero, with width-controlled arithmetic.
- Associate each accepted input with the next accepted output, including simultaneous retire-and-replace.
- Return the sole set-bit index for legal masks and zero for zero or multi-hot masks.
- Require out_valid and payload stability while stalled and never allow accepted outputs to exceed accepted inputs since reset.
- Clear the ghost obligation on reset and cover zero, each one-hot bit, multi-hot values, and simultaneous handshakes.
