The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 4:25pm
Pages: 1
Send Topic Print
How to handle complex numbers and error function (erf(x)) (Read 9496 times)
Polux
Junior Member
**
Offline



Posts: 15

How to handle complex numbers and error function (erf(x))
Nov 04th, 2011, 2:34am
 
As far as I know, verilogA does not support equation containing complex numbers and it doesnt work with the error function. I have just started a project simulating a specific FinFet for a company and I need to use equations based on the requiremets mentionated.  Is there any way? or any clue that I could use in order to star my investigation.

Thanks.
Back to top
 
 
View Profile   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: How to handle complex numbers and error function (erf(x))
Reply #1 - Nov 5th, 2011, 1:44pm
 
Its not Matlab. More designed for transient analaysis of currents and voltages.

As a work around, consider processing two "signals" one to represent the real component, and the other to represent the imaginary part.
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: How to handle complex numbers and error function (erf(x))
Reply #2 - Nov 7th, 2011, 11:18am
 
I don't even see erf(x) supported in SystemVerilog (some extra features in SystemVerilog trickle down into V-AMS).  I wonder if it's in VHDL-AMS (or one of its packages).

I don't see an easy solution, sorry to say.  Maybe you could create a table and use $table_model ?
Back to top
 
 

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



Posts: 15

Re: How to handle complex numbers and error function (erf(x))
Reply #3 - Nov 11th, 2011, 5:41am
 
Oook.. thanks for the help.... I will continue researching, if I find solutions I will post it..
Back to top
 
 
View Profile   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: How to handle complex numbers and error function (erf(x))
Reply #4 - Nov 13th, 2011, 1:22pm
 
An example implementation of the error function erf() can be found in the Numerical Recipes in C book. It's relatively easy to turn this C code into Verilog-A. Also C doesn't know a complex number data type and makes do with two real values representing real and imaginary parts as Geoffrey suggested.

Cheers,
Marq
Back to top
 
 
View Profile   IP Logged
Polux
Junior Member
**
Offline



Posts: 15

Re: How to handle complex numbers and error function (erf(x))
Reply #5 - Nov 16th, 2011, 1:38am
 
This is an example of the equations I have to run in VerilogA.. How would be your approach??.. I am still researching and try to find the most efficient solution..

u1v1 = cosh(pi * (xm + 1i*(toxs_t + Tch/2)) / (2 * toxs_t + Tch));

fz_0 = exp(g_0) * ((sqrt(pi) * Tch/2)/ (2 * sqrt(g_0))) * erf(sqrt(g_0))

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



Posts: 1999
Massachusetts, USA
Re: How to handle complex numbers and error function (erf(x))
Reply #6 - Nov 17th, 2011, 6:05am
 
For the erf call, I was suggesting something like this:

real erf;

erf = $table_model(sqrt(g_0), "erf.dat", "3E");
fz_0 = exp(g_0) * ((sqrt(pi) * Tch/2)/ (2 * sqrt(g_0))) * erf);

where erf.dat is a text data file containing values generated by C or Matlab or something.
Back to top
 
 

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



Posts: 15

Re: How to handle complex numbers and error function (erf(x))
Reply #7 - Dec 6th, 2011, 5:45am
 
Thank you very much for your help, implementing the erf(x) using table_models provides an easy way to obtain good results.  Now, I was wondering if you have some extra information about how to implement complex numbers, as other researchers suggest is to separate the signal en their components and work indiviudality, etc. But how to start?

I would really appreciate the help.

thanks in advance.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: How to handle complex numbers and error function (erf(x))
Reply #8 - Dec 14th, 2011, 8:27am
 
Well, you have cosh(a + bi) in your example.  So, you might start with some trigonometric identities:

cosh(x) = ( exp(x) + exp(-x) ) / 2
cosh(a+bi) = ( exp(a+bi) + exp(-a-bi) ) / 2
exp(iy) = cos(y) + i sin(y)
exp(a+bi) = exp(a) * exp(bi) = exp(a)*(cos(b) + i sin(b))

It gets a little messy; you might want to look at the whole set of equations and figure out if you really need all the parts.
Back to top
 
 

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



Posts: 15

Re: How to handle complex numbers and error function (erf(x))
Reply #9 - Dec 20th, 2011, 5:27am
 
Thanks again for your help.  I follow your suggestion and others to change the expression of the equation that use complex numbers, and now I have been able to simulate the model in VerilogA, your help has been very usefull.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: How to handle complex numbers and error function (erf(x))
Reply #10 - Dec 20th, 2011, 5:49am
 
I'm glad to hear it worked out for you.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   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.