• 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. Looking for a SKILL script that will snap the centers of...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 3779
  • 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

Looking for a SKILL script that will snap the centers of each instance to specific X and Y snap spacing

FormerMember
FormerMember over 2 years ago

Hi Cadence Community,
Good day

I am looking for a SKILL script that will snap the centers of each generated instance to a specific X & Y snap spacing.
Currently, I am doing this by selecting all the instances and then using quick align to snap all to my X & Y snap spacing.
Please see the screenshot below for the details.
Is this possible to be achieved using SKILL script?
Please help.
Thanks.



  • Cancel
  • AurelBuche
    AurelBuche over 2 years ago

    Hi,

    Here is a script to snap selected instances to the closest grid point:

    (inScheme
    (let nil

      (defun get_closest_snap (x x_snap)
        "Return X closest snap value according to X_SNAP"
        (round x/(1.*x_snap))*(1.*x_snap))

      (defun get_selected_instances nil
        "Return the list of currently selected instances"
        (setof obj (geGetSelectedSet) (equal "inst" obj->objType)))

      (defglobalfun snap_instances (@key (instances (get_selected_instances))
                                         (win       (hiGetCurrentWindow))
                                         (cv        (geGetWindowCellView win))
                                         (x_snap    win->xSnapSpacing)
                                         (y_snap    win->ySnapSpacing)
                                    @rest _args)
        "Snap the center of INSTANCES to the closest grid point"
        (foreach inst instances
          ;; Fetch instance center coordinates
          (destructuringBind (x y) (centerBox inst->bBox)
            ;; Calculate vector from center to closest snap point
            (let ((dx (get_closest_snap x x_snap)-x)
                  (dy (get_closest_snap y y_snap)-y)
                  )
              ;; Move instance
              (dbMoveFig inst cv (list (list dx dy) "R0" 1))
              )))
        );def

      );closure
    )

    Hope this helps,

    Cheers,

    Aurel

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 2 years ago in reply to AurelBuche

    Hi Aurel,

    Thank you for the reply.
    I tried this skill by selecting one layout instance, then pasting the script to CIW and enter.
    But it didn't move the device.
    Not sure if my step is correct.

    Regards,
    Berry

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to FormerMember

    Berry,

    You can paste the code once into the CIW (or put in a file and load it), but to actually use it, you'd need to type:

    snap_instances()

    in the CIW. That's the name of the main function that's defined which does the actual work of snapping.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 2 years ago in reply to Andrew Beckett

    Hi Andrew & Aurel,

    I finally understand how to use it.
    It is working as intended.
    Thank you very much for the help guys!

    Berry

    • 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