Typically in order to debug any CPU based C-tests, we depend on the tarmac logs → check for the execution PC numbers etc. which is slightly cumbersome or so.
But is there any way where we can directly use the printf based debug prints inside the C-test, use some SV-DPI based functions or approach to pass on the debug prints from C-test [which is getting executed in the actual CPU RTL] to the SV side and print in the log files ?
If there are any best practices / methods etc. to be done for this flow, please provide the comments !
Thanks for taking time and responding. But I am using ARM suite exec to compile my c-tests [and not regular gcc] and as expected I get the following error as shown below.
Error: L6218E: Undefined symbol vpi_printf (referred from abc_ctest.o).
Do I need to include any standard libraries ? vpi_user.h ?
Also Is there any performance hit/cycle time loss because of using vpi_printf ?
Also do I need to use the default GCC compiler ? or even the ARM provided suiteexec is fine ?
Sorry, I misread your original question. You are compiling this C code to run on your simulated DUT. You would need to create a virtual I/O device and have your C code write data to its address. Then you could display the data as a message.
You need to understand the difference between C code running on the CPU in the DUT in simulation versus C code running on the host CPU executing the simulation. The CPU on the DUT is basically a giant state machine and the C code gets compiled into a binary memory image. That’s completely disconnnected from the CPU running the simulation. So there is no ability to make calls to the OS.