• 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. Set UNIX environment variable through in Cadence environment...

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 143
  • Views 28134
  • 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

Set UNIX environment variable through in Cadence environment through skill

rajs
rajs over 9 years ago

Cadence version using=IC616.

Hi ,

I have two questions which i have listed below

a)Not able to set PVDIR variable in unix through skill command.

system("setenv PVDIR /home/data/")

error message in unix terminal: sh: setenv: command not found

b)I want to streamout the gds and then execute skill code sequentially, if the error not exist in streamout or else terminate with error message.

   1)How to wait till streamout is done & How to check for error message. There is a user defined function "xstOutOnCompletion()", How to use 

         along with procedure.

envSetVal("xstream" "xstShowCompletionMsgBox" 'boolean nil)

xstSetField("library" libname)
xstSetField("topCell" cellname)
xstSetField("strmFile" strcat(cellname ".gds"))
xstSetField("attachTechFileOfLib" "tsmc90_tech")
xstSetField("view" "layout")
xstSetField("runDir" path)
xstSetField("summaryFile" "strmOut.sum")
xstSetField("virtualMemory" "true")
xstSetField("logFile" "strmOut.log")
xstOutDoTranslate()

 

Thanks,

rajs

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    The first approach wouldn't work for two reasons. First of all "setenv" is a "csh" command, not a "sh" command. Anyway, even if that had worked or you'd use an appropriate command ("export VAR=value", say), then this would not have helped because it environment variables are only inherited in child processes, not in the parent process. What you want to use is setShellEnvVar("VAR=value").

    The documentation explains how to write xstOutOnCompletion - and even gives an example. You don't wait for it to return - instead, you have a callback that is triggered when it completes and this callback receives the status information. You can then do any subsequent actions  you need from within your xstOutOnCompletion definition.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • rajs
    rajs over 9 years ago
    Thanks Andrew for your response. I loaded this one setShellEnvVar("VAR=value") in my virtuoso environment and checked in unix environment i dont see any value set in unix, but i can see value has been set in virtuoso environment. i think as you mentioned earlier variables inherited from child process.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    If you're checking in the UNIX terminal that you launched Virtuoso from, then you wouldn't see it - because environment variables are not passed back to the parent. If in virtuoso you did:

    system("xterm &")

    then in the resulting terminal that appears, you should see the value you set using SKILL - because this is then a child of the virtuoso process and inherits its environment

    That's how UNIX environment variables work!

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • rajs
    rajs over 9 years ago
    Thanks Andrew, appreciate your help .
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • rajs
    rajs over 9 years ago
    Andrew, Is there any way to access the terminal which i launched through system("xterm &") and run things on this xterm. Thanks,Harsha
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    No. There may be other ways of opening a window which shows the output of a sequence of commands - via ipcBeginProcess somehow, but not doing exactly this. I don't really understand what you're hoping to do as it sounds a bit peculiar.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • rajs
    rajs over 9 years ago

    Andrew,

    1)The scenario is after gds export , I want to fire drc,lvs parallely. In current scenario, the terminal on which  i launched virtuoso, will be used anyone by drc or lvs. Correct me if i am wrong.

    2)One more question related to streamin,

    virtuoso running in replay mode.After stream in the gds by creating new library in skill code,  i am exiting virtuoso with exit command(exit()) in my script file. A pop up window of "save all" is coming which blocks further execution and needs user intervention. Could you please help me out how to save and proceed to next line without user intervention.

    Thanks,

    Harsha

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

    Harsha,

    For the first question, I don't know what you mean. You can run DRC and LVS in parallel, but I don't see what this has to do with the terminal you launched virtuoso from or how that relates to wanting to run commands in a terminal that you've launched. 

    For the second one, you could solve that by running some code which finds all things that needs saving and saves them. I'm not sure why you'd have unsaved items after a stream in, but perhaps you're doing some other manipulation in your code. If you are, you should remember to do dbSave() on each cellView when you've done.

    You could do something like this:

    (foreach cv (abGetModifiedCellViews) (dbSave cv))

    where abGetModifiedCellViews is this:

    /***************************************************************
    *                                                              *
    *                   (abGetModifiedCellViews)                   *
    *                                                              *
    *               Find all the modified cell views               *
    *                                                              *
    *    Note that this uses a couple of db calls which aren't     *
    *                        in the manual                         *
    *                                                              *
    ***************************************************************/
    
    (procedure (abGetModifiedCellViews)
      (let (cellViews)
           (foreach cellView (dbGetOpenCellViews)
                    (when (and
                           (dbIsCellViewModified cellView) 
                           /* cell can appear modified, even if read only (why?) */
                           (or 
                            (equal (dbGetq cellView mode) "a")
                            (equal (dbGetq cellView mode) "w")))
                          (setq cellViews (cons cellView cellViews))))
           cellViews))

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • rajs
    rajs over 9 years ago

    Hi Andrew,

    Was waiting for your answer. Thanks for answering.

    For the first question, I will explain the scenario where i work. If i use any command like system("ls") then this command executes on the terminal where virtuoso has been launched. .So If i launch a calibre drc command it runs on the terminal on which virtuoso has been launched. (As of now no lsf). So If i launch lvs & drc, whichever is first lauched will start running on virtuoso launched terminal. Please let me know If i could able to explain you and make you understand. Basically what i am trying to say is whichever terminal virtuoso has been launched that terminal will be considered for running any unix or calibre command.

    Regarding your second answer i tried to save opening each and every cell  in lib and using dbsave. It didnt work . But yes i will give a try on what you have coded and check it now. after streamin i am just checking for error message exist in streamin or not and exit the virtuoso. So looks like before exit this window pops up saying all "save cellview" and enabled the library name on which i imported.

    I am sharing my code here.

    dbCreateLib(libname libpath)
    libid=ddGetObj(libname)
    techBindTechFile(libid tech)

    ;;;;;;;;;;;;;;;;;;STREAMIN THE GDS;;;;;;;;;;;;;;;;;;;;

    envSetVal("xstream" "xstShowCompletionMsgBox" 'boolean nil)
    xstInSetField("library" libname)
    xstInSetField("strmFile" apr_gdspath)
    xstInSetField("attachTechFileOfLib" tech)
    xstInSetField("summaryFile" "strmIn.sum")
    xstInSetField("logFile" "strmIn.log")
    xstInSetField("refLibList" reflib)
    xstInSetField("propMap" "XST_AUTO_PM")
    xstInSetField("detectVias" "true")
    xstInSetField("virtualMemory" "true")
    stat=xstInDoTranslate()

    if(stat then
    err_msg="grep -i 'error(s)' strmIn.log | cut -f5 -d ' ' | tr -d \\'"
    warn_msg1="grep -i 'error(s)' strmIn.log | cut -f8 -d ' ' | tr -d \\'"
    cid=ipcBeginProcess(err_msg)
    ipcWait(cid)
    er=ipcReadProcess(cid)
    cid=ipcBeginProcess(warn_msg1)
    ipcWait(cid)
    wn=ipcReadProcess(cid)
    while(rexMatchp("\\([^\n]*\\)\n\\([^\n]*\\)" er) er=rexSubstitute("\\1\\2"))
    if(er!="0" then
    printf("Error exist in gdsin")
    system("echo Error exist in gdsin")
    else
    printf("%s %s" "No errors in gds & warnings" wn)
    system("echo No errors in gds")
    )
    exit()
    )
    )

    Thanks,

    Harsha

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

    It's not "using the terminal" - but if you use system() then any standard output that is written will appear on the standard output for virtuoso - which appears in the terminal you started virtuoso in.

    You could use system("xterm -e /some/command &") but then the window would close as soon as it exited. Or you could use ipcBeginProcess or ipcBatchProcess and then show a log window.

    I suspect your issue with it needing saving may be because you have told it to run with virtualMemory true. Without that, it would run in a background process and then definitely save afterwards.

    Regards,

    Andrew

    • 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