• 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. Sleeping in SKILL

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 19324
  • 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

Sleeping in SKILL

gsimard
gsimard over 16 years ago

Hi,

 

 I need a function that would do a sleep for X milliseconds or seconds. I need to wait for an asynchronous task to complete so I'm polling a flag regularly, but I don't want to take the whole CPU in a while loop. Any idea ?

 

 Thank you,

Guillaume

  • Cancel
  • aplumb
    aplumb over 16 years ago
    hiRegTimer() is probably the magic function you're looking for. Andrew.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    You can use ipcSleep(N) where N is a number of seconds (integer).


    Alternatively, if the asynchronous task is running as a background process, launched with ipcBeginProcess(), you could use the data handler argument to ipcBeginProcess() to be asynchronously triggered when the child process produces output. That way you don't have to make the virtuoso session block...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • gsimard
    gsimard over 16 years ago

     Thank you both for these tips !

     

    I noticed that the asynchronous function I was talking about is strangely refusing to execute at the same time as other SKILL code. I first call a function, responsible for the start up of the asynchronous task (it's a layout extraction by the way). That function returns quite fast, but the extraction continues in the background, and it sends me text to the ICFB during this time. Meanwhile, I can enter SKILL commands, like (plus 3 4), etc, and get answer from cadence. However, if I try to execute a loop with some delay in it (I found that (system "sleep 1") could also work for a delay), it seems the background task extracting the layout doesn't quite continue ! In fact, I have to stop my waiting loop for it to complete.. this is quite anoying as right now I am unable to run the layout extraction process as a command line instead of a SKILL command.

     I guess the reason for this is that the SKILL interpreter must be single threaded. However, I REALLY need to execute the wait_function just once, and it must return when the background task is done.. which it won't do because the wait_function gets all the attention of cadence.... Any idea how I could break the circle ?

     I hope I'm being a bit clear !

    Thank you,

    Guillaume

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    SKILL is in fact single threaded, as you have noted. However, in practice, a background process communicating via ipcBeginProcess will cause the data handler to get invoked at the first opportunity that the virtuoso SKILL toplevel is available - i.e. when the UI returns.

    Functions such as ipcSleep and sleep will block virtuoso however.

    I'm not sure why the background process would get held up, unless it is producing so much output that the output buffer is being filled because the foreground SKILL process is not able to process it?

    It's very hard to tell without knowing the details of what you're doing...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dmay
    dmay over 16 years ago

    Have you looked at the documentation for hiRegTimer that aplumb suggested? This command can issue a skill command to run some specified number of seconds in the future. It does not tie up the Skill interpreter. Simply define a checking function that will issue hiRegTimer to call itself again in the future, and terminate when your asyncrhonous task is finished.

    hiRegTimer("someSkillCommand()" 100) ;This will run someSkillCommand in 10 seconds

    Define the someSkillCommand to do hiRegTimer unless your threaded job is complete.

     Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • gsimard
    gsimard over 16 years ago

     Yes I have just done that.

     This would work just fine, however, I really NEED a blocking function.

     The keypoint is that I want to use the optimizer, and run an extraction between each step. What I was intending to do is to add a dummy goal in the optimizer that would do the extraction, and that command would really need to block the execution of the optimizer until the extraction is complete.

    Right now I am thinking of just stepping the optimizer, from another function, then run the extraction, step the optimizer again, and so on, all that with a series of hiRegTimer calls.

    Any simpler solution that could let me use the optimizer's full abilities without stepping it "manually" via skill code would be better though

    EDIT: SorryAndrew I overlooked your second reply. The background "process" seems to require a communication with the SKILL interpreter at some key points, just for printing to the ICFB I think (I don't know the inner details of it though), which seems to be why it gets held if I have a function running.

    Guillaume

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    Guillaume,

    A couple of thoughts. Are you using sleep() or ipcSleep()? If you use ipcSleep, then I think that doesn't block the data handler for ipcBeginProcess() - if my memory is correct (I can't test this right now). sleep however blocks everything... So that might give you the right combination of blocking yet allowing messages from the background process through.

    As a side note, you might be interested in solution 11381132 (on sourcelink) which is a little package I wrote (based around hiRegTimer) which allows you to schedule repeating SKILL function calls, and provides you with a handle so you can manage these "processes" and kill them off when you want.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • gsimard
    gsimard over 16 years ago

     Well that ipcSleep function did exactly what I needed ! Blocking the top level execution but letting sub processes run.

     

    Thank you !

    • 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