Home > Community > Forums > Custom IC SKILL > Dynamic arrays

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Dynamic arrays 

Last post Fri, Jun 22 2012 5:56 AM by Andrew Beckett. 3 replies.
Started by Adhil 21 Jun 2012 12:38 AM. Topic has 3 replies.
Page 1 of 1 (4 items)
Sort Posts:
  • Thu, Jun 21 2012 12:38 AM

    • Adhil
    • Top 100 Contributor
    • Joined on Fri, Apr 15 2011
    • Singapore, 00-SG
    • Posts 61
    • Points 1,245
    Dynamic arrays Reply

    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

    • Post Points: 20
  • Thu, Jun 21 2012 2:01 PM

    Re: Dynamic arrays Reply

    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.

    • Post Points: 20
  • Thu, Jun 21 2012 7:01 PM

    • Adhil
    • Top 100 Contributor
    • Joined on Fri, Apr 15 2011
    • Singapore, 00-SG
    • Posts 61
    • Points 1,245
    Re: Dynamic arrays Reply

    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

    • Post Points: 20
  • Fri, Jun 22 2012 5:56 AM

    Re: Dynamic arrays Reply

    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.

    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by Adhil at 21 Jun 2012 12:38 AM. Topic has 3 replies.