Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Constrain exactly three nonoverlapping 110 patterns

Hardware interview practice

Constrain exactly three nonoverlapping 110 patterns

HardConstraintsSystemVerilog

Randomize a 32-bit word containing exactly three nonoverlapping 3'b110 windows when every possible three-bit sliding window is counted.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
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_01B6
Expected output
legal: value[0 +: 3], value[3 +: 3], and value[6 +: 3] are the only 3'b110 windows

The 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

  1. Sort three selected start positions inside 0 through 29.
  2. Keep selected starts at least three bits apart.
  3. Force each selected indexed part-select to equal 3'b110.
  4. Force every unselected three-bit window to differ from 3'b110.
asic.fyi · Learn silicon end to end.info@asic.fyi