codigo vhdl spartan 3e

hola amigos
estoy inetentando hacer un programa para indicar cuántas pelotas deben ser empacadas por caja, debe haber un teclado (switches) y sólo se permite un máximo de nueve muñecas por caja. Una vez se ha digitado el número deseado, se activa la banda transportadora y un sensor envía una señal por cada pelota detectada. Cuando el sensor ha indicado el número establecido de pelotas, la banda debe parar y se debe mostrar el numero de pelotas contadas por el sensor en la lcd de la spartan 3e.
yo ya he utlizado la lcd de la spartan para escribir mi nombre y ps use ese mismo programa para q me muetre el nuemor de pelotas ingrsadas pero me aprece un error q no entiendo....por favor necesito que me colaboren
Código:
LIBRARY ieee ; USE ieee.std_logic_1164.all; 
USE ieee.std_logic_unsigned.all; --esta librería es indispensable para poder utilizar la suma en el contador con std_logic 

entity packed is
GENERIC(CLK_DIVIDE:INTEGER:=50000);
   PORT( 
      clk             : IN      std_logic ; 
      igual        : out      std_logic ; 
      enter        : IN      std_logic ; 
      sensor     : IN      std_logic ; 
      cuenta     : out     std_logic_vector(3 downto 0); 
      teclado    : IN      std_logic_vector(3 downto 0); 
      banda      : out     std_logic ; 

		       RST: 	IN BIT;
---salidas de la spartan 3e (pines)
           RS,RW,SF_CEO: out BIT;
			  E:BUFFER BIT;
			  DB:out BIT_VECTOR(3 downto 0)
       ); 
end packed;
architecture Behavioral of packed is
SIGNAL  db1 :  bit_vector(3 downto 0); --señales intermedias 
SIGNAL  db2:   bit_vector(3 downto 0); 
SIGNAL  cnt :  std_logic_vector(3 downto 0); 
signal test: std_logic;
TYPE Estados IS (F_INIT_1A,F_INIT_1B,F_INIT_2A,
F_INIT_2B,F_INIT_3A,F_INIT_3B,BORRAR1,BORRAR2,
Control1,Control2,Modo1,Modo2,s1,s2,R3,R4);
SIGNAL pr_estado, nx_estado:Estados;


BEGIN 
test <=teclado(3) or teclado(2) or teclado(1) or teclado(0);



------------------------------------------------------------------ 
-- codificador 
------------------------------------------------------------------ 
codif: process (teclado) 
begin 
if test = '1' then 
case teclado is 
   when "0000" => db1 <= "0011";  ---el cero 
   when "0001" => db1 <= "0011";  ---el uno 
   when "0010" => db1 <= "0011"; ---el dos 
   when "0011" => db1 <= "0011";  ---el tres 
   when "0100" => db1 <= "0011";  ---el cuatro 
   when "0101" => db1 <= "0011"; ---el cinco 
   when "0110" => db1 <= "0011"; ---el seis 
   when "0111" => db1 <= "0011";  ---el siete 
   when "1000" => db1 <= "0011";  ---el ocho 
   when "1001" => db1 <= "0011"; ---el nueve 
   when others => db1 <= "0011"; 
  end case; 
end if; 
end process; 
------------------------------------------------------------------ 
-- registro 
------------------------------------------------------------------ 
reg_gab: PROCESS(db1,clk) 
                BEGIN 
      if clk = '1' then
            if test = '1' then 
                               DB <= db1; 
                                               end if; 
															  end if;
END PROCESS; 
------------------------------------------------------------------ 
-- decodificador 
------------------------------------------------------------------ 
decodif_gab: process (teclado) 
begin 
if enter = '1' then            --con el enter del teclado se puede corregir un número errado hasta que éste 
                banda<='1';  -- no se presione y solo cambia la señal en el display cuando 
case teclado is               --se presiona un nuevo número y no cuando cambia a cero al soltarse 
    when "0000" => db2 <= "0000";  ---el cero 
    when "0001" => db2 <= "0001"; ---el uno 
    when "0010" => db2 <= "0010";  ---el dos 
    when "0011" => db2 <= "0011";  ---el tres 
    when "0100" => db2 <= "0100";  ---el cuatro 
    when "0101" => db2 <= "0101";  ---el cinco 
    when "0110" => db2 <= "0110";  ---el seis 
    when "0111" => db2 <= "0111";  ---el siete 
    when "1000" => db2 <= "1000";  ---el ocho 
    when "1001" => db2 <= "1001";  ---el nueve 
    when others => db2 <= "0000"; 
  end case; 
else 
banda <= '0'; 
end if; 
end process; 
------------------------------------------------------------------
---------------lcd inicializacion---------------------------------
------------------------------------------------------------------

SF_CEO<='1';
RELOJ_500Hz: PROCESS(CLK)
VARIABLE Cuenta: INTEGER RANGE 0 TO CLK_DIVIDE;
 begin
       IF(CLK'EVENT AND CLK='1')THEN
		    Cuenta:=Cuenta+1;
			 IF(Cuenta=CLK_DIVIDE)THEN
			    E<=NOT E;
				 Cuenta:=0;
			 END IF;
		 END IF;
   END PROCESS;
MAQUINA: PROCESS(E)
BEGIN
   IF(E'EVENT AND E='1')THEN
	   IF(RST='1')THEN
		  pr_estado<=F_INIT_1A;
		ELSE
		  pr_estado<=nx_estado;
	   END IF;
	END IF;
END PROCESS;

FSM: PROCESS(pr_estado)
    BEGIN
	   CASE pr_estado IS
		   WHEN F_INIT_1A =>
			    RS<='0';RW<='0';
				 DB<="0010";
				 nx_estado<=F_INIT_1B;
			WHEN F_INIT_1B =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=F_INIT_2A;
			WHEN F_INIT_2A =>
			    RS<='0';RW<='0';
		       DB<="0010";
			    nx_estado<=F_INIT_2B;
			WHEN F_INIT_2B =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=F_INIT_3A;
			WHEN F_INIT_3A =>
			    RS<='0';RW<='0';
		       DB<="0010";
			    nx_estado<=F_INIT_3B;
			WHEN F_INIT_3B =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=BORRAR1;
----------------------------------------------------------------------------------
			WHEN BORRAR1 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=BORRAR2;
			WHEN BORRAR2 =>
			    RS<='0';RW<='0';
		       DB<="0001";
			    nx_estado<=Control1;
----------------------------------------------------------------------------------
			WHEN Control1 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=Control2;
			WHEN Control2 =>
			    RS<='0';RW<='0';
		       DB<="1100";
			    nx_estado<=Modo1;
----------------------------------------------------------------------------------
         WHEN Modo1 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=Modo2;
			WHEN Modo2 =>
			    RS<='0';RW<='0';
		       DB<="0110";
			    nx_estado<=s1;
----------------------------------------------------------------------------------    
         WHEN s1 =>
			    RS<='0';RW<='0';
		       DB<=db1;
			    nx_estado<=s2;
			WHEN s2 =>
			    RS<='0';RW<='0';
		       DB<=db2;
			    nx_estado<=R3;
		  WHEN R3 =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=R4;
			WHEN R4 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=R3;				 
							 
				 
		
  END CASE;
END PROCESS;
--------------------------------------------------------------------------------

------------------------------------------------------------------ 
-- contador 
------------------------------------------------------------------ 
conta_gab: PROCESS (clk)           
BEGIN                               
IF (clk'EVENT AND clk = '1') THEN  
   IF sensor = '1' THEN              
	cnt <= cnt + 1; 
	ELSIF db2 = cnt then  
	cnt <= "0000";  
    END IF; 
END IF; 
cuenta <= cnt; 
END PROCESS; 
--------------------------------------------------------------- 
-- comparador 
------------------------------------------------------------------   
      --la desactivación de la banda transportadora se hace con esta señal, la cual se 
      --genera de la comparación del valor almacenado inicial con el del contador 
     
IGUAL <= '1' WHEN (db2=cnt ) ELSE '0';
end Behavioral;
 
Cual es el error?

En tu proceso reg_gab, si lo que quisiste hacer es un registro, deberia figurar asi
reg_gab: PROCESS(clk)
IF (clk'EVENT AND clk = '1') THEN
IF test = '1' THEN
DB <= db1;
END IF;
END IF;
 
que tal amigo ps mira ya solucione el problema anterior y ya tengo bien en sintaxis pero a la hora de synthesize me sale un error ahi y no se como corregirlo
Código:
LIBRARY ieee ;
USE ieee.std_logic_1164.all; 
USE ieee.std_logic_unsigned.all; --esta librería es indispensable para poder utilizar la suma en el contador con std_logic 

entity packed is
GENERIC(CLK_DIVIDE:INTEGER:=50000); -- 
   PORT( 
      clk             : IN      std_logic ; 
      igual        : out      std_logic ; 
      enter        : IN      std_logic ; 
		      enter_1        : IN      std_logic ; 

      sensor_c    : IN      std_logic ; 
      sensor_p   : IN      std_logic ; 
      teclado    : IN      std_logic_vector(3 downto 0); 
      banda      : out     std_logic ;
      igual_1        : out      std_logic ; 

      dispensador:		 out     std_logic ;
      RST: 	IN BIT;
       RS,RW,SF_CEO: out BIT;
			  E:BUFFER BIT;
			  DB:out BIT_VECTOR(3 downto 0)
       ); 
end packed;
architecture Behavioral of packed is
SIGNAL  cnt :  std_logic_vector(3 downto 0); 
SIGNAL  cnt_1 :  std_logic_vector(3 downto 0); 
signal test: std_logic;
TYPE Estados IS (F_INIT_1A,F_INIT_1B,F_INIT_2A,
F_INIT_2B,F_INIT_3A,F_INIT_3B,BORRAR1,BORRAR2,
Control1,Control2,Modo1,Modo2,DP1,DP2,DP3,dp4,z3,z4,Y3,Y4,A5,A6,
C1,C2,A1,A2,J1,J2,R3,R4,P1,P2,E1,E2,L1,L2,O1,O2,T1,T2,A3,A4,Y1,Y2);
SIGNAL pr_estado, nx_estado:Estados;
signal pelotas_re: bit_vector(3 downto 0);
signal cajas_re: bit_vector(3 downto 0);



BEGIN 
test <=teclado(3) or teclado(2) or teclado(1) or teclado(0);--or enter(3)



------------------------------------------------------------------ 
-- codificador-cajas
------------------------------------------------------------------ 
cajas: process (teclado)
begin
if enter_1='1' then
case teclado is
   when "0000" => cajas_re <= "0000"; 
   when "0001" => cajas_re <= "0001";  
   when "0010" => cajas_re <= "0010";  
   when "0011" => cajas_re <= "0011";  
   when "0100" => cajas_re <= "0100";   
   when "0101" => cajas_re <= "0101";  
   when "0110" => cajas_re <= "0110";  
   when "0111" => cajas_re <= "0111";   
   when "1000" => cajas_re <= "1000"; 
   when "1001" => cajas_re <= "1001"; 
   when others => cajas_re <= "0000"; 
  end case;
  
end if; 
end process;  
---- codificador-cajas------------------------

pelotas: process(teclado)
begin
if enter = '1' then
  banda<='1'; 
  dispensador<='1';

case teclado is
   when "0000" => pelotas_re <= "0000"; 
   when "0001" => pelotas_re <= "0001";  
   when "0010" => pelotas_re <= "0010";  
   when "0011" => pelotas_re <= "0011";  
   when "0100" => pelotas_re <= "0100";   
   when "0101" => pelotas_re <= "0101";  
   when "0110" => pelotas_re <= "0110";  
   when "0111" => pelotas_re <= "0111";   
   when "1000" => pelotas_re <= "1000"; 
   when "1001" => pelotas_re <= "1001"; 
   when others => pelotas_re <= "0000"; 
  end case; 
  else 
  banda <= '0'; 
  dispensador<='0';

end if; 
end process; 
------------------------------------------------------------------
---------------lcd inicializacion (proceso)---------------------------------
------------------------------------------------------------------

SF_CEO<='1';
RELOJ_500Hz: PROCESS(CLK)

VARIABLE Cuenta: INTEGER RANGE 0 TO CLK_DIVIDE;
 begin
       IF(CLK'EVENT AND CLK='1')THEN
		    Cuenta:=Cuenta+1;
			 IF(Cuenta=CLK_DIVIDE)THEN
			    E<=NOT E;
			 END IF;
		 END IF;
   END PROCESS;
MAQUINA: PROCESS(E)
BEGIN
   IF(E'EVENT AND E='1')THEN
	   IF(RST='1')THEN
		  pr_estado<=F_INIT_1A;
		ELSE
		  pr_estado<=nx_estado;
	   END IF;
	END IF;
END PROCESS;

FSM: PROCESS(pr_estado)
    BEGIN
	   CASE pr_estado IS
		   WHEN F_INIT_1A =>
			    RS<='0';RW<='0';
				 DB<="0010";
				 nx_estado<=F_INIT_1B;
			WHEN F_INIT_1B =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=F_INIT_2A;
			WHEN F_INIT_2A =>
			    RS<='0';RW<='0';
		       DB<="0010";
			    nx_estado<=F_INIT_2B;
			WHEN F_INIT_2B =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=F_INIT_3A;
			WHEN F_INIT_3A =>
			    RS<='0';RW<='0';
		       DB<="0010";
			    nx_estado<=F_INIT_3B;
			WHEN F_INIT_3B =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=BORRAR1;
----------------------------------------------------------------------------------
			WHEN BORRAR1 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=BORRAR2;
			WHEN BORRAR2 =>
			    RS<='0';RW<='0';
		       DB<="0001";
			    nx_estado<=Control1;
----------------------------------------------------------------------------------
			WHEN Control1 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=Control2;
			WHEN Control2 =>
			    RS<='0';RW<='0';
		       DB<="1100";
			    nx_estado<=Modo1;
----------------------------------------------------------------------------------
         WHEN Modo1 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=Modo2;
			WHEN Modo2 =>
			    RS<='0';RW<='0';
		       DB<="0110";
			    nx_estado<=C1;
--------------------------------------------------------------------------------
         WHEN C1 =>
			    RS<='1';RW<='0';
		       DB<="0100";
			    nx_estado<=C2;
			WHEN C2 =>
			    RS<='1';RW<='0';
		       DB<="0011";
			    nx_estado<=A1;
----------------------------------------------------------------------------------
         WHEN A1 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=A2;
			WHEN A2 =>
			    RS<='1';RW<='0';
		       DB<="0001";
			    nx_estado<=J1;
----------------------------------------------------------------------------------
         WHEN J1 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=J2;
			WHEN J2 =>
			    RS<='1';RW<='0';
		       DB<="1010";
			    nx_estado<=A3;
----------------------------------------------------------------------------------
         WHEN A3 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=A4;
			WHEN A4 =>
			    RS<='1';RW<='0';
		       DB<="0001";
			    nx_estado<=DP1;
				 
--------------------------------------------------------------------------------
         WHEN DP1 =>
			    RS<='1';RW<='0';
		       DB<="0011";
			    nx_estado<=DP2;
			WHEN DP2 =>
			    RS<='1';RW<='0';
		       DB<="1010";
			    nx_estado<=Y1;
----------------------------------------------------------------------------------
         WHEN Y1 =>
			    RS<='1';RW<='0';
		       DB<="0011";
			    nx_estado<=Y2;
			WHEN Y2 =>
			    RS<='1';RW<='0';
		       DB<=cajas_re;
			    nx_estado<=Z3;
--------------------------------------------------------------------------------
         WHEN Z3 =>
			    RS<='1';RW<='0';
		       DB<="0010";
			    nx_estado<=Z4;
			WHEN Z4 =>
			    RS<='1';RW<='0';
		       DB<="0000";
			    nx_estado<=P1;
----------------------------------------------------------------------------------
         WHEN P1 =>
			    RS<='1';RW<='0';
		       DB<="0101";
			    nx_estado<=P2;
			WHEN P2 =>
			    RS<='1';RW<='0';
		       DB<="0000";
			    nx_estado<=E1;
----------------------------------------------------------------------------------
         WHEN E1 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=E2;
			WHEN E2 =>
			    RS<='1';RW<='0';
		       DB<="1111";
			    nx_estado<=L1;
----------------------------------------------------------------------------------
         WHEN L1 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=L2;
			WHEN L2 =>
			    RS<='1';RW<='0';
		       DB<="1100";
			    nx_estado<=O1;
----------------------------------------------------------------------------------
         WHEN O1 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=O2;
			WHEN O2 =>
			    RS<='1';RW<='0';
		       DB<="1111";
			    nx_estado<=T1;

---------------------------------------------------------------------------------

         WHEN T1 =>
			    RS<='1';RW<='0';
		       DB<="0111";
			    nx_estado<=T2;
			WHEN T2 =>
			    RS<='1';RW<='0';
		       DB<="0100";
			    nx_estado<=A5;

---------------------------------------------------------------------------------

        WHEN A5 =>
			    RS<='1';RW<='0';
		       DB<="0110";
			    nx_estado<=A6;
			WHEN A6 =>
			    RS<='1';RW<='0';
		       DB<="0001";
			    nx_estado<=DP3;
				 
----------------------------------------------------------------------------------    
         WHEN DP3 =>
			    RS<='1';RW<='0';
		       DB<="0011";
			    nx_estado<=DP4;
			WHEN DP4 =>
			    RS<='1';RW<='0';
		       DB<="1010";
			    nx_estado<=Y3;
----------------------------------------------------------------------------------
         WHEN Y3 =>
			    RS<='1';RW<='0';
		       DB<="0011";
			    nx_estado<=Y4;
			WHEN Y4 =>
			    RS<='1';RW<='0';
		       DB<=pelotas_re;
			    nx_estado<=R3;

--------------------------------------------------------------------------------

		  WHEN R3 =>
			    RS<='0';RW<='0';
		       DB<="1000";
			    nx_estado<=R4;
			WHEN R4 =>
			    RS<='0';RW<='0';
		       DB<="0000";
			    nx_estado<=R3;				 
  END CASE;
END PROCESS;
-------------------------------------------------------------------------------
---- contador 
-------------------------------------------------------------------- 
conta_pelo: PROCESS (clk)           
BEGIN                               
IF (clk'EVENT AND clk = '1') THEN  
   IF sensor_p = '1'   THEN              
	cnt <= cnt + 1; 
	ELSIF teclado = cnt then  
	cnt <= "0000";  
    END IF; 
END IF; 
--cuenta <= cnt; 
END PROCESS; 
conta_cajas: PROCESS (clk)           
BEGIN                               
IF (clk'EVENT AND clk = '1') THEN  
   IF sensor_c = '1'   THEN              
	cnt_1 <= cnt_1 + 1; 
	ELSIF teclado = cnt_1 then  
	cnt <= "0000";  
    END IF; 
END IF; 
--cuenta <= cnt_1; 
END PROCESS; 

----------------------------------------------------------------- 
---- comparador 
--------------------------------------------------------------------   
 --la desactivación de la banda transportadora se hace con esta señal, la cual se 
 --genera de la comparación del valor almacenado inicial con el del contador 
     
IGUAL <= '1' WHEN (teclado = cnt_1 and teclado = cnt ) ELSE '0';
IGUAL_1 <= '1' when (teclado = cnt)else '0';
end Behavioral; 
----------------------------------------------------------------------------------
 
Atrás
Arriba