I have an verilog based test-bench, interfaced to 'C source using DPI. Now using DPI I am planning to write my whole firmware. To do this I need 3 things
I checked most the cadence documentation and found no useful hints. I have also registered with cadence users community but it seems that I cannot ask question till they approve my registration.
Just in case someone is aware of this, would appreciate their help.
Actually I figured it out something like this.
//--From RTL ---
export "DPI" task reg_read;
task reg_read;
input int nAddr;
output int nVal;
// -- read implementation --
endtask
// -- From C code
extern void reg_read (int nAddr, int *pVal);
void test_read (void)
{
int nRegVal;
// Dummy checking !!
reg_read (0x100, &nRegVal);
}
// -- Again in RTL --
import "DPI" context task test_read ();
This works for me using ncverilog.
Cool...I actually wrote an article on this topic. link
The paper is actually exporting register reads and writes and stuff across the DPI and then adding a TCL interpreter to it so that you can use TCL to control your sim. This was something the lab dudes loved since all their tools are already in Tcl.
You can just follow the instructions to integrate your function calls from C to SV across the DPI, and then stop when the TCL stuff comes into play.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With