• 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. function that get a floating point list

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 144
  • Views 16170
  • 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

function that get a floating point list

Ricky81
Ricky81 over 10 years ago

Hello everibody ,

this is my skill code:

procedure(CreateForm()
     let(( mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB movepins sep3)

        
        mlStartOffset=hiCreateFloatField(
                ?name 'mlStartOffset
                ?prompt "Enter X coordinate to start(e.g.prboundary)"
                )
     mlOldOffsetA=hiCreateFloatField(
                ?name 'mlOldOffsetA
                ?prompt "Enter Old Offset"
                )
     mlOldOffsetB=hiCreateListField(
                ?name 'mlOldOffsetB
                ?prompt "Enter a list of X coord. -OLD Pins position-"
                )
         mlNewOffsetA =hiCreateFloatField(
                ?name 'mlNewOffsetA
                ?prompt "Enter New Offset"
                )
         mlNewOffsetB =hiCreateListField(
                ?name 'mlNewOffsetB
                ?prompt "Enter a list of X coord. -NEW Pins position-"
                )
         movepins=hiCreateButton(
                ?name 'movepins
                ?buttonText "Move Pins after selection"
                ?callback "mlOffsetSelPin()"
                )
    sep3=hiCreateSeparatorField(?name 'sep3);separatore grafico sul menu'
          ;      ?callback "DisplayUserDataForm()"
           ;     )
        hiCreateAppForm(
            ?name 'ExampleForm
            ?formTitle "This skill set a new offset and move pins in new X coordinates"
            ?fields
                list(
                    list(mlStartOffset 0:0 600:30 300)
                    list(mlOldOffsetA 0:30 600:30 300)
                    list(mlOldOffsetB 0:60 600:30 300)
                list(mlNewOffsetA 0:90 600:30 300)
                    list(mlNewOffsetB 0:120 600:30 300)
                    list(movepins 250:170 170:20)
                    list(sep3 0:205 600:0)
                    )
            )
        )
     )
/***************************************************************
*                                                              *
*                      mlOffsetSelPin()                        *
*                                                              *
*              Callback code to move pins                      *
*                                                              *
***************************************************************/
procedure( mlOffsetSelPin()
  let( (oldX oldX1 nblocks1 nblocks oldOffr oldOff newOff newX)
    foreach( i geGetSelectedSet()
        when( i->objType == "rect" && i->purpose == "pin"
            oldX = xCoord(lowerLeft(i->bBox))    ; old X coord
            oldX1 = oldX - mlStartOffset        ; subtract starting offset
            nblocks1 = oldX1/mlOldOffsetA        ; count number of preceding blocks
            nblocks = int( nblocks1 )        ; round it to integer value
            oldOffr = (nblocks1 - nblocks) * mlOldOffsetA    ; calc offset inside the block
            oldOff = round(oldOffr*1000)/1000.0        ; round it to the grid
            ; look for the pin offset
            newOff = 0
            for( n 0 length(mlOldOffsetB)
                when( nth( n mlOldOffsetB ) == oldOff
                    newOff = nth( n mlNewOffsetB)
                )
            )
            ; pin doesn't match the offset list
            if( newOff == 0 then
                printf( "offset not found for pin %s at %L\n" i->net->name lowerLeft(i->bBox) )
            else ; pin found: move it to the new location
                newX = nblocks * mlNewOffsetA +mlStartOffset + newOff
                dbMoveFig(i i->cellView list(newX-oldX:0 "R0"))
            )
        )
    )
  )
)

It doesn't work because I can't find a right way to introduce a list of floating point in mlOldOffsetB mlNewOffsetB variables, to be read in mlOffsetSelPin() procedure.

Could you please help me?? thanks in advance

  • Cancel
Parents
  • Ricky81
    Ricky81 over 10 years ago

    Thanks for support Andrew and theopane!

    I'm a beginner with skill code...

    I'm just implemented your valuable advice, but it doesn' work 'cause in CIW appeare this message                                                                                                           

    *Error* lenght: argument must be a list or an array

     

    this is my new code:

     

     

    ------------------------------------------------------------------------------------------------------------------------------------------

    /***************************************************************
    *                                                              *
    *                       CreateForm()                       *
    *                                                              *
    *                     Create the main form                     *
    *                                                              *
    ***************************************************************/




    procedure(CreateForm()
         let(( mlStartOffset mlOldOffsetA mlOldOffsetB mlNewOffsetB mlNewOffsetA movepins sep3)

            
            mlStartOffset=hiCreateFloatField(
                    ?name 'mlStartOffset
                    ?prompt "Enter X coordinate to start(e.g.prboundary)"
                    )
         mlOldOffsetA=hiCreateFloatField(
                    ?name 'mlOldOffsetA
                    ?prompt "Enter Old Offset"
                    )
         mlOldOffsetB=hiCreateListField(
                    ?name 'mlOldOffsetB
                    ?prompt "Enter a list of X coord. -OLD Pins position-"
                    )
             mlNewOffsetA =hiCreateFloatField(
                    ?name 'mlNewOffsetA
                    ?prompt "Enter New Offset"
                    )
             mlNewOffsetB =hiCreateListField(
                    ?name 'mlNewOffsetB
                    ?prompt "Enter a list of X coord. -NEW Pins position-"
                    )
             movepins=hiCreateButton(
                    ?name 'movepins
                    ?buttonText "Move Pins after selection"
                    ?callback "mlOffsetSelPin(ExampleForm->mlStartOffset->valuei ExampleForm->mlOldOffsetA->value ExampleForm->mlOldOffsetB->value ExampleForm->mlNewOffsetA->value ExampleForm->mlNewOffsetB->value)"
                                    )
                   
        sep3=hiCreateSeparatorField(?name 'sep3);separatore grafico sul menu'
              ;      ?callback "DisplayUserDataForm()"
               ;     )
            hiCreateAppForm(
                ?name 'ExampleForm
                ?formTitle "This skill set a new offset and move pins in new X coordinates"
                ?fields
                    list(
                        list(mlStartOffset 0:0 600:30 300)
                        list(mlOldOffsetA 0:30 600:30 300)
                        list(mlOldOffsetB 0:60 600:30 300)
                    list(mlNewOffsetA 0:90 600:30 300)
                        list(mlNewOffsetB 0:120 600:30 300)
                        list(movepins 250:170 170:20)
                        list(sep3 0:205 600:0)
                        )
                )
            )
         )
    /***************************************************************
    *                                                              *
    *                      mlOffsetSelPin()                        *
    *                                                              *
    *              Callback code to move pins                      *
    *                                                              *
    ***************************************************************/
    procedure( mlOffsetSelPin(mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB)
      let( (oldX oldX1 nblocks1 nblocks oldOffr oldOff newOff newX)
        foreach( i geGetSelectedSet()
            when( i->objType == "rect" && i->purpose == "pin"
                oldX = xCoord(lowerLeft(i->bBox))    ; old X coord
                oldX1 = oldX - mlStartOffset        ; subtract starting offset
                nblocks1 = oldX1/mlOldOffsetA        ; count number of preceding blocks
                nblocks = int( nblocks1 )        ; round it to integer value
                oldOffr = (nblocks1 - nblocks) * mlOldOffsetA    ; calc offset inside the block
                oldOff = round(oldOffr*1000)/1000.0        ; round it to the grid
                ; look for the pin offset
                newOff = 0
                for( n 0 length(mlOldOffsetB)
                    when( nth( n mlOldOffsetB ) == oldOff
                       

    --------------------------------------------------------------------------------------------------------------------------------------------------------

     


    If I start function mlOffsetSelPin() alone it works, but inserting each time the values by hand like this:

    ----------------------------------------------------------------------------------------------------------------
    ;old
    mlOldOffsetA =  101.52
    mlOldOffsetB = list(4.22 14.28 34.48 44.54 54.98 65.04 85.24 95.3 )
    ;
    ;new
    mlNewOffsetA =  103.32
    mlNewOffsetB= list(4.47 14.47 35.19 45.19 56.13 66.13 86.85 96.85 )
    ;
    ; start 114.92
    mlStartOffset = 114.92




    procedure( mlOffsetSelPin()
      let( (oldX oldX1 nblocks1 nblocks oldOffr oldOff newOff newX)
        foreach( i geGetSelectedSet()
            when( i->objType == "rect" && i->purpose == "pin"
                oldX = xCoord(lowerLeft(i->bBox))    ; old X coord
                oldX1 = oldX - mlStartOffset        ; subtract starting offset
                nblocks1 = oldX1/mlOldOffsetA        ; count number of preceding blocks
                nblocks = int( nblocks1 )        ; round it to integer value
                oldOffr = (nblocks1 - nblocks) * mlOldOffsetA    ; calc offset inside the block
                oldOff = round(oldOffr*1000)/1000.0        ; round it to the grid
                ; look for the pin offset
                newOff = 0
                for( n 0 length(mlOldOffsetB)
                    when( nth( n mlOldOffsetB ) == oldOff
                        newOff = nth( n mlNewOffsetB)
                    )
                )
                ; pin doesn't match the offset list
                if( newOff == 0 then
                    printf( "offset not found for pin %s at %L\n" i->net->name lowerLeft(i->bBox) )
                else ; pin found: move it to the new location
                    newX = nblocks * mlNewOffsetA +mlStartOffset + newOff
                    dbMoveFig(i i->cellView list(newX-oldX:0 "R0"))
                )
            )
        )
      )
    )

    ----------------------------------------------------------------------------------------------------------------------------

     

    Any suggestions?

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Ricky81
    Ricky81 over 10 years ago

    Thanks for support Andrew and theopane!

    I'm a beginner with skill code...

    I'm just implemented your valuable advice, but it doesn' work 'cause in CIW appeare this message                                                                                                           

    *Error* lenght: argument must be a list or an array

     

    this is my new code:

     

     

    ------------------------------------------------------------------------------------------------------------------------------------------

    /***************************************************************
    *                                                              *
    *                       CreateForm()                       *
    *                                                              *
    *                     Create the main form                     *
    *                                                              *
    ***************************************************************/




    procedure(CreateForm()
         let(( mlStartOffset mlOldOffsetA mlOldOffsetB mlNewOffsetB mlNewOffsetA movepins sep3)

            
            mlStartOffset=hiCreateFloatField(
                    ?name 'mlStartOffset
                    ?prompt "Enter X coordinate to start(e.g.prboundary)"
                    )
         mlOldOffsetA=hiCreateFloatField(
                    ?name 'mlOldOffsetA
                    ?prompt "Enter Old Offset"
                    )
         mlOldOffsetB=hiCreateListField(
                    ?name 'mlOldOffsetB
                    ?prompt "Enter a list of X coord. -OLD Pins position-"
                    )
             mlNewOffsetA =hiCreateFloatField(
                    ?name 'mlNewOffsetA
                    ?prompt "Enter New Offset"
                    )
             mlNewOffsetB =hiCreateListField(
                    ?name 'mlNewOffsetB
                    ?prompt "Enter a list of X coord. -NEW Pins position-"
                    )
             movepins=hiCreateButton(
                    ?name 'movepins
                    ?buttonText "Move Pins after selection"
                    ?callback "mlOffsetSelPin(ExampleForm->mlStartOffset->valuei ExampleForm->mlOldOffsetA->value ExampleForm->mlOldOffsetB->value ExampleForm->mlNewOffsetA->value ExampleForm->mlNewOffsetB->value)"
                                    )
                   
        sep3=hiCreateSeparatorField(?name 'sep3);separatore grafico sul menu'
              ;      ?callback "DisplayUserDataForm()"
               ;     )
            hiCreateAppForm(
                ?name 'ExampleForm
                ?formTitle "This skill set a new offset and move pins in new X coordinates"
                ?fields
                    list(
                        list(mlStartOffset 0:0 600:30 300)
                        list(mlOldOffsetA 0:30 600:30 300)
                        list(mlOldOffsetB 0:60 600:30 300)
                    list(mlNewOffsetA 0:90 600:30 300)
                        list(mlNewOffsetB 0:120 600:30 300)
                        list(movepins 250:170 170:20)
                        list(sep3 0:205 600:0)
                        )
                )
            )
         )
    /***************************************************************
    *                                                              *
    *                      mlOffsetSelPin()                        *
    *                                                              *
    *              Callback code to move pins                      *
    *                                                              *
    ***************************************************************/
    procedure( mlOffsetSelPin(mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB)
      let( (oldX oldX1 nblocks1 nblocks oldOffr oldOff newOff newX)
        foreach( i geGetSelectedSet()
            when( i->objType == "rect" && i->purpose == "pin"
                oldX = xCoord(lowerLeft(i->bBox))    ; old X coord
                oldX1 = oldX - mlStartOffset        ; subtract starting offset
                nblocks1 = oldX1/mlOldOffsetA        ; count number of preceding blocks
                nblocks = int( nblocks1 )        ; round it to integer value
                oldOffr = (nblocks1 - nblocks) * mlOldOffsetA    ; calc offset inside the block
                oldOff = round(oldOffr*1000)/1000.0        ; round it to the grid
                ; look for the pin offset
                newOff = 0
                for( n 0 length(mlOldOffsetB)
                    when( nth( n mlOldOffsetB ) == oldOff
                       

    --------------------------------------------------------------------------------------------------------------------------------------------------------

     


    If I start function mlOffsetSelPin() alone it works, but inserting each time the values by hand like this:

    ----------------------------------------------------------------------------------------------------------------
    ;old
    mlOldOffsetA =  101.52
    mlOldOffsetB = list(4.22 14.28 34.48 44.54 54.98 65.04 85.24 95.3 )
    ;
    ;new
    mlNewOffsetA =  103.32
    mlNewOffsetB= list(4.47 14.47 35.19 45.19 56.13 66.13 86.85 96.85 )
    ;
    ; start 114.92
    mlStartOffset = 114.92




    procedure( mlOffsetSelPin()
      let( (oldX oldX1 nblocks1 nblocks oldOffr oldOff newOff newX)
        foreach( i geGetSelectedSet()
            when( i->objType == "rect" && i->purpose == "pin"
                oldX = xCoord(lowerLeft(i->bBox))    ; old X coord
                oldX1 = oldX - mlStartOffset        ; subtract starting offset
                nblocks1 = oldX1/mlOldOffsetA        ; count number of preceding blocks
                nblocks = int( nblocks1 )        ; round it to integer value
                oldOffr = (nblocks1 - nblocks) * mlOldOffsetA    ; calc offset inside the block
                oldOff = round(oldOffr*1000)/1000.0        ; round it to the grid
                ; look for the pin offset
                newOff = 0
                for( n 0 length(mlOldOffsetB)
                    when( nth( n mlOldOffsetB ) == oldOff
                        newOff = nth( n mlNewOffsetB)
                    )
                )
                ; pin doesn't match the offset list
                if( newOff == 0 then
                    printf( "offset not found for pin %s at %L\n" i->net->name lowerLeft(i->bBox) )
                else ; pin found: move it to the new location
                    newX = nblocks * mlNewOffsetA +mlStartOffset + newOff
                    dbMoveFig(i i->cellView list(newX-oldX:0 "R0"))
                )
            )
        )
      )
    )

    ----------------------------------------------------------------------------------------------------------------------------

     

    Any suggestions?

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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