Re: monte carlo and distribution functions

From: Sri Chandra <srikanth.chandrasekaran_at_.....>
Date: Sun Jan 29 2006 - 14:51:25 PST
Hi Geoffrey,

I thought allowing integer variables as seed is already fixed in LRM2.2. 
If you look at section 10.3 it now accepts integers, parameters and 
constant numbers.

As far as the default expression for parameters are concerned, random 
and distribution calls are allowed as default as long as the parameters 
specified are constant expression (parameters or fixed constants). So in 
this context one wouldnt be able to use integer variable as a seed.

cheers,
Sri

Geoffrey.Coram wrote:
> 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 Sun Jan 29 14:51:47 2006

This archive was generated by hypermail 2.1.8 : Sun Jan 29 2006 - 14:53:14 PST