Re: monte carlo and distribution functions

From: Geoffrey.Coram <Geoffrey.Coram_at_.....>
Date: Thu Jan 26 2006 - 10:41:08 PST
Marq -
The intent was for the $rdist function to be in a paramset, and each
instance that referred to the paramset would actually result in a
new call to the random number generator.

Unfortunately, Boris pointed out that even this doesn't work well;
the problem is that, in order for each instance that calls $rdist
to get a new value, the seed needs to be an integer variable
(the LRM says the seed can be a parameter or fixed constant);
however, if it's an integer, then I think the syntax forbids the
$rdist call in parameter default value expressions (it' no longer
a constant_expression).

These two points need to be entered as a new Mantis item.

-Geoffrey


Marq Kole wrote:
> 
> All,
> 
> If I read section 10.3 of the LRM, each of the distribution system functions allows an optional parameter type_string. An explanation at the end of the section explains what this type_string does, but it says nowhere what happens if the type_string is omitted. Does it default to "global" or to "instance"?
> 
> Moreover, when I read through the explanation on the type string, I find the wording rather vague, and it revolves around the meaning of "instance". When I define a module that uses the $rdist_normal function twice, does an instance refer to an instance of the $rdist_normal function (which is normally called a "call" not an "instance") or does instance refer to an instantiation of the module? For Monte Carlo simulations I do hope it is the first...
> 
> module test_dist (a, b, c);
> inout a, b, c;
> electrical a, b, c;
> parameter integer seed = 1;
> 
> integer iseed;
> 
> analog begin
> 
>   @(initial_step) iseed = seed;
> 
>   V(a, b) = 1 + $rdist_normal(iseed, 0, 2e-02, "instance");
>  V(a, c) = 1 + $rdist_normal(iseed, 0, 2e-02, "instance");
> 
> end;
> 
> endmodule; // test_dist
> 
> module tb_test_dist;
> 
> electrical a, b, c;
> ground gnd;
> 
> TestMe test_dist(gnd, b, c);
> R1 #(.r(1k)) resistor (b, gnd); // So are the voltages over both resistors the same?
> R2 #(.r(1k)) resistor (c, gnd);
> 
> endmodule; // tb_test_dist
Received on Thu Jan 26 10:41:11 2006

This archive was generated by hypermail 2.1.8 : Thu Jan 26 2006 - 10:41:13 PST