• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Define a special Calculator function

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 144
  • Views 17002
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Define a special Calculator function

Peach99
Peach99 over 15 years ago

 I have a problem. I have written a skill function that is executable in the CIW. When I execute the function it returns the result in the CIW Window (it works)! Now I try to integrate the function in the calculator by the help of the function 'procedure( f1() Matching_Skill )'. When I push the 'f1'-button in the Calculator it makes something but it doesn't return a value or a error warning (this means it works or not?). I want to return the result of the function by pushing the 'Print'-button in the Calculator window, but I don't no how!

The function:

procedure( Matching_Skill()

instId = car(geGetSelSet())
cdf=cdfGetInstCDF(instId)
length=cdf->L->value
width=cdf->W->value

modName=cdf->model->value

fp=infile("lookup.txt")
data=car(lineread(fp))
close(fp)
val = assoc(modName data)

curPath = geGetInstHier(getCurrentWindow())
fullPath = strcat(curPath "/" instId~>name)

if( OP(fullPath,"vgs") >= 0.0 then
    vg = OP(fullPath,"vgs")
else     vg = -OP(fullPath,"vgs")
  )
 
if( OP(fullPath,"vth") >= 0.0 then
    vto = OP(fullPath,"vth")
else     vto = -OP(fullPath,"vth")
  )  

deltaV = abs(vg-vto)

A0 = cadr(val)
A1 = caddr(val)
A2 = cadddr(val)
A3 = cadddr(cdr(val))
A4 = cadddr(cdr(cdr(val)))

deltaL = cadddr(cdr(cdr(cdr(val))))
deltaW = cadddr(cdr(cdr(cdr(cdr(val)))))

aidx = A0 + A1/(1+deltaV) + A2/((1+deltaV)**2) + A3/((1+deltaV)**3) + A4/((1+deltaV)**4)

sigma = aidx/sqrt((length + deltaL) * (width + deltaW))                 

print(sigma)

)

In the 'lookup.txt'-file there are only values for every device that are used for the computation if one device is selected on the schematic.

How I can commit the 'sigma'-variable to the 'print'-instruction by means of the 'f1'-button in the Calculator?

Please help me!

 

Best regards

Daniel Pietsch

  • Cancel
  • dmay
    dmay over 15 years ago

    I am not familiar with writing functions for the calculator, but I suspect that you need to return the value calcluated. As it is, you are returning the result of the print statement which is going to be t. Simply add sigma to the end of your procedure so it is returned instead and it may start working for you.

    I'd also like to suggest a way to make your code more readable. It is difficult to discern what is going on with all of your nested cdrs. This would be much cleaner if you used nth.

    A0 = nth(1 val)
    A1 = nth(2 val)
    A2 = nth(3 val)
    A3 = nth(4 val))
    A4 = nth(5 val)
    deltaL = nth(6 val)
    deltaW = nth(7 val)

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Axinet
    Axinet over 14 years ago

     I need to define "User defined function" in Calculator. I found (and read) "Defining New Functions Using SKILL in ADE". I would like to try given example, but I don't know where I should write and save function code and registration code:

    (calRegisterSpecialFunction(
    list( "test" ’MySpecialFunctionCB ))

    Can anybody give me a tip what is a proper filename and filepath, to get function appear in calculator under "User defined function"??? (if it matters the version is 5.1.41)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Add the code in your .cdsinit (or add a call to load("/path/to/your/file.il") in the .cdsinit).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information