Library ieee;
USE ieee.std_logic_1164.all;

ENTITY contador IS
	PORT (clk: IN std_logic; QC,nQC: OUT std_logic_vector (0 TO 2));
END contador;
__________________________________________________________________________________

Library ieee;
USE ieee.std_logic_1164.all;

ARCHITECTURE arquitectura OF contador IS

COMPONENT biestable IS
	PORT (J, K, clk, CLR: IN std_logic; Q, nQ: OUT std_logic);
END COMPONENT;

COMPONENT puerta_nand IS
	PORT (entrada1,entrada2: IN std_logic;
		salida1: OUT std_logic);
END COMPONENT;

SIGNAL Q0,Q1,Q2,salida1: std_logic;
SIGNAL nQ0,nQ1,nQ2: std_logic;

FOR p1: biestable USE ENTITY WORK.biestable (arquitectura);
FOR p2: biestable USE ENTITY WORK.biestable (arquitectura);
FOR p3: biestable USE ENTITY WORK.biestable (arquitectura);
FOR p4: puerta_nand USE ENTITY WORK.puerta_nand (arquitectura);

BEGIN

	p1: biestable PORT MAP ('1','1',clk,salida1,Q0,nQ0);
	
	p2: biestable PORT MAP ('1','1',Q0,salida1,Q1,nQ1);

	p3: biestable PORT MAP ('1','1',Q1,salida1,Q2,nQ2);

	p4: puerta_nand PORT MAP (Q0,Q2,salida1);
		
	QC <= Q2&Q1&Q0;
	nQC <= nQ2&nQ1&nQ0;

END arquitectura;
__________________________________________________________________________

Library ieee;
USE ieee.std_logic_1164.all;

ENTITY prueba_contador IS
END prueba_contador;

ARCHITECTURE arquitectura OF prueba_contador IS

	COMPONENT contador 
		PORT (clk: IN std_logic; QC, nQC: OUT std_logic_vector (0 TO 2));
	END COMPONENT;

	FOR ALL: contador USE ENTITY WORK.contador (arquitectura);

	CONSTANT duracion_ciclo: TIME:= 1 ns;
	SIGNAL ent_clk: std_logic:='0';
	SIGNAL sal_QC, sal_nQC: std_logic_vector (0 TO 2);
	
	BEGIN

		contador1: contador PORT MAP (ent_clk, sal_QC, sal_nQC);

		reloj: PROCESS

		BEGIN
			WAIT FOR duracion_ciclo;
			ent_clk <= '1';
			WAIT FOR duracion_ciclo;
			ent_clk <= '0';
		END PROCESS reloj;

		
	END arquitectura;

Hay que tener cuidado con las conexiones no vaya a ser que la seal de reloj se conecte 
a los tres biestable y debe ir conectada slo al primero. Los otros dos biestables se 
sincronizan utilizando la salida del biestable previo.

Si pasan de 000 a 111 sucesivamente pienso que no se han conectado correctamente y 
la seal de reloj est utilizndose con los tres y no con el primero.

