Hardware interview practice
Constrain exactly three nonoverlapping 110 patterns
Randomize a 32-bit word containing exactly three nonoverlapping 3'b110 windows when every possible three-bit sliding window is counted.
Starting point
Question code
rand bit [31:0] value;
rand int unsigned pos[3];Reviewed example
Work through one case
Input
selected starts = {0, 3, 6}; value = 32'h0000_01B6Expected output
legal: value[0 +: 3], value[3 +: 3], and value[6 +: 3] are the only 3'b110 windowsThe low nine bits are three adjacent 110 groups. Windows starting between those groups differ from 110, and the remaining upper bits are zero.
What to cover
Requirements
- Sort three selected start positions inside 0 through 29.
- Keep selected starts at least three bits apart.
- Force each selected indexed part-select to equal 3'b110.
- Force every unselected three-bit window to differ from 3'b110.
