library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity FF2 is
    Port ( 	CLK : in  STD_LOGIC;                                    -- Tiene que funcionar a 48000*21
				Qint : in STD_LOGIC_VECTOR (4 downto 0);
				Bf_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B1_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B2_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B3_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B4_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B5_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B6_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B7_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B8_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B9_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B10_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B11_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B12_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B13_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B14_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B15_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B16_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B17_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B18_5 : in STD_LOGIC_VECTOR (7 downto 0);
				B19_5 : in STD_LOGIC_VECTOR (7 downto 0);
				Bf : out STD_LOGIC_VECTOR (7 downto 0);
				B1 : out STD_LOGIC_VECTOR (7 downto 0);
				B2 : out STD_LOGIC_VECTOR (7 downto 0);
				B3 : out STD_LOGIC_VECTOR (7 downto 0);
				B4 : out STD_LOGIC_VECTOR (7 downto 0);
				B5 : out STD_LOGIC_VECTOR (7 downto 0);
				B6 : out STD_LOGIC_VECTOR (7 downto 0);
				B7 : out STD_LOGIC_VECTOR (7 downto 0);
				B8 : out STD_LOGIC_VECTOR (7 downto 0);
				B9 : out STD_LOGIC_VECTOR (7 downto 0);
				B10 : out STD_LOGIC_VECTOR (7 downto 0);
				B11 : out STD_LOGIC_VECTOR (7 downto 0);
				B12 : out STD_LOGIC_VECTOR (7 downto 0);
				B13 : out STD_LOGIC_VECTOR (7 downto 0);
				B14 : out STD_LOGIC_VECTOR (7 downto 0);
				B15 : out STD_LOGIC_VECTOR (7 downto 0);
				B16 : out STD_LOGIC_VECTOR (7 downto 0);
				B17 : out STD_LOGIC_VECTOR (7 downto 0);
				B18 : out STD_LOGIC_VECTOR (7 downto 0);
				B19 : out STD_LOGIC_VECTOR (7 downto 0)
				);
end FF2;

architecture Behavioral of FF2 is

signal Bf_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B1_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B2_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B3_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B4_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B5_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B6_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B7_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B8_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B9_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B10_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B11_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B12_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B13_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B14_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B15_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B16_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B17_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B18_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');
signal B19_FF : STD_LOGIC_VECTOR (7 downto 0):= (others=>'0');

begin
Process (CLK)										
	begin	
		if (CLK'event and CLK='1') then
			if (Qint="00000") then  							 -- almacena datos mientras son constantes
					Bf_FF <= Bf_5;
					B1_FF <= B1_5;
					B2_FF <= B2_5;
					B3_FF <= B3_5;
					B4_FF <= B4_5;
					B5_FF <= B5_5;
					B6_FF <= B6_5;
					B7_FF <= B7_5;
					B8_FF <= B8_5;
					B9_FF <= B9_5;
					B10_FF <= B10_5;
					B11_FF <= B11_5;
					B12_FF <= B12_5;
					B13_FF <= B13_5;
					B14_FF <= B14_5;
					B15_FF <= B15_5;
					B16_FF <= B16_5;
					B17_FF <= B17_5;
					B18_FF <= B18_5;
					B19_FF <= B19_5;
			end if;
		end if;
end process;

Bf <= Bf_FF;
B1 <= B1_FF;
B2 <= B2_FF;
B3 <= B3_FF;
B4 <= B4_FF;
B5 <= B5_FF;
B6 <= B6_FF;
B7 <= B7_FF;
B8 <= B8_FF;
B9 <= B9_FF;
B10 <= B10_FF;
B11 <= B11_FF;
B12 <= B12_FF;
B13 <= B13_FF;
B14 <= B14_FF;
B15 <= B15_FF;
B16 <= B16_FF;
B17 <= B17_FF;
B18 <= B18_FF;
B19 <= B19_FF;

end Behavioral;

