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

    hiCreateListField is the correct function to use. There were a couple of issues with the code as you pasted it - the end part of the callback function was missing (so I copied it from the second version which didn't have the argument list) and in the ?callback field for the movepins button you had valuei rather than value for the first argument (and hence it always passed nil).

    Anyway, having fixed those little things, the real reason that you have a problem is that you have mlOldOffsetB and mlNewOffsetB specified as list fields, and that is what  your callback is expecting. The callback function is defined:

    procedure( mlOffsetSelPin(mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB)

    but in the callback function for movepins, it calls it with the fields in this order:

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

    So that's a different order. You define it as needing the old and new offsetA followed by old and new offsetB, but actually call it with the two old offsets and then the two new offsets.

    I can see that the complete lists are being passed (if you call trace(mlOffsetSelPin) you'll see this in the CIW), and the code completes (I don't have an example that works because I couldn't quite see what the code is supposed to be doing, but hopefully this is sufficient to get you moving).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    hiCreateListField is the correct function to use. There were a couple of issues with the code as you pasted it - the end part of the callback function was missing (so I copied it from the second version which didn't have the argument list) and in the ?callback field for the movepins button you had valuei rather than value for the first argument (and hence it always passed nil).

    Anyway, having fixed those little things, the real reason that you have a problem is that you have mlOldOffsetB and mlNewOffsetB specified as list fields, and that is what  your callback is expecting. The callback function is defined:

    procedure( mlOffsetSelPin(mlStartOffset mlOldOffsetA mlNewOffsetA mlOldOffsetB mlNewOffsetB)

    but in the callback function for movepins, it calls it with the fields in this order:

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

    So that's a different order. You define it as needing the old and new offsetA followed by old and new offsetB, but actually call it with the two old offsets and then the two new offsets.

    I can see that the complete lists are being passed (if you call trace(mlOffsetSelPin) you'll see this in the CIW), and the code completes (I don't have an example that works because I couldn't quite see what the code is supposed to be doing, but hopefully this is sufficient to get you moving).

    Regards,

    Andrew.

    • 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