• 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
  • theopaone
    theopaone over 10 years ago

    Note that the local variables defined in CreateForm such as mlStartOffset are in scope when the form is created but out of scope when the form is displayed. They held the field ID's which are then attached to the form when it is created. The variables are out of scope but the fields are not as they are now accessed through the form symbol.
     
    What Andrew is showing is accessing the field values starting with the form symbol (ExampleForm), the field symbol or name (mlOldOffsetB) and the attribute of value, his example retrieves the value from the field.

    As a good coding practice, the operation function mlOffsetSelPin (the one that moves the pins) should not be tied to the form. This allows the testing of the function without having to manually inputting data in the form. A function tied to a form is very hard to automatically test. I would recommend passing in all the values as an argument to the function, you may be able to reuse the function at a later time with a different form.

    Callback for the movePins button:

    mlOffsetSelPin(ExampleForm->mlStartOffset->value  ExampleForm->mlOldOffsetA->value ExampleForm->mlNewOffsetA->value ExampleForm->mlOldOffsetB->value ExampleForm->mlNewOffsetB->value)

    The callback function would then have arguments through which the values are passed:

    procedure( mlOffsetSelPin(mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB) ...)

    Just saying...

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

    Note that the local variables defined in CreateForm such as mlStartOffset are in scope when the form is created but out of scope when the form is displayed. They held the field ID's which are then attached to the form when it is created. The variables are out of scope but the fields are not as they are now accessed through the form symbol.
     
    What Andrew is showing is accessing the field values starting with the form symbol (ExampleForm), the field symbol or name (mlOldOffsetB) and the attribute of value, his example retrieves the value from the field.

    As a good coding practice, the operation function mlOffsetSelPin (the one that moves the pins) should not be tied to the form. This allows the testing of the function without having to manually inputting data in the form. A function tied to a form is very hard to automatically test. I would recommend passing in all the values as an argument to the function, you may be able to reuse the function at a later time with a different form.

    Callback for the movePins button:

    mlOffsetSelPin(ExampleForm->mlStartOffset->value  ExampleForm->mlOldOffsetA->value ExampleForm->mlNewOffsetA->value ExampleForm->mlOldOffsetB->value ExampleForm->mlNewOffsetB->value)

    The callback function would then have arguments through which the values are passed:

    procedure( mlOffsetSelPin(mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB) ...)

    Just saying...

    • 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