I am working on a verification project. Certain testbench components are written in c which are called via DPI, the c routines are extensive and i am having difficult time in figuring out which routine is called by whom. A pure C program may be I could use cachegrind for this task. In this case it is not a main() which is doing the call but are triggered on events. Any method by which i could get an idea of the sequence of calls being done during simulation? Cadence Incisive tool is used.
Can I get a call graph of C routines which are called via a DPI call from a system verilog testbench
Asked
Active
Viewed 174 times
2 Answers
0
log the caller and log the callee with an accurate timestamp, then compare

Shlomi Agiv
- 1,183
- 7
- 17
-
Could you please elaborate on your solution? By logging do you mean put a display/ print statements in each of the C functions? I do not want to go and hack the C component unless it is the only way. – Gautam Apr 13 '15 at 13:46
-
If it's easier to change the system verilog files, you can the DPI calls to log the function called before running it – Shlomi Agiv Apr 13 '15 at 14:01
-
The way C component is set up is it creates a data structure initially which last the entire simulation time. Functions are called via dpi based on event and each function may itself call a number of other functions to update/ create data structures. As i mentioned the component is extensive. A single dpi call leads to number of C function calls so If what you say is the way to do then i will have to put a print in all the function/ class constructors etc, this i am hoping to avoid. – Gautam Apr 13 '15 at 14:21
0
Google's "gperftools" will give you a callgraph for performance hotspots and if you set the threshold for data collection low enough, you'll get as much detail as you can handle:
You can also instruct it to focus on specific functions when it generates the graphviz graph in order to hone in on specific code paths. I've personally used google perftools on a chip's testbench. Works like a champ.

Ross Rogers
- 23,523
- 27
- 108
- 164