Altera_Forum
Honored Contributor
12 years agoInteger as an array.
I am using an integer to count pulses and then need to give it to an 7 Segment display.
Can I use the Integer variable as an array directly , and read each place's value ? The highlighted statement gives an error. ----------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.numeric_std.all; entity newcounter is Port ( clk : in std_logic; HEX0,HEX2, HEX1: out std_logic_vector(6 downto 0):= "1111110" ); end entity; architecture Behavioral of newcounter is signal temp0,temp1,temp2: integer :=0; begin process (clk) is type seven_seg is array ( 0 to 9 ) of std_logic_vector ( 6 downto 0 ); constant decode : seven_seg := ( "1000000" , "1111001" , "0100100" , "0110000" , "0011001" , "0010010" , "0000010" , "1111000" , "0000000" , "0010000" ); variable count: integer:=0; begin if rising_edge(clk) then count := count + 1; end if; temp0 <= count(0);HEX0 <= decode( temp0); end process; end Behavioral;