要测试的设计是用VHDL编写的,它的端口使用这样的无约束记录:
type forward_stream is record
data : std_ulogic_vector;
-- further members
...
end record;这些端口现在应该从systemverilog驱动。有没有任何方法可以使用vhdl记录类型的测试台信号?如果是这样,我如何约束systemverilog中的记录?
还是必须创建一个VHDL包来约束记录并将其作为要在testbench中使用的类型提供?
由于HDL支持在不同的工具之间有很大的不同,我特别询问questasim (modelsim的大哥,也就是被认为有点向下兼容的同一个供应商)。
更新
我从Questa用户手册中收集了10.4的以下内容:
我试过:
样本代码:
VHDL:
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).
发布于 2016-10-21 17:40:58
是的,请参阅Questa手册中的共享用户定义类型。它展示了如何导入用一种语言定义的包,并在另一种语言中使用/导入它们。
https://stackoverflow.com/questions/40178418
复制相似问题