Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Rand_mode

Hardware interview practice

Rand_mode

MediumConstraintsSystemVerilog

What are ok and x after the call?

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

class C; rand int x; endclass
C c = new; int ok;
initial begin
  c.x = 7;
  c.x.rand_mode(0);
  ok = c.randomize() with { x == 9; };
  $display("%0d %0d", ok, c.x);
end
Choose one

Answer choices

  1. A. 1 9
  2. B. 1 7
  3. C. 0 7
  4. D. 0 9
Continue practicing

Related questions

ConstraintsSolve before→ConstraintsRandom dynamic arrays→
asic.fyi · Learn silicon end to end.info@asic.fyi