The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 3:22pm
Pages: 1
Send Topic Print
Passing variables to laplace_nd (Read 10608 times)
Saran
Junior Member
**
Offline

Getting wiser by the
second

Posts: 10

Passing variables to laplace_nd
Feb 25th, 2007, 4:08pm
 
Hey, I have a quick question and I appreciate if somebody can guide me in the right direction. Smiley

What is the clean way of having a variable in laplace_nd function. For instance, here I m modeling a baseband filter and I have to model this for different bandwidths. My filter has four stages that have been defined by their transfer functions. For simplicity I m including just the first stage which is a simple single pole.

vout = laplace_nd(gain_in_db * V(input), [2 * pi * nominal_freq * SCALE], [2 * pi * nominal_freq * SCALE, 1.0]);

This is the laplace filter definition for the first stage TIA. Normally, if there was only one bandwidth I was modeling, the SCALE variable wont be there (default = 1). The scale variable is defined as

case(MODE)

 freq1: SCALE = x;
 freq2: SCALE = y;
etc etc
endcase

The problem is that when I have this declaration, spectre gives an error saying that args #2 and #3 must be an array variable or a const array expression.

I was expecting spectre not to complain because the statement seemed logical. Obviously, there must have been some decisions made that wont allow me to declare variables in laplace_nd. My question is, if I want to have a variable in the laplace filter like I listed above, how can I cleanly do it?

Thanks,
Saran
Back to top
 
 
View Profile   IP Logged
zhong
Community Member
***
Offline



Posts: 36
California , United States
Re: Passing variables to laplace_nd
Reply #1 - Feb 25th, 2007, 11:43pm
 
Laplace fuction in spectre requires constant coeffcients .
You can use your original S-domain ploynomial function and directly convert it to integral form in Time domain
For example :
                             
 Vout                                  Ks/Wo
 -----        =             --------------------------
   Vin                     1+Ks/Wo + s^2/Wo^2
 

Converte to
  Vout = idt(Wo*(K*(Vin-Vout) -idt(WoVout)))

Time domain idt form allows you to have variable ..

Zhong
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Passing variables to laplace_nd
Reply #2 - Feb 26th, 2007, 5:21am
 
zhong wrote on Feb 25th, 2007, 11:43pm:
Laplace fuction in spectre requires constant coeffcients .


Laplace functions in Verilog-A, per the LRM, require constant coefficients.

You might get away with something like:
parameter integer mode = 1;
parameter real zero = (mode==1) ? x*`M_TWOPI : y * `M_TWO_PI;

because parameters are "constants" in Verilog.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Saran
Junior Member
**
Offline

Getting wiser by the
second

Posts: 10

Re: Passing variables to laplace_nd
Reply #3 - Feb 26th, 2007, 7:13am
 
Thanks zhong and Geoffrey.

Geoffrey, I think if the mode was a constant and known well in advance, your solution might work. However, the mode is determined when the chip is powered up by some control bits and hence it will be incorrect to assume it to be constant.

Either way, I will try out your solutions and let you know. Thanks for the help! Smiley
Back to top
 
 
View Profile   IP Logged
Saran
Junior Member
**
Offline

Getting wiser by the
second

Posts: 10

Re: Passing variables to laplace_nd
Reply #4 - Mar 2nd, 2007, 9:13am
 
Hey Guys, I have found out a brute or hack way to have variables in lalpace_nd, or for that matter in Verilog-AMS file. A parameter can be declared and the laplace_nd function will take the parameter as its argument..Everything is fine, spectre does not complain, but the problem is to now control the parameter value.

What we can do is, we can override the parameter by defining a formula for it using variables that will be defined in analog artist window. For instance, if I want to change scale, I would go to my top level schematic and press Q (properties of the block or instance) and define the scale value to a formula depending on some variables defined within analog artist. This will let us use parameters as variables in our simulation.

Saran
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Passing variables to laplace_nd
Reply #5 - Mar 2nd, 2007, 9:34am
 
Saran -
I think you missed a detail of my suggestion ... The "mode" could be a parameter set by a user property (Q) of an instance in the schematic.

In that way, I don't see how your "hack" is different from my suggestion, since both rely on setting something in schematic that is then fixed for the simulation.

If you have a limited number of possible scale factors, I have an idea for something that might work for a dynamic setting:

vout_s1 = laplace_nd(gain_in_db * V(input), [2 * pi * nominal_freq * x],  [2 * pi * nominal_freq * x, 1.0]);

vout_s2 = laplace_nd(gain_in_db * V(input), [2 * pi * nominal_freq * y],  [2 * pi * nominal_freq * y, 1.0]);

vout_s3 = laplace_nd(gain_in_db * V(input), [2 * pi * nominal_freq * z],  [2 * pi * nominal_freq * z, 1.0]);

case (MODE):
 freq1: vout = vout_s1;
 freq2: vout = vout_s2;
 freq3: vout = vout_s3;

etc.

Now, the laplace arguments are constant, but the actual output is selected amongst the different transfer functions.  For a few single-pole responses, this probably won't be a significant simulation overhead.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Saran
Junior Member
**
Offline

Getting wiser by the
second

Posts: 10

Re: Passing variables to laplace_nd
Reply #6 - Mar 6th, 2007, 6:30am
 
Geoffrey, I read your post one more time...Yes, you are right! I missed the details. Point taken Smiley. Thanks for the help.
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.