Vous êtes sur la page 1sur 32

UNIVERSITE ABD EL MALEK ESSAADI

ÉCOLE NATIONALE DES SCIENCES APPLIQUÉES


Tétouan

MODULE: ELECTRONIQUE EMBARQUEE

« Logique programmable»

A. ZAKRITI Année: 2023/2024


« Synthèse logique - VHDL- »

DESCRIPTION DES CIRCUITS


COMBINATOIRES

A. ZAKRITI 2
- Ils peuvent être décrit par tout type de description
(structurelle, comportementale en mode concurent et
avec des équations booléennes et comportementale
en mode process). En mode process, tous les signaux
d’entrée pour un système combinatoire doivent être
dans la liste de sensibilité.

- Les exemples traités par la suite utilisent les


descriptions comportementales

A. ZAKRITI 3
SYSTÈMES COMBINATOIRES

I- Description des transcodeurs


I-1 Transcodeur: Gray  Binaire sur 3 bits
Décrivons le système en employant l’instruction concurrente:
With….Select……When

entity Gray_Bin is

Port (
G : in STD_LOGIC_VECTOR (2 downto 0);
B : out STD_LOGIC_VECTOR (2 downto 0));

end Gray_Bin;

A. ZAKRITI 4
SYSTÈMES COMBINATOIRES
architecture Behavioral of Gray_Bin is
Begin

With G select
B<= "000" when "000",
"001" when "001",
"010" when "011",
"011" when "010",
"100" when "110",
"101" when "111",
"110" when "101",
"111" when "100",
“000" when others;

end Behavioral;
A. ZAKRITI 5
SYSTÈMES COMBINATOIRES

I-2 Transcodeur BCD-7 segments

Construire à l’aide de : « With…..Select……When » le


transcodeur BCD - 7 segments. Si le nombre est supérieur à 9,
l’afficheur affiche un E pour indiquer une erreur.
Déclarer pour le transcodeur les sorties séparées

A. ZAKRITI 6
SYSTÈMES COMBINATOIRES

i
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity BCD27SEG is
Port (
i : in std_logic_vector(3 downto 0);

a, b, c, d, e, f, g : out std_logic);

end BCD27SEG;

A. ZAKRITI 7
SYSTÈMES COMBINATOIRES
architecture Behavioral of BCD27SEG is
BEGIN
WITH i SELECT
(a,b,c,d,e,f,g) <= std_logic_vector’(‘1’,’1’,’1’,’1’,’1’,’1’,’0’) WHEN "0000",
std_logic_vector’(‘0’,’1’,’1’,’0’,’0’,’0’,’0’) WHEN "0001",
std_logic_vector’(‘1’,‘1’,’0’,’1’,’1’,’0’,’1’) WHEN "0010",
std_logic_vector’(‘1’,’1’,’1’,’1’,’0’,’0’,’1’) WHEN "0011",
std_logic_vector’(‘0’,’1’,’1’,’0’,’0’,’1’,’1’) WHEN "0100",
std_logic_vector’(‘1’,’0’,’1’,’1’,’0’,’1’,’1’) WHEN "0101",
std_logic_vector’(‘1’,’0’,’1’,’1’,’1’,’1’,’1’) WHEN "0110",
std_logic_vector’(‘1’,’1’,’1’,’0’,’0’,’0’,’0’) WHEN "0111",
std_logic_vector’(‘1’,’1’,’1’,’1’,’1’,’1’,’1’) WHEN "1000",
std_logic_vector’(‘1’,’1’,’1’,’1’,’0’,’1’,’1’) WHEN "1001",
std_logic_vector’(‘1’,’0’,’0’,’1’,’1’,’1’,’1’) WHEN OTHERS ;

end Behavioral;

A. ZAKRITI 8
SYSTÈMES COMBINATOIRES

Autrement:

architecture Behavioral of BCD27SEG is


SIGNAL seg :std_logic_vector(6 downto 0);
BEGIN
WITH i SELECT
seg <= "1111110" WHEN "0000",
"0110000" WHEN "0001",
"1101101" WHEN "0010",
"1111001" WHEN "0011",
"0110011" WHEN "0100",
"1011011" WHEN "0101",
"1011111" WHEN "0110",
"1110000" WHEN "0111",
"1111111" WHEN "1000",
"1111011" WHEN "1001",
"1001111" WHEN OTHERS ; -- affichage de E

A. ZAKRITI 9
SYSTÈMES COMBINATOIRES

a <= seg(6);
b <= seg(5);
c <= seg(4);
d <= seg(3);
e <= seg(2);
f <= seg(1);
g <= seg(0);

end Behavioral;

A. ZAKRITI 10
SYSTÈMES COMBINATOIRES

II- Description des comparateurs

II-1 Comparateur d’égalité

* Utilisation de l’instruction concurrente: When…… else

La comparaison est correcte si on ajoute la déclaration


du paquetage:
« ieee.std_logic_unsigned.all »:

Ce type impose la comparaison entre les bits du même


poids

A. ZAKRITI 11
SYSTÈMES COMBINATOIRES
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_unsigned.all;

entity comparaison is
Port ( A : in STD_LOGIC_VECTOR (3 downto 0); -- A sur 4 bits
B : in STD_LOGIC_VECTOR (2 downto 0); -- B sur 3 bits
S : out STD_LOGIC );
end comparaison;

architecture Behavioral of comparaison is


Begin

S<= '1' when (A = B) else '0';


end Behavioral;
A. ZAKRITI 12
SYSTÈMES COMBINATOIRES

A. ZAKRITI 13
SYSTÈMES COMBINATOIRES

II-2 Description d’un comparateur complet

* Utilisation de l’instruction en mode process: IF..else

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity compar is
Port ( A : in STD_LOGIC_VECTOR (4 downto 0);
B : in STD_LOGIC_VECTOR (3 downto 0);
INF : out STD_LOGIC;
EQ : out STD_LOGIC;
SUP : out STD_LOGIC);
end compar;

A. ZAKRITI 14
SYSTÈMES COMBINATOIRES

architecture Behavioral of compar is


begin
process(A,B)
begin
if A > B then SUP<= '1'; INF<= '0'; EQ<='0';
elsif A<B then SUP<= '0'; INF<= '1'; EQ<='0';
elsif A=B then SUP<= '0'; INF<= '0'; EQ<='1';
end if;
end process;

end Behavioral;
Exemple: Si A<= "01111" et B<= "1000";
SUP<= '1'; INF<= '0'; EQ<='0';

A. ZAKRITI 15
SYSTÈMES COMBINATOIRES

III Description des multiplexeurs


III-1 Description d’un multiplexeur 4 vers 1
1- Décrire un multiplexeur avec 4 entrées de données, sur 1 bit
chacune avec l’instruction concurrente : WITH… SELECT
Library ieee;
Use ieee.std_logic_1164.all;

Entity multiplexeur41_1bits is
port ( entree : in std_logic_vector(3 downto 0);
selecteur : in std_logic_vector(1 downto 0);
sortie : out std_logic );

End multiplexeur41_1bits;

A. ZAKRITI 16
SYSTÈMES COMBINATOIRES

Architecture ARCH of multiplexeur41_1bits is


Begin

With selecteur select


sortie<= entree(0) when “00”,
entree(1) when “01”,
entree(2) when “10”,
entree(3) when “11”,
“Z” when others; -- ici la sortie est mise en haute impédance
end ARCH;

A. ZAKRITI 17
SYSTÈMES COMBINATOIRES

2- Décrire un multiplexeur avec 4 entrées de données, sur 8


bits chacune avec l’instruction concurrente : WITH… SELECT

A. ZAKRITI 18
Library ieee;
Use ieee.std_logic_1164.all;

Entity MULTIPLEXEUR41_8bits is
port ( selecteur : in std_logic_vector(1 downto 0);
E0, E1, E2, E3 : in std_logic_vector(7 downto 0);
S : out std_logic_vector(7 downto 0) );
end MULTIPLEXEUR41_8bits;

Architecture ARCH of MULTIPLEXEUR41_8bits is


Begin
With selecteur select
S <= E0 when “00”,
E1 when “01”,
E2 when “10”,
E3 when “11”,
“zzzzzzzz” when others;
endA.ARCH;
ZAKRITI 19
SYSTÈMES COMBINATOIRES

IV- Description des démultiplexeurs


IV-1 Démultiplexeur 1 à 4

•Décrire ce circuit avec l’instruction séquentielle:


Case…. When…else

A. ZAKRITI 20
SYSTÈMES COMBINATOIRES

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity Demux is
Port ( Sel : in STD_LOGIC_VECTOR (1 downto 0); -- Sel = a, b

E : in STD_LOGIC; -- entrée de donnée

S : out STD_LOGIC_VECTOR (3 downto 0));

end Demux;

A. ZAKRITI 21
SYSTÈMES COMBINATOIRES

architecture Behavioral of Demux is


Begin
Process (Sel, E)
Begin
Case Sel is
When "00" => S(3) <= ‘0’; S(2) <= ‘0’; S(1) <= ‘0’; S(0) <= E;
When "01" => S(3) <= ‘0’ ; S(2) <= ‘0’; S(1) <= E; S(0) <= ‘0’;
When "10" => S(3) <= ‘0’; S(2) <= E; S(1) <= ‘0’; S(0) <= ‘0’;
When "11" => S(3) <= E; S(2) <= ‘0’; S(1) <= ‘0’; S(0) <= ‘0’;
when others => S <= "zzzz";

end case;
end process;
end Behavioral;
A. ZAKRITI 22
SYSTÈMES COMBINATOIRES

Autrement, on peut écrire :

architecture Behavioral of Demux is


Begin
Process (Sel, E)
Begin
Case Sel is
When "00" => S <= ‘0’ & ‘0’ & ‘0’ & E; -- ou S<= (‘0’,‘0’,‘0’,E)
When "01" => S <= ‘0’ & ‘0’ & E & ‘0; -- ou S<= (‘0’,‘0’, E,‘0’)
When "10" => S <= ‘0’ & E & ‘0’ & ‘0; -- ou S<= (‘0’,E,‘0’, ‘0’)
When "11" => S <= E & ‘0’ & ‘0’ & ‘0; -- ou S<= (E,‘0’,‘0’, ‘0’)
when others => S <= "zzzz"; -- la lettre Z est en majuscule
end case;
end process;
end Behavioral;

A. ZAKRITI 23
SYSTÈMES COMBINATOIRES

IV-2 Démultiplexeur 1 à 8
Ecrire un code VHDL d’un démultiplexeur 1 vers 8 en utilisant
l’instruction séquentielle : « if ….. elsif…… end if ». L’entrée
de donnée est en permanence à ‘1’

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity demux is
Port ( O : out std_logic_vector (7 downto 0) ;
Sel : in std_logic_vector (2 downto 0));
end demux;

A. ZAKRITI 24
SYSTÈMES COMBINATOIRES
architecture arch_demux of ent_demux is
begin
process (Sel)
begin
if Sel = “000" then O <= "00000001";
elsif Sel = "001" then O <= "00000010";
elsif Sel = "010" then O <= "00000100";
elsif Sel = "011" then O <= "00001000";
elsif Sel = "100" then O <= "00010000";
elsif Sel = "101" then O <= "00100000";
elsif Sel = "110" then O <= "01000000";
elsif Sel = "111" then O <= "10000000";
end if;
end process;
end arch_demux;
A. ZAKRITI 25
SYSTÈMES COMBINATOIRES

IV-3 Démultiplexeur 1 à 4 avec entrée de validation

•Décrire ce circuit avec des instructions séquentielles :


Case…. When…else & If…..endif

- L’entrée de donnée est à ‘1’, les sorties doivent être


à 1 ou 0
- Une entrée de validation « Enable »: si elle est à 1
le démultiplexeur fonctionne sinon les sorties sont
en haute impédance

A. ZAKRITI 26
SYSTÈMES COMBINATOIRES

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity Demux is
Port ( Sel : in STD_LOGIC_VECTOR (1 downto 0);
Enable : in STD_LOGIC;
Y : out STD_LOGIC_VECTOR (3 downto 0));
end Demux;

architecture Behavioral of Demux is


Begin

A. ZAKRITI 27
SYSTÈMES COMBINATOIRES

Process (Sel, Enable)


Begin
if (Enable = '1') then
Case Sel is
When "00" => Y <= "0001";
When "01" => Y <= "0010";
When "10" => Y <= "0100";
When "11" => Y <= "1000";
when others => Y<= "0000";
end case;
else Y<= "ZZZZ";
end if;
end process;
end Behavioral;

A. ZAKRITI 28
SYSTÈMES COMBINATOIRES

IV- Description d’une UAL

Pour le schéma synoptique d’une UAL où les entrées A et B


sont sur 4 bits, donner le programme VHDL correspondant.
Utiliser l’instruction « Case ….. When …. end case »

A. ZAKRITI 30
SYSTÈMES COMBINATOIRES

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

Entity UAL is
port( A : in std_logic_vector(3 downto 0);
B : std_logic_vector(3 downto 0);
Sel : std_logic_vector(1 downto 0);
R: out std_logic_vector(3 downto 0));
End UAL;

A. ZAKRITI 31
SYSTÈMES COMBINATOIRES

Architecture behv of UAL is


begin
process(A,B,Sel)
Begin
case Sel is
when "00" => R <= A + B;
when "01" => R <= A - B;
when "10" => R <= A and B;
when "11" => R <= A or B;
when others => R <= “ZZZZ";
end case;
end process;
end behv;

A. ZAKRITI 32
A. ZAKRITI 33

Vous aimerez peut-être aussi