• 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. Get user input with GUI in the runtime

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 10479
  • 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

Get user input with GUI in the runtime

sbkuizlzl
sbkuizlzl over 3 years ago

Hi all.

I'm using Virtuoso IC6.1.8-500.19 and I am writing the SKILL script that needs to take user's input in the runtime.

At first, I implemented it by using gets function and got the input from CIW. It works well.

However, I want to take the input with GUI. 

A trick I can think is that call break to halt the function right after hiDisplayForm, and if the callback is called by clicking "OK", take the value from the form as below.


procedure(test_gui()

    formId = gui_body()

    break()

    want_value = formId-><some_field>->value

);procedure

procedure(gui_body()

prog((formId)

    /* Some field

    ....

    */

    formId = hiCreateLayoutForm(... ?callback "continue()" ...)

    hiDisplayForm(formId)

    return(formId)

);prog

);procedure


But I don't think it is a good way. Is there a way to achieve it?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago

    Using a break() is definitely the wrong thing to do. There are two ways you can do this:

    1. Pass ?dialogStyle 'modal to the hiCreateLayoutForm. 
    2. Put the logic you want to do once the form is issued in a function that you call from the ?callback. 

    The second is really the right way to do this. If you make the form blocking (the first approach), then unless you change the buttonLayout too, pressing the Apply button won't do what you want (it won't work properly with your break/continue approach either, which will also need a SKILL development license to run).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 3 years ago

    Hi, I guess what you just need is the 'modal dialogStyle argument:

    This should do what you expect:

    (defun prompt nil
      "Prompt user, return typed string"
      (let ((form (hiCreateLayoutForm 'custom_prompt "Prompt"
                    (hiCreateFormLayout 'main_layout ?items (list (hiCreateStringField ?name 'input ?prompt "Input")))
                    ?dialogStyle 'modal
                    ?buttonLayout 'OKCancel
                    ?buttonDisabled '(Help)
                    )))
        (hiDisplayForm form)
        form->input->value))

    Cheers,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • sbkuizlzl
    sbkuizlzl over 3 years ago

    Andrew Beckett and AurelBuche:

    Thank you for your replies! Slight smile

    I agree with you that ?dialogStyle 'modal can be helpful to get the user input while the SKILL script is halted.  

    However, in my case, the form should be 'modeless because the user have to check a cellview while it is halted and give some values.

    In other words, while the program is halted, Virtuoso should not be halted.

    Sorry for insufficient information in the prior question.  

    More precisely, the toy example that I want to do is as below.


    procedure( my_func()

    let((a)

        form_id = toy_gui()

        a = form_id->str_field->value

        printf("a = %s\n" a)

    );let

    );procedure

    procedure( toy_gui()

    prog((str_field vbox_layout form_id)

        str_field = hiCreateStringField(?name 'str_field)

        vbox_layout = hiCreateVerticalBoxLayout('vbox_layout ?items list(str_field))

        form_id = hiCreateLayoutForm('toy_form "Example" vbox_layout ?buttonLayout 'OKCancel)

        hiDisplayForm(form_id)

        return(form_id)

    );prog

    );procedure


    In this example, what I want to print is "a = <some value that I typed in the GUI>" but this program always print "a = " because the form is modeless.

    So I use the break() and continue() callback trick.  

    and Andrew Beckett:

    In the second approach, is there any way to modify value a in my_func() by callback function, while a is a local variable?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 3 years ago in reply to sbkuizlzl
    sbkuizlzl said:
    In the second approach, is there any way to modify value a in my_func() by callback function, while a is a local variable?

    SKILL++ environments/closures are meant for this as I tried to explain in this post: Help me! How to SKILL activation in the background??

    Cheers

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to AurelBuche

    You could use closures as Aurélien suggested, but it might just be as simple as doing this:

    procedure( toy_cb(form_id)
    let((a)
        a = form_id->str_field->value
        printf("a = %s\n" a)
    )
    )
    procedure( toy_gui()
    prog((str_field vbox_layout form_id)
        str_field = hiCreateStringField(?name 'str_field)
        vbox_layout = hiCreateVerticalBoxLayout('vbox_layout ?items list(str_field))
        form_id = hiCreateLayoutForm('toy_form "Example" vbox_layout 
    	?buttonLayout 'OKCancel ?callback 'toy_cb)
        hiDisplayForm(form_id)
        return(form_id)
    );prog
    );procedure

    Then call toy_gui, and then the callback can retrieve info from the form and make an action. Potentially if it needs to access information from before the form was displayed, that could be stored as properties on the form - but I didn't get that need from your description.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • sbkuizlzl
    sbkuizlzl over 3 years ago in reply to Andrew Beckett

    Andrew Beckett and AurelBuche :

    Thanks a lot.

    I'll check the posts Aurélien suggests.

    • 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