• 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. Dynamic arrays

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 14403
  • 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

Dynamic arrays

Adhil
Adhil over 13 years ago

Hi!!

I am trying to create a dynamic array. please test out the folowing code. it works fine, but the handle that varies the columns is not very sensitive. how can i solve this problem?


pcDefinePCell(
  list(ddGetObj("adhillib") "rect1" "layout")
  (
   (Width  0.1)
   (Length 0.2)
  )
  let(((cv pcCellView))
   rectRodObj = rodCreateRect(
                             ?name     "myRect"
                             ?cvId     cv
                             ?layer    list("M1" "drawing")
                             ?width    Width
                             ?length   Length
                             ?origin   list(0 0)
        )
                     
  )

   )

pcDefinePCell(
  list(ddGetObj("adhillib") "rectarray1" "layout")
  (
   (columns 1)
   (space 0.2)
  )
  let(((cv pcCellView) (width1 0.1) width2 (length1 0.2) cellview rectRodObj rectRodObj1)
                       
   mosaicbBox = dbCreateParamSimpleMosaicByMasterName(cv "adhillib" "rect1" "layout"
                                                              "rect_array" 0:0 "R0" 1 columns 0.2 space list(list("Width" "float" width1) list("Length" "float" length1))  )
                        cellview = dbOpenCellViewByType("adhillib" "rect1" "layout")
                 bBox     = dbComputeBBoxNoNLP(cellview)
                 width2   = xCoord(upperRight(bBox)) - xCoord(lowerLeft(bBox))
                 columnbBoxWidth  = xCoord(upperRight(mosaicbBox ~> bBox)) - xCoord(lowerLeft(mosaicbBox ~> bBox))
                        columnbBoxLength = yCoord(upperRight(mosaicbBox ~> bBox)) - yCoord(lowerLeft(mosaicbBox ~> bBox))


                        rectRodObj = rodCreateRect(
                             ?name     "myRect10"
                             ?cvId     cv
                             ?layer    list("ALPHA" "drawing")
                             ?width    space - width1
                             ?length   length1
                             ?origin   list(width2 0)
        )

                        rectRodObj1 = rodCreateRect(
                             ?name     "myRect11"
                             ?cvId     cv
                             ?layer    list("ALPHA" "drawing")
                             ?width    columnbBoxWidth
                             ?length   columnbBoxLength
                             ?origin   list(0 0)
        )

                        rodAssignHandleToParameter(
                             ?parameter          "space"
                             ?rodObj             rectRodObj
                             ?handleName         "centerRight"
                             ?stretchDir         "X"
                             ?displayName        "space"
                             ?displayExpression  "space"
                             ?updateIncrement    0.1
                             ); rodAssignHandleToParameter

                       rodAssignHandleToParameter(
                             ?parameter          "columns"
                             ?rodObj             rectRodObj1
                             ?handleName         "centerRight"
                             ?stretchDir         "X"
                             ?displayName        "columns"
                             ?displayExpression  "columns"
                             ?updateIncrement    space
                             ); rodAssignHandleToParameter
              

     )
      )

 Adhil

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    The problem is that it's stretching it as a dimension, and so it only updates if you move the cursor by 1um (i.e. 1). So, change the default value of columns to be a floating point number (1.0) in the list of parameters in the pcDefinePCell call, and then change the rodAssignHandleToParameter to be:

     pcDefinePCell(
      list(ddGetObj("opamp090") "rectarray1" "layout")
      (
       (columns 1.0)   ; note change in default
      (space 0.2)
      )

    ...

                           rodAssignHandleToParameter(
                                 ?parameter          "columns"
                                 ?rodObj             rectRodObj1
                                 ?handleName         "centerRight"
                                 ?stretchDir         "X"
                                 ?displayName        "columns"
                                 ?displayExpression  "columns"
                                 ?updateIncrement    space
                                 ?userData           space
                                 ?userFunction
                                   lambda((struct)
                                        ; printf("STRUCT: %L\n" struct->??)
                                        round(struct->paramVal+struct->increment/struct->userData)
                                     )
                                 ); rodAssignHandleToParameter

    Something like that anyway!

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Adhil
    Adhil over 13 years ago

    Hi Andrew!

    It works fine now. but how does your lambda function actually work? what kind of sorcery is this?haha. on the otherhand, there is a tag at the end of the pcell showing the variable that you are adjusting via the handle, is it possible to shift this tag next to the mouse point? 

     Adhil

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

    Adhil,

    As a former colleague of mine used to say "don't be afraid of the lambda". A lambda is simply an unnamed function, defined directly in the code. I could equally well have done:

                                   procedure(MyStretchUserFunction(struct)
                                        ; printf("STRUCT: %L\n" struct->??)
                                        round(struct->paramVal+struct->increment/struct->userData)
                                   )

    and then passed ?userFunction 'MyStretchUserFunction to rodAssignHandleToParameter. All it is doing is taking the amount of increment (in microns) and dividing by the space parameter (passed in using userData, although could have got it from the instance, I expect) to give the overall change in number of columns - the function returns the new value of the parameter being stretched. In this case we don't a one to one stretch, because the increment is in microns, and this is an integer.

    The tag (I assume you mean the displayed expression enabled with the ?displayName and ?displayExpression arguments) can't be moved, as far as I know - there's no argument to control it, and if you read the manual it tells you where it's going to be placed.

    Andrew.

    • 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