• 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. Reading and changing CIW input line

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 145
  • Views 19779
  • 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

Reading and changing CIW input line

PatrikOsgnach
PatrikOsgnach over 8 years ago

Hello,

are there any functions that allows me to know what is currently typed on the input line of CIW and change it, eventually? My goal is to write an autocompletion script.

As an example, if I type 'a' and press Ctrl+Up I want the input line to be substituted with the latest line that begins with an 'a' character.

Best regards,

Patrik

  • Cancel
  • Amit  Biswas
    Amit Biswas over 8 years ago
    Hi Pratik,
    If you can explain little more about what you are tying to do, probably I can suggest something.
    As of now, what I can think of is as follows

    1. write a function and set the bindkey to Ctrl+Up to CIW.
    2. read the CDS.log file in reverse order.
    3. You can use enterString to enter your input in CIW and store in a variable
    4. do a pattern match the way you want
    5. write into a new file.

    As I am not clear about what will be your next step, I am not sure what to do with the output you have.

    Thanks,
    Amit
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago

    Hello Amit,

    think about what happens in a shell if I bind the up key to "history-search-backward". I type a string and, when I press the up key, the shell tries to autocomplete it by looking in the history for commands that begin with that string. I want to replicate this behaviour in the CIW. Currently, if I press the up key in the CIW, it will scan all the commands in the history. So, I need a function that tells me what the user has typed so far in the input line of the CIW before pressing the enter key

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Amit  Biswas
    Amit Biswas over 8 years ago
    Hi Pratik,

    Here is a small code which might be helpful.
    Have a look

    CDSLOG = "/xxx/xxx/cdslog/CDS.log" ; cds log file path. you can give actual cds.log file path of yours.
    procedure(searchCommand(CDSLOG)
    prog((commandLists inport)
    system(sprintf(nil "cp -rf %s %s_temp" CDSLOG CDSLOG)) ; create a local copy of the cds log file as <old file name _temp>
    CDSLOG = strcat(CDSLOG "_temp")
    inport = infile(CDSLOG)
    while(gets(line inport)
    if(substring( car(parseString(line "\n")) 2 1) == "i" then ; to check the only lines which are typed or called in CIW
    commandLists = append1(commandLists substring( car(parseString(line "\n")) 4))
    );if
    );while
    close(inport)
    return(commandLists)
    );prog
    );procedure

    You can set the bindkey with UP arrow for the function searchCommand(CDSLOG)
    Finally, commandLists will return a list which will have all the commands which were entered in the CIW.
    Now you can play with this list
    1. You can create a gui to pop up the list of the commands
    2. You can limit the length of the list
    3. You can filter some of the commands according to your requirement
    4. You can reverse the list
    .
    .
    .
    Hope it will help you.

    Thanks,
    Amit
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 8 years ago
    Hi Patrik,
    There are two things that already exist that are close to what you are asking for, but it may depend on which version you are using. ALWAYS STATE THE VERSION YOU ARE USING.

    Try this in the CIW:
    envGetVal("ui" "ciwNameCompletion")
    If it returns "Off" then you have a version that has automatic command completion built-in but turned off. You can try either "Automatic" or "Manual" to test the feature. For automatic, when you start typing in the CIW a pop-up box will display with possible matches, functions are shown in blue (by default) and you can scroll through the matches. For Manual mode the Ctrl-Space key combination (by default) will open the search matches box. You can use 'envSetVal("ui" "ciwNameCompletion" 'cyclic "Manual")' or 'envSetVal("ui" "ciwNameCompletion" 'cyclic "Automatic")' to turn on the feature if it is available in your version (I can't remember when it was added, sorry). The search finds even custom functions that you have created yourself, including those that just have autoloads set but the function is not loaded yet. Look for the variables that control this in the 'ui' .cdsenv file:

    more `cds_root virtuoso`/tools/dfII/etc/tools/ui/.cdsenv

    The CIW also has a history mechanism built-in and it has been around for years, but you had to turn it on in older versions, but I think it is just on by default now (since at least IC61x?). For example, in combination with the above, you could now try typing "!env" and hit return, and the most recent matching command will execute, in this case it would be the envGetVal() command. There is a section "Repeating Commands from the CIW" in the documentation about it, Virtuoso Design Environment User Guide->Using the Command Interpreter Window->Working With SKILL Commands->Repeating Commands from the CIW.

    Try these out and save yourself some coding!

    Best regards,

    Lawrence.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago

    Hello Amit,

    thank you, but this tells me the commands that were already executed. It it part of what I need but I need to autocomplete commands while the user is typing them

    BR,

    Patrik

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago

    Hello Lawrence,

    I didn't want to state the version because here we are using many versions and I want to implement a general solution. envGetVal("ui" "ciwNameCompletion") says *WARNING* envGetVal: Could not find variable 'ciwNameCompletion' in tool[.partition] 'ui' with versopm 6.1.6-64b.500.13.2 but it esists in version 6.1.7-64b.500.7
    It is a nice feature but it does not searches among the commands I typed in this session.
    As an example of what I want, let's say that I typed these three commands

    b=1
    bc=4
    a=3
    b=2

    now, if I type b= and press ctrl-space, I want only b=1 and b=2 to be displayed

    !pattern is also nice, but it searches only for the last command

    BR,

    Patrik

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 8 years ago
    Hi Patrik,

    Did you look at the documentation at all? There is a syntax of "!?pattern" too. But yes, it searches backwards for the most recent entry that matches, so in your example "!b" would repeat the "b=2" entry. I'm sure this is a contrived example, and so in real life the use of the !? syntax could be quite useful. As I said initially, these two features are close to what you were asking for.

    Regards,
    Lawrence.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago
    Hello Lawrence,

    yes I did look at the documentation, but I asked because none of those features implement what I really need. The example I wrote is not contrived, is something I do countless times every day. Let's say that I need to re-type a command that begins with a b character. It might not be the last one, but the 10th last (among the commands that begin with a b) and in between there may be many unrelated commands. Scrolling them with the up key is time consuming.

    Bottom line, I need two functions: one that return what is currently written on the input line (before the user presses the enter key) and one that allows me to replace the input line with a string, regardless of what the user has written so fare.

    BR,
    Patrik
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 8 years ago
    Hi Patrik,

    Take a look at "history()" - it lists the previous n commands, so then you can do !number to repeat a numbered command. Hopefully this gets you closer to what you need?

    Best regards,

    Lawrence.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago
    Hello Lawrence,

    It helps, but it lacks a "search" feature. Maybe there is no function to do what I want to do...

    BR,
    Patrik
    • 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