How to generate a square wave in a analog PLL simulation wit

R

Robert Willy

Guest
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,
 
On Tuesday, March 24, 2015 at 10:29:44 PM UTC-7, Robert Willy wrote:
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,

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,
 
On Tuesday, March 24, 2015 at 10:48:50 PM UTC-7, Robert Willy wrote:
On Tuesday, March 24, 2015 at 10:29:44 PM UTC-7, Robert Willy wrote:
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,

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,

I solved the problem by adding begin end.
 

Welcome to EDABoard.com

Sponsor

Back
Top