• 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. Make local procedures to use in pcell code

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 15392
  • 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

Make local procedures to use in pcell code

RVERP
RVERP over 4 years ago

I want to make local SKILL procedures, so they can be used inside pcell code.

I have made some custom Pcells, that use a set of custom procedures. Is there a way to easily embed these procedures inside the pcell code, so that they can still be used by calling the procedure with it's arguments, but that they only exist inside the Pcell?

  • Cancel
Parents
  • mbracht
    mbracht over 4 years ago

    Hi,

    If I get you right you want as set of functions that are private to the code the creates the PCell and in such invisible from outside right?
    Well you you might use the SKILL++ lexical scoping/closure capabilities. Consider the below code:

    (inScheme
       (defun getNmosBuilder ()
         (let ()
           (defun privatFunc1 ()
             (println "I'am Func1"))
           (defun privatFunc2 ()
             (println "I'am Func2"))
           (lambda (@rest args)
             (println "I'am building an nmos and may call private functions")
             (privatFunc1)
             (privatFunc2)))))
    (putd 'nmosBuilder (getNmosBuilder))

    The function getNmosBuilder() returns a function object (the return value of lambda...). That function object runs in a lexical scope where it can see the functions privatFunc1() and privatFunc2() that are invisible from outside. The putd() just associates the function object with the symbol nmosBuilder so as you may call it like a regular function. You may now use nmosBuilder() within pcDefinePCell. The actual  code that creates the PCell needs to be in the lambda() block.
    I have to say that I haven't used this in a PCell but I don't see why it shouldn't work...or so I hope.

    Max

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 4 years ago in reply to mbracht

    Hi

    You don't actually need to use a builder in this case.
    You could use putd directly in your let closure, or the defglobalfun macro to make the code clearer (which uses putd):

    (inScheme
      (let nil

        (defun privatFunc1 nil
          (println "I'am Func1"))

        (defun privatFunc2 nil
          (println "I'am Func2"))

        (defglobalfun nmosBuilder (@rest _args)
          (println "I'am building an nmos and may call private functions")
          (privatFunc1)
          (privatFunc2)
          )

      );closure
    );skill++

    Cheers,

    Aurel

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • AurelBuche
    AurelBuche over 4 years ago in reply to mbracht

    Hi

    You don't actually need to use a builder in this case.
    You could use putd directly in your let closure, or the defglobalfun macro to make the code clearer (which uses putd):

    (inScheme
      (let nil

        (defun privatFunc1 nil
          (println "I'am Func1"))

        (defun privatFunc2 nil
          (println "I'am Func2"))

        (defglobalfun nmosBuilder (@rest _args)
          (println "I'am building an nmos and may call private functions")
          (privatFunc1)
          (privatFunc2)
          )

      );closure
    );skill++

    Cheers,

    Aurel

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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