要测试的设计是用 VHDL 编写的,并在其端口中使用如下不受约束的记录:
type forward_stream is record
data : std_ulogic_vector;
-- further members
...
end record;
这些端口现在应该由 systemverilog 测试平台驱动。有什么方法可以将 vhdl 记录类型用于测试台信号?如果是这样,我如何限制 systemverilog 中的记录?
或者我是否必须创建一个 VHDL 包来约束记录并将其作为要在测试台中使用的类型提供?
由于工具之间的 HDL 支持差异很大,我特别问的是 questasim(modelsim 的老大哥,同一供应商,所以据说有点向下兼容)。
更新
我从 10.4 的 Questa SIM 用户手册中收集了以下内容:
- 记录映射到结构/打包结构(表 9-5)
- 表 9-5 中未提及亚型
我试过了:
- 使用系统 verilog 中的子类型连接到无约束类型的端口
- 使用系统verilog中的子类型连接到具有约束的无约束类型的端口
- 使用系统 verilog 中的子类型连接到子类型的端口
- 使用系统verilog中的无约束类型(无约束)连接到具有约束的无约束类型的端口。
示例代码:
高密度脂蛋白:
library IEEE;
use IEEE.std_logic_1164.all;
package module_crosslanguage_pkg is
type t is record
s : std_ulogic_vector(2 downto 0);
c : std_logic_vector;
end record;
subtype t_s is t(c(1 downto 0));
end package;
use work.module_crosslanguage_pkg.all;
entity dummy_test is
port(a : in t); -- 1.
port(a : in t(c(1 downto 0))); -- 2.
port(a : in t_s); -- 3.
port(a : in t(c(1 downto 0))); -- 4.
end entity;
architecture a of dummy_test is
begin
end;
系统 Verilog
module modulebay_testbench();
import module_crosslanguage_pkg::*;
t_s testsignal;
t testsignal2;
dummy_test u(.a(testsignal)); -- 1., 2., 3.
dummy_test u(.a(testsignal2)); -- 4.
endmodule;
错误总是Fatal: (vsim-3362) The type of VHDL port 'a' is invalid for Verilog connection (1st connection).