首页 > 解决方案 > VHDL 从 std_logic_vector 数组中获取 std_logic_vector

问题描述

我有个问题。我有一个arrayofstd_logic_vector并且我输入 avalue unsinged(3 downto 0)并且我想使用 value 作为array.

到目前为止一切顺利,但我应该std_logic_vector退出array并放入输出segments(也是std_logic_vector相同大小的),但我收到错误:

> can't match type conversion with type array type "std_logic_vector"

这是我的代码:

> library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;

entity getarrayvalue is
port(
        value : in unsigned(3 downto 0);
        clk : in std_logic;
        segments : out std_logic_vector(6 downto 0)
    );
end entity;

architecture v1 of getarrayvalue is
    type rom_type is array(0 to 9) of std_logic_vector(6 downto 0);
    signal rom: rom_type :=("1111110","0110000","1101101","1111001","0110011","1011011","1011111","1110000","1111111","1111011");
    signal val_i: integer;

    val_i <= to_integer(value); 

    process(clk)
    begin
        if rising_edge(clk) then
            segments <= rom_type(val_i);
        end if;
    end process;

end architecture;

有谁知道如何解决这个问题?谢谢!

标签: vhdlghdl

解决方案


推荐阅读