Home > Community > Forums > Custom IC SKILL > How to get back to tcl after exiting in OCEAN and/or SKILL?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How to get back to tcl after exiting in OCEAN and/or SKILL? 

Last post Thu, Nov 8 2012 3:32 AM by Andrew Beckett. 12 replies.
Started by Reinice 05 Nov 2012 11:08 PM. Topic has 12 replies and 1827 views
Page 1 of 1 (13 items)
Sort Posts:
  • Mon, Nov 5 2012 11:08 PM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi All,

    Good Day. 

    I 'am running tcl in compiling/creating OCEAN and/or SKILL files. When I exit in OCEAN and/or SKILL I can't get back to tcl to compile the remaining tcl codes. Is there a way to get back to tcl after exiting in OCEAN and/or SKILL?

    Thank you very much in advance.

    Regards,

    Reinice

    • Post Points: 20
  • Mon, Nov 5 2012 11:52 PM

    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Reinice,

    You'll have to give more details of what you're doing - how you are launching OCEAN from Tcl, for exampe - what does the Tcl script look like. I see no reason why this shouldn't work in principle - so I'd need to understand what you're doing.

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Nov 6 2012 1:11 AM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Andrew,

    I 'am using exec ocean -restore "file.ocn" & when launching OCEAN/SKILL from tcl. Actually I' am using tcl(puts function) to create OCEAN/SKILL files then I invoke it using the command I mentioned.

    Thanks and Regards,

    Reinice

    • Post Points: 20
  • Tue, Nov 6 2012 1:41 AM

    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Reinice,

    So don't use the & at the end of the exec! That is backgrounding the process - and so you don't know when it finished.

    If I do:

    proc dothis {} {                           
      exec ocean -restore runSim.ocn               
      puts hello                                   
    }  

    "hello" is output after the simulation has finished (this assumes that runSim.ocn has an exit() call at the end).

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Nov 6 2012 1:47 AM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Andrew,

    I'll try your suggestion. I'll get back to you ASAP and tell what was the outcome.

    Thanks and Regards,

    Reinice

    • Post Points: 5
  • Wed, Nov 7 2012 12:21 AM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Andrew,

    I removed the "&" sign in the exec command but still it did not returned to tcl.

    Here is what I want to happen in my tcl:

    proc main {design_user tool_u analysis_name} {

    exec ocean -restore "file.ocn"

    main $design_user $tool_u $analysis_name

    }

    1. I have a main procedure.

    2. I exec file.ocn inside the main procedure.

    3. Then I will call main procedure after exec command have finished.

    Also, is there a way to see the progress of my exec command? So that I' am not guessing what it's status?

    Thanks and Regards,

    Reinice

    • Post Points: 20
  • Wed, Nov 7 2012 1:15 AM

    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Reinice,

    Here's how you'd do this in Tcl (nothing really to do with OCEAN - it's just Tcl techniques):

     proc showOutput {channel} {
      global finished
      if {[eof $channel] || [catch {gets $channel line}]} {
        close $channel
        set finished 1
      } else {
        puts $line
      }
    }
      
    # global flag so that the vwait will return when
    # the showOutput function tells it that the pipe
    # has closed
    set finished 0

    # open a pipe from ocean, and set it up to be
    # line buffered, with a file event to read the output
    # as each line appears
    set chan [open "| ocean -restore runSim.ocn"]
    fconfigure $chan -buffering line
    fileevent $chan readable [list showOutput $chan]
    vwait finished

    puts "NOTE: simulation has now finished"

     

    Regards,

    Andrew.

    • Post Points: 20
  • Wed, Nov 7 2012 1:54 AM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Andrew,

    I've tried your sample script but I' am having problem how to exit in ocean session. In your example runSim.ocn let's say I have a exit() function at the end of the file. Eventhough I have exit() function, still I' am not exiting in ocean session. It seems that finished in vwait finished did not changed.

    Thanks and Regards,

    Reinice

    • Post Points: 20
  • Wed, Nov 7 2012 3:17 AM

    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Reinice,

    Are you running "ocean" with "-nograph"? I'm wondering whether maybe you have a popup which is appearing but you can't see it because you're in nograph mode. Maybe if you run without -nograph mode you see it?

    Also try running the same OCEAN script from the command line (rather than from within Tcl) to see what happens. Even try "virtuoso -restore yourScript.ocn" and see what happens.

    Sometimes the popup that appears at the end is because of:

    a) something that needs saving (in which case maybe doing a dbPurge() of the design will fix it)
    b) modifications to the display.drf being done as part of a PDK's libInit.il (using drLoadDrf without nil as the second argument)

    I have seen people solve this by calling exit() twice in the OCEAN script, but that's a bit of a hack - better to try to find the root cause.

    Regards,

    Andrew.

     

    • Post Points: 20
  • Wed, Nov 7 2012 6:37 PM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Andrew,

    I 'am not using "-nograph" when running "ocean"

    I tried to run my OCEAN script from the command line and even tried "virtuoso -restore myScript.ocn", it runs/executes and exits ocean session and virtuoso session respectively and returned back to the command line without any popup.

    I also tried to do calling exit() twice in myScript.ocn and nothing happened. It did not return to main procedure.

    Here is how I implemented your suggestion

    proc main {design_user tool_u analysis_name} {

    proc showOutput {channel} {
      global finished
      if {[eof $channel] || [catch {gets $channel line}]} {
        close $channel
        set finished 1
      } else {
        puts $line
      }
    }
      
    set finished 0

    set chan [open "| ocean -restore myScript.ocn"]
    fconfigure $chan -buffering line
    fileevent $chan readable [list showOutput $chan]
    vwait finished

    puts "NOTE: simulation has now finished"

    main $design_user $tool_u $analysis_name 

    }

    It seems that finished in vwait finished did not change? and myScript.ocn executes and did not return to main procedure after exit().

    Thanks and Regards,

    Reinice

    • Post Points: 20
  • Wed, Nov 7 2012 11:45 PM

    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Reinice,

    From a quick check, it appeared to work for me as is, but I think you really ought to add "global finished" within the main proc (that's what the "man vwait" page suggests).

    If that doesn't fix it, has the ocean executable actually exited (check the processes running with "ps")?

    Andrew.

    • Post Points: 20
  • Thu, Nov 8 2012 3:27 AM

    • Reinice
    • Top 150 Contributor
    • Joined on Fri, Jul 27 2012
    • Posts 59
    • Points 915
    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    Hi Andrew,

    I tried your suggestion adding "global finished" within the main proc. It did not exit in ocean. I checked the processes running with "ps" and it is still running.

    I made some workaround that worked. Here's my script:

    proc main {design_user tool_u analysis_name} {

    proc showOutput {channel} {
      global finished

      gets $channel line

      set finished [string match "*Finished*" $line]

      puts $finished
      if {$finished == 1} {
        close $channel
      } else {
        puts $line
      }
    }
      
    set finished 0

    set my_IO [open "| ocean -restore myScript.ocn"]
    fconfigure $my_IO -buffering line
    fileevent $my_IO readable [list showOutput $my_IO]

    puts $finished
    vwait finished

    puts "NOTE: simulation has now finished"

    main $design_user $tool_u $analysis_name 

    }

    In myScript.ocn there's a line at the end of the file that shows it "Finished" it's execution. This workaround exits in ocean session and returned in main procedure.

    Thanks and Regards,

    Reinice

    • Post Points: 20
  • Thu, Nov 8 2012 3:32 AM

    Re: How to get back to tcl after exiting in OCEAN and/or SKILL? Reply

    I can't explain why it is not exiting for you, but at least you have a workaround.

    Andrew

    • Post Points: 5
Page 1 of 1 (13 items)
Sort Posts:
Started by Reinice at 05 Nov 2012 11:08 PM. Topic has 12 replies.