使用DPI将任务导出到"C"

Alp*_*neo 6 hardware verification verilog system-verilog system-verilog-dpi

我有一个基于verilog的测试平台,使用DPI连接到'C源代码.现在使用DPI我打算编写我的整个固件.要做到这一点,我需要3件事

  • 注册阅读
  • 注册写
  • 中断处理程序据我所知,寄存器读写是我需要从RTL测试平台导出的任务.和中断处理程序(我通过从'C导入函数实现).

我检查了大多数cadence文档,发现没有有用的提示.我还注册了cadence用户社区,但似乎在他们批准我的注册之前我不能提出问题.

万一有人意识到这一点,将不胜感激他们的帮助.

Alp*_*neo 3

其实我想出了这样的事情。

//--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 ();
Run Code Online (Sandbox Code Playgroud)

这对我使用 ncverilog 有用。