• 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. How to Display CIW output in Forms as log

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 6728
  • 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

How to Display CIW output in Forms as log

Tejaskill
Tejaskill over 2 years ago

Hi all,

I am using ICADVM20.1, I have created a form using hiCreateAppForm() but I want to see the CIW output in that form as a output log. Is there any way to achieve this.
Thanks in advance.

Teja.

  • Cancel
  • AurelBuche
    AurelBuche over 2 years ago

    Hi Teja,

    It depends what you actually want : 

    - If you want to run a callback and display all the messages from the start to the end of the operation in your GUI, this is quite simple

    You can either redirect poport, woport and errport temporarily using outstring function, or if you want this data to be also printed in the CIW / CDS.log, you can use hiStartLog and hiEndLog then you just have to fetch the content of the custom log to print it in your GUI

    - If you want a log that gets updated with whatever is going-on during your Virtuoso session, this will be more tricky but might be achievable using a child process calling tail -f  or also using FIFO files

    Hope this helps,

    Cheers

    Aurélien

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Tejaskill
    Tejaskill over 2 years ago in reply to AurelBuche

    Hi Aurélien

    Thanks for the reply.

    Below is my code...

    tkstring=hiCreateStringField(
    ?name 'TK1
    ?prompt "Enter Your Name"
    ?value ""
    )
    tkstring1=hiCreateStringField(
    ?name 'TK2
    ?prompt "Enter Your Age"
    ?value ""
    )
    form=hiCreateAppForm(
    ?name 'TKform
    ?formTitle "Test Form"
    ?fields list(tkstring tkstring1)
    ?callback "subprogram()"
    )

    procedure(subprogram()
    printf("Your Name is %s\n" form->TK1->value)
    printf("Your Age is %s\n" form->TK2->value)
    )

    hiDisplayForm(form)

    This will print some lines in the CIW, I want that lines to be printed as log attched to that form only.
    I mean Is there any way to create a string field or a text field to which we can pass the output of CIW into those fields.

    I am asking a little much, Could you please give me an example Slight smile.

    Regards
    Teja.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 2 years ago in reply to Tejaskill

    Hi Teja,

    Here is an example that should do what you want  (I refactored your code a little bit) : 

    ;; It is easier to use `hiCreateLayoutForm', `hiCreateFormLayout' `hiCreateVerticalBoxLayout'
    ;; and `hiCreateHorizontalBoxLayout' rather than `hiCreateAppForm'.
    ;; The layouts are calculating all the fields position automatically
    hiCreateLayoutForm( 'TKform "Test Form"
      hiCreateFormLayout( 'main_layout ?items list(
          ;; Instead of creating the fields, storing them into variables then use the variable
          ;; I prefer to place them directly and access them using their name. (Less code, less bugs)
          hiCreateStringField( ?name 'TK1        ?prompt "Enter Your Name" ?value "")
          hiCreateStringField( ?name 'TK2        ?prompt "Enter Your Age"  ?value "")
          hiCreateMLTextField( ?name 'output_log ?prompt "Output Log"      ?value "" ?editable nil)
          ))
      ;; lambda functions are more flexible than strings when using from callbacks
      ?buttonLayout 'ApplyCancel
      ?callback
      lambda( (@rest _args)
        ;; Create an outstring port and safely store previous ports value so they can be reverted back
        let( ((port        (outstring))
              (old_poport  poport     )
              (old_woport  woport     )
              (old_errport errport    )
              )
           ;; `unwindProtect' is required to guarantee main ports are always restored afterwards
           unwindProtect(
             progn(
                   poport  = port
                   woport  = port
                   errport = port
                   subprogram()
                   TKform->output_log->value = getOutstring(port)
             )
             progn(
                   poport  = old_poport
                   woport  = old_woport
                   errport = old_errport
                   close(port)
             )
           );unwindProtect
        );let
      )
    )
    
    procedure(subprogram()
      printf("Your Name is %s\n" TKform->TK1->value)
      printf("Your Age is %s\n"  TKform->TK2->value)
    )
    
    hiDisplayForm(TKform)
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 2 years ago in reply to AurelBuche

    Regarding my previous answer

    This is a way to achieve what you want when you are running another program for which you do not control the ouput

    If the subprogram is written by yourself it would be much safer and cleaner to write a custom `print_to_log' function to replace your calls to `printf'

    Then inside this function you print the messages to whatever you want : the CIW, the field, an outstring, a file etc.

    • 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