Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ856
Q856DVASIC interview problem

Generate a temporal hazard-safe instruction stream

TechniquesSystemVerilogConstraintsTemporal hazardsDistribution
DifficultyHard
TopicConstraints
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

Randomize an instruction stream whose current instruction obeys dependencies on the previous two instructions, while guaranteeing that at least 20 percent of the complete stream consists of LOAD operations.

Example input and output

Use this case to check your interpretation
Input
randomize N=5 instructions using {ADD,MUL,DIV,LOAD}
Output
One valid result: LOAD r1,r2->r3; ADD r4,r5->r6; DIV r7,r8->r9; MUL r10,r11->r12; LOAD r13,r14->r15
Explanation

Two LOADs exceed the required ceil(5/5)=1. Each destination avoids the prior two instructions' sources, and DIV sources r7/r8 avoid prior destinations r3/r6; many other streams are valid.

02

Requirements (4)

  • For DIV, neither source may equal either of the previous two destination registers.
  • Every new destination must differ from both source registers of each of the previous two instructions.
  • The finite stream must contain at least ceil(N/5) LOADs; probabilistic weighting alone is insufficient.
  • Apply only the history constraints that exist at indices zero and one.