arraysoutputvhdlseven-segment-display

(VHDL) I'm Receiving an Error When Trying to Output from an Array


I'm trying to output data inside an array to the 7-segment display on my DE1-SoC board.

Here are my variables:

display : out std_logic_vector (6 downto 0);

type bigDisplay is array (0 to 4, 0 to 6) of bit;

signal displayArray : bigDisplay;

Here is the code:

display <= displayArray (0, 6-0);

This is the error I receive:

Error (10381): VHDL Type Mismatch error at Final_Project.vhd(326): indexed name returns a value whose type does not match "std_logic_vector", the type of the target expression

So, I'm guessing I need to convert my bit array to output to the std_logic_vector? How should I do this?


Solution

  • Any particular reason for using bit? You can just as easily create an array of std_logic_vector:

    type bigDisplay is array(0 to 4) of std_logic_vector(6 downto 0);
    signal displayArray : bigDisplay;
    

    Then simply (after initializing displayArray with values, of course):

    display <= displayArray(0);
    

    Etc, or whatever index you desire, in order to assign values from your array to the display.