Poissonian current pulses generator

Status
Not open for further replies.

MarkJ90

Newbie
Joined
Apr 1, 2021
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
23
Hi,
I would like to create a current generator in Virtuoso using VarilogA that generates pulses with gaussian shape that are poissonian distributed in time.
I have already created a current generator that produces pulses with this shape but at a constant rate. Now I want to modify it in order to have these pulses poissonian distributed in time.
I put here the code that I used for constant rate current generator:
Code:
`include "constants.vams"
`include "disciplines.vams"

module Gaussian_Pulse(plus,minus);
inout plus,minus;
electrical plus,minus;

parameter real t_width = 100p;
parameter real t_centre = 100p;
real sigma = t_width/10;
parameter real Gain = 1000;
parameter real ICR= 1.5G;
real Q_tot = `P_Q * Gain;
real amplitude = Q_tot/sqrt(`M_TWO_PI*sigma*sigma);

real clock=1/(2*ICR);
real trf=1p;
real tdelay1=0;
real V;
integer y1;
integer cycle;
integer count;
real Vth=0.0000001;
analog begin
       @(timer(0,clock)) begin
        cycle=cycle+1;
             if(cycle%2==0) begin
                 y1=0;
            
                tdelay1=0;
            end
            else begin
             y1=1;
             tdelay1=trf;
             end
        end

V= transition(y1,tdelay1,trf);
     @(cross(V-Vth, +1)) begin
         count = count + 1;
     end

I(plus,minus) <+  amplitude*exp(-pow(($abstime - t_centre-(count*2*clock))/sigma,2)/2);

end

endmodule

Someone knows how can I do it?
 

VerilogA has dedicated function to generate poisson distributed numbers:
$rdist_poisson ( seed , mean [,string]) ;
 

Ok, but how can I integrate it into my code? Because @(timer(0,clock)) works at a specific clock period.
 

If I declare:
Code:
x = $rdist_poisson ( 10 , 5) ;

What does it return? Because I thought that x should be an array of 10 elements but it's not.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…