首页 文章

在Modelsim中使用SystemVerilog Testbench中的VHDL记录

提问于
浏览
2

我已经对此进行了研究,但我在其他网页上找到的示例已经断开了链接 . 我正在寻找一个如何将包中包含的自定义VHDL记录导入SystemVerilog Testbench的示例 .

我'm using modelsim, so I'已经读过我需要使用 -mixedsvvh 开关 . 我是否需要将此开关用于 vcomvlog 来电?另外,还有另一个开关 [b | s | v] ,当我使用 s 时,它给了我一个错误:

**错误:(vcom-1276)选项'-mixedsvvh'的参数不正确 .

当我不使用参数时,我尝试运行 vsim 并收到以下消息:

  • 导入包c:/Projects/source/work.test_pkg__mti__sv__equiv__implct__pack **错误:Test_Top_TB.sv(4):'t_Test'是未知类型 .

VHDL包:

library ieee;
use ieee.std_logic_1164.all;
package test_pkg is
  type t_Test is record
    DATA1 : std_logic_vector(15 downto 0);
    DV1   : std_logic;
    DATA2 : std_logic_vector(5 downto 0);
    DV2   : std_logic;
  end record t_Test;
end package test_pkg;

VHDL实体/架构:

library ieee;
use ieee.std_logic_1164.all;

library work;
use work.test_pkg.all;

entity Test_Top is
  port (
    i_Clk  : in  std_logic;
    i_Data : in  t_Test;
    o_Data : out t_Test
    );
end entity Test_Top;

architecture RTL of Test_Top is
begin
  process (i_Clk) is
  begin
    if rising_edge(i_Clk) then
      o_Data.DATA1 <= i_Data.DATA1;
      o_Data.DV1   <= i_Data.DV1;
      o_Data.DATA2 <= i_Data.DATA2;
      o_Data.DV2   <= i_Data.DV2;  
    end if;
  end process;
end architecture RTL;

SystemVerilog Testbench:

interface Test_IF();
  import test_pkg::*;

  t_Test Data;
endinterface // Test_IF

module Test_Top_TB ();
  import test_pkg::*;
  logic r_Clock;
  Test_IF hook();
  Test_IF hook2();
  Test_Top UUT 
    (.i_Clk(r_Clock),
     .i_Data(hook.Data),
     .o_Data(hook2.Data)
     );
endmodule

1 回答

  • 3

    尝试将 systemverilog testbench中的 t_Test 更改为小写,即 . t_test .

相关问题