• 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. Various Cell Combinations

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 12836
  • 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

Various Cell Combinations

Sridhar Bhat
Sridhar Bhat over 13 years ago

 Hi,

Could someone help me out in writing a code which places the instances of all mentioned cells in various combinations. For example if I have 3 cells(ex X ,Y and Z) mentioned in a list then I need to  have 2^3 combinations. 

Thank you

Sridhar,

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Well, to generate the permutations (not 2^3 combinations, it would be N! - so 6 if there are 3 cells), you could use this SKILL function:

     (defun abPermsUniqueList (l)
      (if (null l) '(nil)
        (mapcan (lambda (x)
              (mapcar (lambda (y) (cons x y))
                  (abPermsUniqueList (remove x l )))) l)))

    That will work fine provided that there are no repetitions in the list passed in - so abPermsUniqueList('("X" "Y" "Z")) will produce:

     (("X" "Y" "Z")
        ("X" "Z" "Y")
        ("Y" "X" "Z")
        ("Y" "Z" "X")
        ("Z" "X" "Y")
        ("Z" "Y" "X")
    )

    If there are repetitions, then you would need to use the SKILL++ code (make sure it's in a file with a ".ils" suffix) - it uses a local function:

    (defun abPerms (l)
      ;----------------------------------------------------------------------
      ; Local function to remove only the first match in a list
      ; which means that it copes with repeated values in the list
      ;----------------------------------------------------------------------
      (defun removeFirst (val l)
        (let (found)
          (setof elem l
             (cond
               (found t)
               ((equal val elem) (setq found t) nil)
               (t t)
               ))))
      (if (null l) '(nil)
        (mapcan (lambda (x)
              (mapcar (lambda (y) (cons x y))
                  (abPerms (removeFirst x l )))) l)))

    I'll leave it to you to do the placement of the instances.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Well, to generate the permutations (not 2^3 combinations, it would be N! - so 6 if there are 3 cells), you could use this SKILL function:

     (defun abPermsUniqueList (l)
      (if (null l) '(nil)
        (mapcan (lambda (x)
              (mapcar (lambda (y) (cons x y))
                  (abPermsUniqueList (remove x l )))) l)))

    That will work fine provided that there are no repetitions in the list passed in - so abPermsUniqueList('("X" "Y" "Z")) will produce:

     (("X" "Y" "Z")
        ("X" "Z" "Y")
        ("Y" "X" "Z")
        ("Y" "Z" "X")
        ("Z" "X" "Y")
        ("Z" "Y" "X")
    )

    If there are repetitions, then you would need to use the SKILL++ code (make sure it's in a file with a ".ils" suffix) - it uses a local function:

    (defun abPerms (l)
      ;----------------------------------------------------------------------
      ; Local function to remove only the first match in a list
      ; which means that it copes with repeated values in the list
      ;----------------------------------------------------------------------
      (defun removeFirst (val l)
        (let (found)
          (setof elem l
             (cond
               (found t)
               ((equal val elem) (setq found t) nil)
               (t t)
               ))))
      (if (null l) '(nil)
        (mapcan (lambda (x)
              (mapcar (lambda (y) (cons x y))
                  (abPerms (removeFirst x l )))) l)))

    I'll leave it to you to do the placement of the instances.

    Andrew.

    • 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