Processeur/Processeur.srcs/sources_1/new/LC.vhd
2021-06-10 18:36:04 +02:00

42 lines
1.6 KiB
VHDL

----------------------------------------------------------------------------------
-- Company: INSA-Toulouse
-- Engineer: Paul Faure
--
-- Create Date: 17.04.2021 21:49:57
-- Module Name: LC - Behavioral
-- Project Name: Processeur sécurisé
-- Target Devices: Basys 3 ARTIX7
-- Tool Versions: Vivado 2016.4
-- Description: Link Controler
--
-- Dependencies: None
--
-- Comments :
-- - Associe une commande a l'instruction courante
-- - A l'instruction i est renvoyé le ieme paquet de taille Command_size
--
-- Exemple :
-- - Soit le vecteur de bits de controle "010010100111" avec command size a 3
-- - Pour l'instruction 0 sera renvoyé "111"
-- - Pour l'instruction 1 sera renvoyé "100"
-- - Pour l'instruction 2 sera renvoyé "010"
-- - Pour l'instruction 3 sera renvoyé "010"
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity LC is
Generic (Instruction_Vector_Size : Natural; -- Nombres de bits nécessaires pour coder les instructions
Command_size : Natural; -- Nombre de bits de la commande en sortie
Bits_Controle : STD_LOGIC_VECTOR); -- Vecteur de bit contenant les commandes
Port ( Instruction : in STD_LOGIC_VECTOR (Instruction_Vector_Size - 1 downto 0); -- Instrcution courante
Commande : out STD_LOGIC_VECTOR (Command_size - 1 downto 0)); -- Sortie de la commande
end LC;
architecture Behavioral of LC is
begin
Commande <= Bits_Controle (((1 + to_integer(unsigned(Instruction))) * Command_size - 1) downto (Command_size * to_integer(unsigned(Instruction))));
end Behavioral;