【问题标题】:DPI-C export of a task defined inside a SystemVerilog class在 SystemVerilog 类中定义的任务的 DPI-C 导出
【发布时间】:2021-01-27 01:21:52
【问题描述】:

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

class packet_bfm_t;
    int id = 0;

    export "DPI-C" task send; // Is this possible and legal to call from C code?

    function new (int my_id = 0);
      id = my_id;
    endfunction : new

    task send (int data);
      #1ns;
      $display ("data = %h", data);
    endtask : send

endclass : packet_bfm_t

【问题讨论】:

    标签: system-verilog system-verilog-dpi


    【解决方案1】:

    DPI 不允许导出类方法。与从 C 调用 C++ 类方法相同的问题。您必须定义和导出使用 Id 或在表中查找类对象所需的任何东西的非类任务包装器。您可以在该类对象上调用方法。

    【讨论】:

      猜你喜欢
      • 2010-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多