问题标签 [system-verilog-dpi]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
715 浏览

system-verilog - 是否可以使用带有 DPI 的打包结构

假设我有一个打包的结构:

我想将它传递给 C 函数:

如何读取 C 端的值?:

0 投票
1 回答
466 浏览

system-verilog - UVM DPI-C 功能导入

有人可以告诉我为什么我们需要 DPI-C 函数导入来执行 UVM 特定功能,比如uvm_hdl_force甚至uvm_hdl_deposit当存在强制和存款系统 verilog 构造时?C 函数在这些方面提供了哪些额外的灵活性?

提前致谢

0 投票
1 回答
1387 浏览

system-verilog - Detect timescale in System Verilog

How do I detect the timescale precision used in a simulation from the source code ?. Consider I have a configuration parameter(cfg_delay_i) of some delay value given by user in timeunits as fs .If the user gives 1000 , my code has to wait 1000fs or 1ps before executing further.

If the timescale precision is 1fs ,there won’t be any problem but if the precision is higher than that it won’t wait and it will work as 0 delay . So I want to write a code which will determine the timescale used by the user and give the delay accordingly.My expected pseudo-code will be like below,

Please help me with the logic to determine the timescale unit and precision internally.

0 投票
1 回答
279 浏览

verilog - System Verilog DPI Checker 屏蔽 128 位值

我正在编写一个 DPI 检查器(.cpp 文件),在此,检查器读取每一行的 128 位值,我想用 128 位掩码对其进行屏蔽并将其与 RTL 值进行比较,但我看到的问题是我从中创建掩码的数据类型仅包含 32 位值,我需要对原始数据进行按位与运算。任何人都可以提供任何建议吗?

这里svBitVecVal最多只能保存 32bit 的值。data_masked如果掩码超过 32 位,则不会显示正确的值。

0 投票
2 回答
933 浏览

gcc - DPI-C and SystemVerilog External Compilation flow issue

ModelSim User's manual (v10.1c), in page 660, talks about the default autocompile flow (using vlog) and external compilation flow to get the the DPI-C to work in ModelSim. I'm able to get the auto-compile flow to work. I'm stuck with the external compilation flow.

Problem Summary: I get an "undefined reference" error in when I try to create the .dll file in-spite of using the right export and import statements in my system verilog file.

Here are the files that make up this project:

file 1: mytest.cpp

file 2: experiment3.h

file 3: mytb.sv

Here are the command that I am using:

Most of the online DPI-C examples deal with running (CPP and .SV) everything in ModelSim. I don't want that. I want to keep the HW and SW flow separate. And, this separation does work to some extent (I have no issues with calling C functions from SV (import works fine). The roadblock is with trying to call SystemVerilog function from the C function (something seems to be wrong with the export).

Any thoughts on how I can get past this hurdle ?

0 投票
1 回答
1359 浏览

verilog - 如何在verilog中将2个端口(输入)连接到同一根线

按名称实例化以下连接端口的模块。模块的输出要接S线,B口要接T线,C口也要接T线。

我的模块(输出A,输入B,输入C);

我该如何为此编写 Verilog 代码?

0 投票
1 回答
292 浏览

system-verilog - 在 SystemVerilog 类中定义的任务的 DPI-C 导出

是否可以将 SystemVerilog 类中定义的任务导出到 C,如下所示?

0 投票
1 回答
157 浏览

c++ - 如何使用 SV-DPI 将数据从 C/C++ 数组复制到整个 SV 数组?

我希望来自 SystemVerilog 的数据数组具有来自 C/C++ 端数组的完整数据副本:

C/C++ 代码:

SV 代码:

我的问题是我每次都不知道源数组的确切大小。此外,即使每次都是固定大小,我会想象对于大型数组来说,拥有一长串索引参数将是多余的。其他 SV-DPI 处理程序函数似乎不适用于我的案例,或者我一定误解了它们的使用方式。

0 投票
0 回答
99 浏览

system-verilog - DPI 的 printf 重定向

在 SystemVerilog 中使用 DPI 时,我遇到了将 C 端的标准输出重定向到 SystemVerilog 的标准输出以将所有日志写入集中在一个位置的问题(在我的情况下,来自 C 的 printf 显示在终端中,但似乎没有出现在来自 EDA 的日志文件中)。

我知道 100% 有效的解决方案是从 SV 端导出函数并在 C 中使用它来打印,但在我看来它并不聪明。

我尝试使用某种重定向,使用重新打开函数来更改地址 stdout var 指向的地址(据我所知,stdout 它是程序写入的地址),但最终它将所有登录重定向到这个标准输出,包括 SystemVerilog 日志。

将所有日志保存在一个流中的更好方法是什么?

也许有办法让 C 知道 IDE 标准输出?

0 投票
0 回答
80 浏览

c++ - 使用外部函数中的变量名

所以我们有一些从另一种语言 (DPI-C) 调用的 C 外部函数。下面的这个函数简单地返回我们拥有的一些 C++ 队列的大小(它们是全局变量)。它工作正常。

对于特定队列,我们​​选择队列为 0、1、2。这因不同的程序而异,维护起来很头疼。我们希望用一个返回实际变量名称的字符串来索引每个队列。理想情况下,我们可能会将这些名称推送到某种列表中,这样我们就可以让函数查看变量是否在列表中。

有没有人对如何在这方面实现更可维护的东西有任何指示?

理想的函数头/伪代码