DescriptionQ368
Q368DesignASIC interview problem
Deduplicate a sorted register bank
TechniquesDeduplicationActive prefixCount width
DifficultyMedium
TopicRTL Datapaths
LanguageSystemVerilog
Requirements5 checkpoints
01
Problem
Given a sorted active prefix of a bounded tag array, emit one copy of each adjacent run, report the unique count, and zero the unused output suffix.
Example input and output
Use this case to check your interpretationInput
in_count=6; sorted active prefix=[1,1,2,2,2,5]Output
N=8; unique_count=3; output=[1,2,5,0,0,0,0,0]Explanation
One value is retained from each adjacent run and the unused bounded suffix is deterministically zeroed.
02
Requirements (5)
- Support an active count from zero through N, including both endpoints.
- Read only entries below in_count and preserve sorted order.
- Keep exactly one copy of each repeated run.
- Accept start only when start_ready is high; reject in_count greater than N with count_error.
- Pulse done when the replacement prefix or invalid-count result is ready.
