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
我有一个基于verilog的测试平台,使用DPI连接到'C源代码。现在使用DPI我打算编写我的整个固件。要做到这一点,我需要3件事
- Register Read
- Register Write
- Interrupt handler As I understand, register reads and writes are tasks that I need to export from the RTL test-bench. And Interrupt handler (I implemented by importing a function from 'C).
中断处理程序据我所知,寄存器读写是我需要从RTL测试平台导出的任务。和中断处理程序(我通过从'C导入函数实现)。
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.
我检查了大多数cadence文档,发现没有有用的提示。我也在cadence用户社区注册,但似乎在他们批准我的注册之前我不能提出问题。
Just in case someone is aware of this, would appreciate their help.
万一有人意识到这一点,将不胜感激他们的帮助。
2 个解决方案
#1
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.
这适用于我使用ncverilog。
#2
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.
本文实际上是在DPI中导出寄存器读取和写入,然后添加一个TCL解释器,以便您可以使用TCL来控制您的SIM卡。这是实验室工作人员所喜爱的,因为他们的所有工具都已经在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.
您可以按照说明将整个DPI中从C到SV的函数调用集成,然后在TCL内容发挥作用时停止。
#1
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.
这适用于我使用ncverilog。
#2
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.
本文实际上是在DPI中导出寄存器读取和写入,然后添加一个TCL解释器,以便您可以使用TCL来控制您的SIM卡。这是实验室工作人员所喜爱的,因为他们的所有工具都已经在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.
您可以按照说明将整个DPI中从C到SV的函数调用集成,然后在TCL内容发挥作用时停止。