Si tienes varios archivos con módulos diferentes, debes crear un archivo "top" que los instancie a todos y que una las señales unas con otras. Cada módulo será declarado como componente y luego instanciado. Te paso un ejemplo de un contador ascendente que instancia a un módulo para decodificar el código bcd a 7 segmentos:
Codigo:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity contador is
Port ( clk : in std_logic;
rst : in std_logic;
digito : out std_logic_vector(3 downto 0);
segme : out std_logic_vector(7 downto 0));
end contador;
architecture Behavioral of contador is
signal clk2:std_logic;
signal numero:std_logic_vector(3 downto 0);
signal anodos:std_logic_vector(3 downto 0);
signal contador, contador3:integer;
signal contador2:std_logic_vector(2 downto 0);
signal numero1,numero2,numero3,numero4:std_logic_vector(3 downto 0);
component decodificador
Port ( bcd :in std_logic_vector(3 downto 0);
segme :out std_logic_vector(7 downto 0));
end component;
begin
U1:decodificador port map (numero, segme);
divisor:process (clk,rst) begin
if ( rst ="1" ) then
contador <= 0;
elsif (clk="1" and clk"event ) then
if (contador = 62500) then
contador <= 0;
clk2 <= not clk2;
else
contador <= contador + 1;
end if;
end if;
end process divisor;
divisor2:process (clk2,rst) begin
if ( rst ="1" ) then
contador3 <= 0;
numero1 <= "0000";
numero2 <= "0000";
numero3 <= "0000";
numero4 <= "0000";
elsif (clk2="1" and clk2"event ) then
if (contador3 = 400) then
contador3 <= 0;
if (numero1 = "1001"
then
numero1 <= "0000";
if (numero2 = "0101"
then
numero2 <= "0000";
if (numero3 = "1001"
then
numero3 <= "0000";
if (numero4 = "1001"
then
numero4 <= "0000";
else
numero4 <= numero4 + 1;
end if;
else
numero3 <= numero3 + 1;
end if;
else
numero2 <= numero2 + 1;
end if;
else
numero1 <= numero1 + 1;
end if;
else
contador3 <= contador3 + 1;
end if;
end if;
end process divisor2;
inicio:process (clk2,rst) begin
if ( rst ="1" ) then
numero <= "0000";
anodos <= "1111";
contador2 <= "000";
elsif (clk2="1" and clk2"event ) then
contador2 <= contador2 + 1;
if (contador2 = "000"
then
anodos <= "1110";
numero <= numero1;
elsif (contador2 = "001"
then
anodos <= "1111";
numero <= numero2;
elsif (contador2 = "010"
then
anodos <= "1101";
numero <= numero2;
elsif (contador2 = "011"
then
anodos <= "1111";
numero <= numero3;
elsif (contador2 = "100"
then
anodos <= "1011";
numero <= numero3;
elsif (contador2 = "101"
then
anodos <= "1111";
numero <= numero4;
elsif (contador2 = "110"
then
anodos <= "0111";
numero <= numero4;
elsif (contador2 = "111"
then
anodos <= "1111";
numero <= numero1;
end if;
end if;
end process inicio;
digito <= anodos;
end Behavioral;
Como puedes ver, el módulo "decodificador" se define como component y luego se instancia haciendo corresponder las señales de entrada salida
Por si lo quieres aqui te dejo también el archivo decodificador:
Codigo:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity decodificador is
Port ( bcd :in std_logic_vector(3 downto 0);
segme :out std_logic_vector(7 downto 0));
end decodificador;
architecture Behavioral of decodificador is begin
with bcd select
segme <= "00000011" WHEN "0000",
"10011111" WHEN "0001",
"00100101" WHEN "0010",
"00001101" WHEN "0011",
"10011001" WHEN "0100",
"01001001" WHEN "0101",
"01000001" WHEN "0110",
"00011111" WHEN "0111",
"00000001" WHEN "1000",
"00011001" WHEN "1001",
"11111111" WHEN OTHERS;
end Behavioral;