• 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. Align rod rectangle created with elementsX and elementsY...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 3522
  • 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

Align rod rectangle created with elementsX and elementsY.

MorrisDH
MorrisDH over 1 year ago

My code: Using gpdk045

/*
How to align multi-element rects?
load "./mySkill/alignProc.il"
*/

procedure( alignProc(@key (cvId geGetEditCellView()))
let( (defaultSize cuFrame alEnc alFrame)

defaultSize = 2
alEnc = 3*defaultSize

cuFrame = rodCreateRect(?cvId cvId ?layer "M1Resdum" ?width defaultSize ?length defaultSize
?elementsX 3 ?elementsY 7 ?spaceX 0)

alFrame = rodCreateRect(?cvId cvId ?layer "M2Resdum" ?width alEnc ?length alEnc
?elementsY 3 ?spaceX 0)

rodAlign(?alignObj alFrame ?alignHandle "lowerLeft"
?refObj cuFrame ?refHandle "upperLeft")

) ; let
) ; procedure

The rodAlign command returns ROD-1032 warnings and the alignment fails. Is there a way to align 'cuFrame' to 'alFrame' as defined above.

There are other ways to accomplish the above but there existing code using elementsX and elementsY so if it can be made to work it would be great.

Cheers to all,

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    The issue here is that rodCreateRect (in this case) is returning a list of the individual rod objects because of your use of ?elementsX and ?elementsY. You can't align a list of ROD objects to another list. Aligning just one of them in each list won't work either, since there's no alignment between the individual objects.

    I added this function to your code which sets up alignments between the objects returned by rodCreateRect (note the comments) and then aligns one of them from each set. This then gives you a persistent alignment between all of the objects. 

    ; Given the return value of rodCreateRect when it is returning 
    ; a list of rodObjects, use the documented order (starting at
    ; upperRight, top to bottom then right to left, ending at
    ; lowerLeft) to set up alignments between the rectangles.
    ; note that this is assuming 0 spacing between the objects. That
    ; would need adjusting if that's not the case.
    procedure(alignRodRects(rodRects @key (elementsY 1))
      letseq(((prevRect car(rodRects)) (prevCol prevRect) (index 1))
        foreach(rodRect cdr(rodRects)
          if(mod(index elementsY)==0 then
            rodAlign(
              ?alignObj rodRect ?alignHandle "upperRight"
              ?refObj prevCol ?refHandle "upperLeft"
            )
            prevCol=rodRect
          else
            rodAlign(
              ?alignObj rodRect ?alignHandle "upperLeft"
              ?refObj prevRect ?refHandle "lowerLeft"
            )
          )
          prevRect=rodRect
          index++
        )
        t
      )
    )     
            
    procedure( alignProc(@key (cvId geGetEditCellView()))
      let( (defaultSize cuFrame alEnc alFrame)
    
        defaultSize = 2
        alEnc = 3*defaultSize
    
        cuFrame = rodCreateRect(?cvId cvId ?layer "M1Resdum" ?width defaultSize ?length defaultSize
          ?elementsX 3 ?elementsY 7 ?spaceX 0)
    
        alFrame = rodCreateRect(?cvId cvId ?layer "M2Resdum" ?width alEnc ?length alEnc
          ?elementsY 3 ?spaceX 0)
    
        ; add alignments between the objects in each list
        alignRodRects(cuFrame ?elementsY 7)
        alignRodRects(alFrame ?elementsY 3)  
    
        ; align the lowermost alFrame to the uppermost cuFrame
        rodAlign(
          ?alignObj car(last(alFrame)) ?alignHandle "lowerRight"
          ?refObj car(cuFrame) ?refHandle "upperRight"
        )
    
    ) ; let
    ) ; procedure

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MorrisDH
    MorrisDH over 1 year ago in reply to Andrew Beckett

    This is perfect!

    Thanks,

    • 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