我正在尝试创建一个可以连接到VHDL字符串的SystemVerilog模块 . 但是,我在SystemVerilog中找不到相应的类型 . 使用类型“string”会导致Questa中的精化错误 .
VHDL代码:
library IEEE;
use IEEE.std_logic_1164.all;
entity tb_serdes_support is
end entity;
architecture beh of tb_serdes_support is
component serdes_support is port (
cmd : in string
);
end component;
signal cmd : string(1 to 100);
begin
i_srds_support: serdes_support port map (
cmd => cmd
);
process
begin
cmd(1 to 12) <= "hello world!";
wait for 10 ns;
cmd(1 to 18) <= "hello world again!";
wait;
end process;
end architecture;
SV代码:
module serdes_support (cmd);
import uvm_pkg::*;
input string cmd;
always_comb begin
$display(cmd);
end
endmodule
编辑:错误消息(Questa):
**错误:(vsim-3059)无法将VHDL阵列信号连接到Verilog标量端口'cmd' .
2 回答
您可以在适当的“位向量”中转换VHDL字符串,并在Verilog环境中使用此“位向量” . 在Verilog中你可以解释它然后你想要的例如与%s .
mov_vhd.vhd:
mod_ver.sv:
top_vhd.vhd
VHDL中的
string
是固定大小的数组,而在SystemVerilog中,它是具有可变大小的单数类型 . 您可能需要将VHDL字符串转换为SystemVerilog中的字节数组 .