哪个SystemVerilog构造对应于VHDL字符串?

哪个SystemVerilog构造对应于VHDL字符串?,vhdl,system-verilog,questasim,Vhdl,System Verilog,Questasim,我正在尝试创建一个SystemVerilog模块,可以连接到VHDL字符串。但是,我在SystemVerilog中找不到相应的类型。在Questa中使用类型“string”会导致细化错误 VHDL代码: library IEEE; use IEEE.std_logic_1164.all; entity tb_serdes_support is end entity; architecture beh of tb_serdes_support is component

我正在尝试创建一个SystemVerilog模块,可以连接到VHDL字符串。但是,我在SystemVerilog中找不到相应的类型。在Questa中使用类型“string”会导致细化错误

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;
编辑:错误消息(Questa):

**错误:(vsim-3059)无法将VHDL阵列信号连接到Verilog标量端口“cmd”


VHDL中的
string
是固定大小的数组,而在SystemVerilog中,它是具有可变大小的单一类型。您可能需要在SystemVerilog中将VHDL字符串转换为字节数组

您可以将VHDL字符串转换为适当的“位向量”,并在Verilog环境中使用此“位向量”。在Verilog中,您可以根据需要对其进行解释,例如使用%s

mov_vhd.vhd:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY mod_vhd IS
    PORT
        (
            clk : IN std_ulogic;
            str_out : OUT string
        );
END ENTITY mod_vhd;

ARCHITECTURE sim OF mod_vhd IS

BEGIN

    clock_out_string: PROCESS IS


    BEGIN
        FOR i IN 0 TO 9 loop
            WAIT UNTIL rising_edge(clk);
            str_out <= "Hallo    "&integer'IMAGE(i);
        END LOOP;

    END PROCESS clock_out_string;

END ARCHITECTURE sim;
top_vhd.vhd

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY top_vhd IS
END ENTITY top_vhd;

ARCHITECTURE sim OF top_vhd IS

SIGNAL clk: std_ulogic := '0';
SIGNAL str_out : string (1 TO 10);
SIGNAL str_out_ver : std_logic_vector (79 DOWNTO 0);

BEGIN

    clk <= NOT clk AFTER 10 ns;

    mod_vhd_i: ENTITY work.mod_vhd
        PORT MAP (
            clk     => clk,
            str_out => str_out
        );

    gen_vec: for i in str_out'range generate
        str_out_ver((11-i)*8-1 downto (11-i)*8-8) <= std_logic_vector(to_unsigned(character'pos(str_out(i)), 8));
    end generate;    

    mod_ver_i: ENTITY work.mod_ver
        PORT MAP (
            my_string => str_out_ver
        );


END ARCHITECTURE sim;
ieee库;
使用ieee.std_logic_1164.ALL;
使用ieee.numeric_std.ALL;
实体顶部的vhd是
结束实体顶部的vhd;
top_vhd的架构sim为
信号时钟:标准逻辑:='0';
信号串输出:串(1至10);
信号STRU out版本:标准逻辑向量(79向下至0);
开始
clk clk,
str_out=>str_out
);
gen_vec:for i in str_out'range生成

stru out ver((11-i)*8-1 down to(11-i)*8-8)我正准备引用你的回答
module mod_ver (
    input [79:0] my_string
);

initial begin
   forever @my_string
      $display ("see %s",my_string);
end


endmodule // mod_ver
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY top_vhd IS
END ENTITY top_vhd;

ARCHITECTURE sim OF top_vhd IS

SIGNAL clk: std_ulogic := '0';
SIGNAL str_out : string (1 TO 10);
SIGNAL str_out_ver : std_logic_vector (79 DOWNTO 0);

BEGIN

    clk <= NOT clk AFTER 10 ns;

    mod_vhd_i: ENTITY work.mod_vhd
        PORT MAP (
            clk     => clk,
            str_out => str_out
        );

    gen_vec: for i in str_out'range generate
        str_out_ver((11-i)*8-1 downto (11-i)*8-8) <= std_logic_vector(to_unsigned(character'pos(str_out(i)), 8));
    end generate;    

    mod_ver_i: ENTITY work.mod_ver
        PORT MAP (
            my_string => str_out_ver
        );


END ARCHITECTURE sim;