Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ1040
Q1040DVASIC interview problem

Constrain exactly three nonoverlapping 110 patterns

TechniquesSystemVerilogPattern constraintsExact count
DifficultyHard
TopicConstraints
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

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

Starting declarationSystemVerilog
rand bit [31:0] value;
rand int unsigned pos[3];

Example input and output

Use this case to check your interpretation
Input
selected starts = {0, 3, 6}; value = 32'h0000_01B6
Output
legal: value[0 +: 3], value[3 +: 3], and value[6 +: 3] are the only 3'b110 windows
Explanation

The low nine bits are three adjacent 110 groups. Windows starting between those groups differ from 110, and the remaining upper bits are zero.

02

Requirements (4)

  • 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.