Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
226 views
in Technique[技术] by (71.8m points)

ghdl - VHDL getting a std_logic_vector out of an array of std_logic_vector

I have a Problem. I have an array of std_logic_vector and I input a value unsinged(3 downto 0) and I want to use value as the Index of the array.

So far so good but I should get a std_logic_vector out of the array and put in the Output segments (which is also a std_logic_vector with the same size) but I get the error:

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

here is my Code:

> 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;

Does anyone know how to fix this problem ? Thanks!

question from:https://stackoverflow.com/questions/65908821/vhdl-getting-a-std-logic-vector-out-of-an-array-of-std-logic-vector

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...