Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to generate a square wave in a analog PLL simulation with verilog-AMS?

444 views
Skip to first unread message

Robert Willy

unread,
Mar 25, 2015, 1:29:44 AM3/25/15
to
Hi,

There is a PLL verilog-AMS model. Now it works in the simulation with sine
input signal, i.e. the output sine phase tracking input signal source phase.
I would like to see what output will be for a square wave input. I know that
a large magnitude sine wave passing a limiter will be a square wave. But I
have no idea on how to write a limiter.

Could you give me some hints on how to write a limiter function?

Below is the example signal source code.



parameter real freq = 1.0e2;
parameter real coeff = 1.0;

analog

V(p,n) <+ sin(`M_TWO_PI * freq * (0 + 1.0) * $abstime);







Thanks,

Robert Willy

unread,
Mar 25, 2015, 1:48:50 AM3/25/15
to
I find that a conditional function works (it directly makes a decision with
the contents of ( ). But it is a long line. When I want to use a variable to
substitute the content of ( ) as below:




real tempr;

tempr = sin(`M_TWO_PI * freq * (0 + 1.0) * $abstime;



It has errors when I try to do Transient analysis.

Could you tell me how to make the above works?


Thanks,

Robert Willy

unread,
Mar 25, 2015, 9:50:47 AM3/25/15
to
I solved the problem by adding begin end.
0 new messages