Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

VHDL problem

Altera_Forum
Honored Contributor II
1,716 Views

Hi everyone,  

I'm a new user of FPGA. 

I have 2 LEDs and a clock of 32KHz. 

So I wanna light up LED1  

then light off LED 1 and light up LED2. 

Im trying to do something in VHDL, but it seems it's nonsense what I've done 

 

 

 

LIBRARY ieee; 

USE ieee.std_logic_1164.all; 

use ieee.numeric_std.all; 

use IEEE.STD_LOGIC_SIGNED; 

use IEEE.STD_LOGIC_UNSIGNED; 

use IEEE.STD_LOGIC_ARITH.ALL; 

 

 

ENTITY TP4LED IS 

PORT ( 

clock : IN std_logic; 

s1: OUT std_logic; 

s2: OUT std_logic 

); 

END TP4LED; 

 

 

ARCHITECTURE behavior OF TP4LED IS -- fonctionnement d'une bascule D 

 

 

signal count : integer(10 downto 0); 

BEGIN 

 

 

PROCESS (clock) -- liste de sensibilité 

 

 

BEGIN 

count <= '0'; 

s1<='1'; 

s2<='0'; 

if(clock'event and clock='1')then 

count <= count + 1; 

if (count = '9') then 

s1<='0'; 

s2<='1'; 

count<=0;  

end if; 

end if; 

END PROCESS; 

END behavior; 

 

In addition, I have this mistake that I don't know how to resolve it  

Error (10380): VHDL error at TP4LED.vhd(24): integer type is used but not declared as an array type 

 

 

I know it might be an easy question. Could anyone help me please 

thank you very much 

Bo
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
959 Views

integer is not an array type, so you cannot use it like and array. Your count signal declaration says you want 11 integers. If you wanted a single integer with 11 bits, you should use the unsigned type (before you do this - delete the non-standard std_logic_unsigned/signed and std_logic_arith libraries from your library list - otherwise you're going to get all sorts of conflicts). 

 

You need: 

 

signal count : unsigned(10 downto 0); 

 

secondly, '9' is a character, not an integer value. change it to 

 

if count = 9 then... 

 

Finally, do not do assignments outside of the clocked part of the process.
0 Kudos
Reply