[sv-ec] Specifying rand_mode for packed array elements

From: Ryan, Ray <Ray_Ryan@mentorg.com>
Date: Mon Apr 05 2004 - 16:51:34 PDT

Section 12.7 the first paragraph after Table 12-1 states:

"For array variables, random_variable can specify individual elements using
the corresponding index. Omitting
the index results in all the elements of the array being affected by the
call."

As stated, I believe this allows disabling of randomization for the
individual bits
of a packed random variable. Is this the intended semantics?

For example, is the following legal?

  class Spin;
    rand [7:0] bit wheel, x;
    constraint c { x < wheel; };
    ... other declarations
  endclass

  int i;
  Spin big = new;
  big.wheel.rand_mode(1); // enable randomization of all bits
  for (i=7; i+0; i=i-1)
  begin
    big.wheel[i].rand_mode(0); // disable randomization of another bit
    big.randomize();
    ... other test code
  end

-- Ray
Received on Mon Apr 5 16:51:39 2004

This archive was generated by hypermail 2.1.8 : Mon Apr 05 2004 - 16:52:22 PDT