• 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. code for automatically filling the STD cell (in my case...

Stats

  • Replies 2
  • Subscribers 143
  • Views 89
  • Members are here 0

code for automatically filling the STD cell (in my case, the DMY cell) in the layout using a user-defined enter box for vacant spaces in layout

yogeshjaiswalCAD
yogeshjaiswalCAD 6 hours ago

Greetings Team,

I am grateful for your assistance whenever I am in need. I am working with the IC 23.1 tool.

Please help in the following code issue or share your code for automatically filling the STD cell (in my case, the DMY cell) in the layout using a user-defined enter box for vacant spaces in layout. 

Our form is the greatest spot for all experienced people.  Here is my code 

/*****************************************************************************
* Procedure: placeStdCellsInBoxEnterBox *
* Description: Tiles a user-drawn box area with instances of a master cell. *
*****************************************************************************/
procedure(placeStdCellsInBoxEnterBox(libName cellName viewName spacing)
let((cvId box llx lly urx ury instCv width height x y
inst_llx inst_lly inst_urx inst_ury
)

;; 1. Get current layout view
cvId = geGetEditCellView()
when(cvId == nil
(error "ERROR: No active layout view found. Please open a cell for editing.\n")
)

;; 2. Ask user to draw a box
box = enterBox()
when(box == nil
(return t) ; User-cancelled action
)

;; 3. Extract coordinates
llx = nth(0 box)
lly = nth(1 box)
urx = nth(2 box)
ury = nth(3 box)

;; 4. Open master cell and get dimensions
instCv = dbOpenCellViewByType(libName cellName viewName)

;; CRITICAL A: Check if the cell-view opened.
when(instCv == nil
(error "ERROR: Cannot find master cellview: %s/%s/%s\n" libName cellName viewName)
)

;; CRITICAL B: Check if the BBox attribute exists.
when(instCv~>bBox == nil
(dbClose(instCv))
(error "ERROR: Master cell %s/%s does not have a valid bounding box (bBox is nil).\n" libName cellName)
)

;; 5. Calculate cell dimensions. This section requires clean data!
destructuringBind(((inst_llx inst_lly) (inst_urx inst_ury)) instCv~>bBox
width = inst_urx - inst_llx
height = inst_ury - inst_lly
)

;; Check for valid cell dimensions
when(or(width <= 0 height <= 0)
(dbClose(instCv))
(error "ERROR: Master cell %s has a zero or negative dimension.\n" cellName)
)

;; 6. Place standard cells (Tiling Loop)
printf("Tiling area %g x %g with cell %s (W:%g, H:%g). Spacing: %g.\n"
(urx - llx) (ury - lly) cellName width height spacing)

y = lly
while(y <= ury - height
x = llx
while(x <= urx - width
dbCreateInst(cvId instCv nil list(x y) "R0")
x = x + width + spacing
)
y = y + height + spacing
)

;; 7. Cleanup and Refresh
dbClose(instCv)
geRefresh(cvId)

printf("\nStandard cells placed successfully in box from (%g %g) to (%g %g).\n" llx lly urx ury)

t
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Out put in CIW after running this code :;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;  placeStdCellsInBoxEnterBox("Testchip_tsmcN22_yogesh" "DMY" "layout" 0.2)

;;;  *Error* difference: can't handle (nil - (11.72 62.0))

kindly share any skill codes you may have.

I will be grateful for your help. Please help in!

With warm regards,

Yogesh Jaiswal

  • Cancel
  • Sign in to reply
  • Andrew Beckett
    Andrew Beckett 5 hours ago
    yogeshjaiswalCAD said:

    ;; 2. Ask user to draw a box
    box = enterBox()
    when(box == nil
    (return t) ; User-cancelled action
    )

    ;; 3. Extract coordinates
    llx = nth(0 box)
    lly = nth(1 box)
    urx = nth(2 box)
    ury = nth(3 box)

    This part is incorrect. The bounding box returned by enterBox() will be in the standard ((llx lly) (urx ury)) format, so accessing four values with nth() won't work. Your code will assign the first list to llx, the second list to lly, and then nil to the other two. You'd want:

    llx=xCoord(lowerLeft(box))
    lly=yCoord(lowerLeft(box))
    urx=xCoord(upperRight(box))
    ury=yCoord(upperRight(box))

    Or you could use a destructuringBind approach as done later in the code. 

    Do you have access to the SKILL IDE? If so, debugging this there would have shown you where the code broke, and then you could work backwards to check the values of the variables used in the subtraction.

    By the way, checking to see whether a cell has negative dimensions later in the code is a bit pointless since this is impossible. Maybe it could have zero size (if it was empty), but it will never have negative width or length.

    I didn't check the rest of the code.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • yogeshjaiswalCAD
    yogeshjaiswalCAD 4 hours ago in reply to Andrew Beckett

    Greetings Andrew,

    It means a lot when you take time from your busy schedule to reply to such answers. 

    I have succeeded in this quest with your help ...  The code is functioning as expected.  

    Once again thanks for warm gesture

    Have a pleasant day!

    Cheers & regards,

    Yogesh Jaiswal 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • 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