Languages

CommunityCategory: XMODELGenerating random samples from Poisson distribution
SA Support Team Staff asked 3 years ago

While modeling a CMOS image sensor, I found a need to generate random noise following a Poisson distribution. Does XMODEL have a way to draw random samples from a Poisson distribution?

1 Answers
Best Answer
SA Support Team Staff answered 3 years ago

XMODEL provides the following DPI functions that generate samples from various probability distributions:

void rand_seed(input int seed);
real rand_gaussian(input real mu, input real sigma);
real rand_uniform(input real a, input real b);
int rand_poisson(input real mu);
real rand_gamma(input real a, input real b);
int rand_binomial(input real p, input int n);

Here are their descriptions:

  • rand_seed() sets the seed for a new sequence of random samples.
  • rand_gaussian() draws a random sample from a Gaussian distribution with mean 'mu' and standard deviation 'sigma'.
  • rand_uniform() draws a random sample from a uniform distribution between 'a' and 'b'.
  • rand_poisson() draws a random sample from a Poisson distribution with mean 'mu'.
  • rand_gamma() draws a random sample from a Gamma distribution with shape 'a' and scale 'b'.
  • rand_binomial() draws a random sample from a binomial distribution with probability 'p' and number of trials 'n'.

Please note that among them, rand_poisson() and rand_binomial() return integer values, corresponding to the number of arrivals and number of successes, respectively.

For example, the following SystemVerilog code will update a variable 'sample' with a random number drawn from a Poisson distribution with a mean of 10 whenever the signal 'clk' has a positive edge:

int sample;
always @(posedge clk) begin
    sample = rand_poisson(10.0);
end
SA Support Team Staff asked 3 years ago

CMOS 이미지 센서를 모델링하면서, 포아송 확률분포에 따른 랜덤 노이즈를 생성해야할 필요가 생겼습니다. XMODEL에는 포아송 랜덤 노이즈를 생성할 수 있는 방법이 있나요?

1 Answers
Best Answer
SA Support Team Staff answered 3 years ago

XMODEL provides the following DPI functions that generate samples from various probability distributions:

void rand_seed(input int seed);
real rand_gaussian(input real mu, input real sigma);
real rand_uniform(input real a, input real b);
int rand_poisson(input real mu);
real rand_gamma(input real a, input real b);
int rand_binomial(input real p, input int n);

Here are their descriptions:

  • rand_seed() sets the seed for a new sequence of random samples.
  • rand_gaussian() draws a random sample from a Gaussian distribution with mean 'mu' and standard deviation 'sigma'.
  • rand_uniform() draws a random sample from a uniform distribution between 'a' and 'b'.
  • rand_poisson() draws a random sample from a Poisson distribution with mean 'mu'.
  • rand_gamma() draws a random sample from a Gamma distribution with shape 'a' and scale 'b'.
  • rand_binomial() draws a random sample from a binomial distribution with probability 'p' and number of trials 'n'.

Please note that among them, rand_poisson() and rand_binomial() return integer values, corresponding to the number of arrivals and number of successes, respectively.

For example, the following SystemVerilog code will update a variable 'sample' with a random number drawn from a Poisson distribution with a mean of 10 whenever the signal 'clk' has a positive edge:

int sample;
always @(posedge clk) begin
    sample = rand_poisson(10.0);
end