• 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. pass argument to enterPoints procedure

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 15939
  • 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

pass argument to enterPoints procedure

mantang
mantang over 5 years ago

Hi

How do I pass extra arguments "theForm" and "instances" of CCSbtnFld1CB to addPointProc and doneProc ?  (w done pts) or (w plist) are default argument. The example in SKILL manual does not show the solution.

inst_sel = hiCreateButton(
      ?name concat('inst_sel i)
    ; ?buttonText "Select instances from the schematic"
    ?buttonText "Select"

  ; ?callback "CCSbtnFld1CB(hiGetCurrentForm())"
  ; ?callback list("CCSbtnFld1CB(hiGetCurrentForm() i)")

    ?callback list(
         sprintf(nil
         "CCSbtnFld1CB(hiGetCurrentForm() 'instances%d)"
          i
          )
       )
)

procedure(CCSbtnFld1CB(theForm instances)
   let( ()

     enterPoints(
     ?prompts list("Click to select instances in the cellview. Press Esc key when done with selections")
    ?addPointProc "CCSAddPtCB"
    ?doneProc "CCSPointsDone"
     );enterPoints
);let
);procedure

procedure( CCSPointsDone( w done pts)
unless( done
   get(ExampleForm instances)->value = buildString(
      setof(obj geGetSelSet()  
      and(obj~>objType=="inst"
      obj~>purpose!="pin"))~>name)
);unless
t
);procedure

procedure( CCSAddPtCB( w ptlist )

geSelectPoint(w car(last(ptlist)))
);procedure

Thanks,

ManChak

  • Cancel
  • mbracht
    mbracht over 5 years ago

    Hi Mantang,

    The answer is simple - you can't. Those callbacks defined in enterPoints(..) are always called with exactly those three respectively two arguments. That's why yo get an error when you don't implement them expecting just these arguments. So to get at the current form you'll have to issue hiGetCurrentForm(..) and geGetWindowCellView()~>instances and assign the return values to local variables.

    Max

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 5 years ago

    oops - I made in a mistkae in my earlier post. With geGetWindowCellView()~>instances you get all the cell view's instances. To get the selected ones only you need to

    (setof fig (geGetSelectedSet (geGetWindowCellView)) fig~>objType=="inst")

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantang
    mantang over 5 years ago in reply to mbracht

    Hi mbracht

    Thank you for your info. Your previous message said return local variable. How do I  assign the return value of CCSPointsDone  to variable inside CCSbtnFld1CB ?  Please see the bold line.

    Everyone: Any suggestion ? Thank you for your help  in advance 

    procedure(CCSbtnFld1CB(theForm instances)

        let( ()

                 enterPoints( ?prompts list("Click to select instances in the cellview. Press Esc key when done with selections")

                 ?addPointProc "CCSAddPtCB"

                 ?doneProc "CCSPointsDone"     ;  how do I assign the return value of CCSDPointDone heree

                 );enterPoints

        );let

    );procedure

    procedure( CCSPointsDone( w done pts)

    prog(str1

         str1 = ""

        unless( done str1 = buildString( setof(obj geGetSelSet() and(obj~>objType=="inst" obj~>purpose!="pin"))~>name)

        );unless

        return str1 ) ; proj 

    );procedure

    procedure( CCSAddPtCB( w ptlist )

    geSelectPoint(w car(last(ptlist)))

    );procedure

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to mantang

    Unfortunately this is one of those things that would be a whole lot easier if the various enterFunctions (enterPoints, enterBox etc) allowed the callbacks to be specified as a function object rather than a string (CCR 2169313 is asking for this - you might want to contact customer support and request a duplicate) as then you could use a SKILL++ closure to share variables between the calling function and the callbacks. I do have a hideous workaround for that, but it's so ugly I don't want to share it in public as I wouldn't really want people relying on it.

    Anyway, in this specific case, the easiest approach is to not use the doneProc but rely on the return value of enterPoints. Note that often in the schematic and layout editor the "Repeat Commands" editor option is on, and that prevents the enterPoints from returning - it calls it again afterwards. So we need to temporarily turn that off. See the code below for an illustration how to do this - based on your example somewhat:

    procedure( CCFAddPtCB( w ptlist )
      geSelectPoint(w car(last(ptlist)))
    )
    
    procedure(CCFdoEnterPoints(instances)
      let((points modalCommands str1 application)
        ; temporarily turn off "repeat commands" so that the 
        ; function returns after one run. Don't bother with the doneProc
        ; but use the return value instead
        application=case(geGetEditCellView()~>cellViewType
          ("schematic" "schematic")
          ("schematicSymbol" "schematic")
          ("maskLayout" "layout")
        )
        modalCommands=envGetVal(application "modalCommands")
        ; the first block is the code to invoke, and the second block
        ; is guaranteed to run even if there is an error in the first block
        ; or it is aborted for some reason
        unwindProtect(
          {
            envSetVal(application "modalCommands" 'boolean nil)
            points=enterPoints(
              ?prompts list("Click to select instances in the cellview. Press Esc key when done with selections")
              ?addPointProc "CCFAddPtCB"
            )
            when(points
              str1 = buildString(setof(obj geGetSelSet() and(obj~>objType=="inst" obj~>purpose!="pin"))~>name)
            )
            printf("str1 is %L\n" str1)
          }
          ; make sure that the modalCommands is reset afterwards
          {
            envSetVal(application "modalCommands" 'boolean modalCommands)
          }
        )
      )
    )
    
    
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantang
    mantang over 5 years ago in reply to Andrew Beckett

    HI Andrew,

    Thank you for your code.

    Thanks,

    ManChak

    • 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