Recently, while at a customer site, I was faced with the huge task of looking for all instances of a specific module to find a particular signal assignment. My first thought was to do a grep search, and then go through each file to see where that particular assignment occurred. This seemed easy enough in theory, so I set out to do it. What I was not prepared for was:
- Not knowing where the source files were actually located in the customer’s file system
- Not knowing whether or not all the relevant files would be visible and accessible, or even if some extra/backup files would be shown
To work around the first issue, I looked through the log files and tried to search for all the directories listed in the files. I quickly realized that I would not make any progress this way, and instead decided to use grep at the top-most directory. Imagine my shock when I saw hundreds of entries for this module! It seemed that the user had created a few copies of the files for backup, and now I had the tedious task of filtering through them all.
Design File Search
Fortunately, the Incisive verification platform has a feature called Design File Search, which is included in the SimVision analysis environment, that makes this job much easier.
Using Design File Search, you can limit your search to the files that make up the design, so you don’t have to worry about extra copies lying around. Also, you don’t need to know the directories of these files beforehand. This also lets you open the file in the SimVision Source Browser, thus enabling you to set breakpoints as well.
To search for a string in all of the source files that make up a design, including any simulator TCL scripts specified at startup with the -input option, do the following:
- From any SimVision window, choose Windows - Tools - Design File Search, or right-click and choose Send to Design File Search. When you do this, SimVision opens the Design File Search form.
- Enter a grep-style search string in the Regular expression search field of the form
- Enable Case sensitive, if you want the search to match the case of the text string
- In the Match files with pattern field, enter a glob-style pattern representing a file name, or partial name, to limit the search to a specific file, or set of files. You can specify more than one pattern, separated by spaces, and SimVision matches both patterns. For example, if you specify *.sv *.v *.vhd, SimVision returns all files with the .sv, .v or .vhd file extension.
- Click Search, and SimVision returns the file name, line number, and text that matches the search string
- Click a row in the results list to display the file in a Source Browser window, with a blue pointer positioned at the line number
The following figures show the difference in the results for a small example when I used grep to search for the string ahb_monitor and when I used the SimVision Design File Search function.
Figure 1 shows the output of the search using grep. It shows all text matches, be it in backup folders or logs.
Figure 1: Output of the Search Using grep .
Figure 2 shows the output of the search using Design File Search. It shows only the files that make up the design.
Figure 2: Output of the Search Using Design File Search.
Clicking on any occurrence of the search string opens the relevant file in the Source Browser, as shown in Figure 3. Note the blue pointer positioned at the line number, in Figure 3.
Figure 3: The Relevant File Opened in the Source Browser
Limitations
As far as limitations go, when you open a source file in this way, the file has no context within the design. Therefore, you cannot view the values of objects or expand macros in the source file.
Summary
I once had a customer searching through a lot of files for a particular string. His intention was to do a grep search followed by a series of filters to remove all log files, unwanted directories, and so on. Our interaction went something like this:
Me: Hey, why don’t you try the Design File Search in SimVision?
Customer: What’s that?
Me: Let me show it to you.
(I proceeded to show him how it made searching much easier and productive).
Customer: Hey, that’s fantastic! How come we never knew of this?
Since then, I’ve seen not just this customer, but many more people use SimVsion Design File Search to make searching through complex designs an easy task.
This feature is not commonly known (for reasons I can’t fathom) but has definitely proven useful, not only to me but to all the customers I’ve shown it to and is definitely one of the hidden gems of the Incisive platform.
More information on the SimVision Source Browser and its tools and capabilities, can be found in the document named SimVision: Using the Source Browser, which is accessible in the Cadence Help Online Library (cdnshelp) and on Cadence Online Support (COS).
Swati Ramachandran