Vous êtes sur la page 1sur 5

Royaume du Maroc ‫المملكة المغربية‬

Université Abdelmalek Essaâdi ‫جامعة عبد المالك السعدي‬


Ecole Nationale des Sciences Appliquées
‫المدرسة الوطنية للعلوم التطبيقية‬
Tétouan
‫تطوان‬

Filière : GI1 Année : 2019-2020

Circuits numériques programmables


Devoir & Correction

Exercice 1:

Considérons le circuit combinatoire suivant :

La description comportementale permet de décrire le comportement du circuit sans faire


appel aux équations mais en passant par la table de vérité.
1- Etablir la table de vérité de ce circuit
2- Faire une description comportementale de ce circuit en mode concurrent, en
utilisant l’instruction « … when… else… ».

Solution : (4pts)
a b c s
1- T.V.

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 0

A. ZAKRITI Page 1
Royaume du Maroc ‫المملكة المغربية‬
Université Abdelmalek Essaâdi ‫جامعة عبد المالك السعدي‬
Ecole Nationale des Sciences Appliquées
‫المدرسة الوطنية للعلوم التطبيقية‬
Tétouan
‫تطوان‬

2- Description VHDL

D’après la table de vérité, on remarque que : Si b= 0 , s = a et Si b=1, s = NON (c)

Ce comportement est alors traduit par une description VHDL comportementale


avec une instruction concurrente comme suit :

library ieee;
use ieee.std_logic_1164.all;
entity STRUCT4 is
port (a,b,c: in std_logic;
s : out std_logic);
end STRUCT4;
architecture DESCRIPTION of STRUCT4 is
begin
s <= a when (b = '0') else not c when (b = '1');

end DESCRIPTION;

Exercice 2

Donner une description du transcodeur BCD - 7 segments à l’aide de :


« Case ….. When …. end case »

Si le nombre est supérieur à 9, l’afficheur affiche un E pour indiquer une erreur.

A. ZAKRITI Page 2
Royaume du Maroc ‫المملكة المغربية‬
Université Abdelmalek Essaâdi ‫جامعة عبد المالك السعدي‬
Ecole Nationale des Sciences Appliquées
‫المدرسة الوطنية للعلوم التطبيقية‬
Tétouan
‫تطوان‬

Solution : (5pts)

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

entity BCD27SEG is
Port ( E : in std_logic_vector(3 downto 0);
a, b, c, d, e, f, g : out std_logic; -- déclarer les sorties séparément
end BCD27SEG;

architecture Behavioral of BCD27SEG is


SIGNAL seg :std_logic_vector(6 downto 0); -- déclarer un signal interne de sortie

BEGIN
Process (E)
case E is
WHEN "0000" => seg <= "1111110";
WHEN "0001" => seg <= "0110000;
WHEN "0010" => seg <= "1101101" ;
WHEN "0011" => seg <= "1111001" ;
WHEN "0100" => seg <= "0110011" ;
WHEN "0101" => seg <= "1011011" ;
WHEN "0110" => seg <= "1011111" ;
WHEN "0111" => seg <= "1110000" ;
WHEN "1000" => seg <= "1111111" ;
WHEN "1001" => seg <= "1111011" ;
WHEN OTHERS => seg <= "1001111 ";

end case;
end process;
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 Page 3
Royaume du Maroc ‫المملكة المغربية‬
Université Abdelmalek Essaâdi ‫جامعة عبد المالك السعدي‬
Ecole Nationale des Sciences Appliquées
‫المدرسة الوطنية للعلوم التطبيقية‬
Tétouan
‫تطوان‬

Exercice 3

Décrire le logigramme ci-dessous par une description comportementale en utilisant


l’instruction: if...elsif..end if

Solution (6pts):

library IEEE;
use IEEE.std_logic_1164.all;

entity FLIPFLOP is
port (D1, D2, reset, clk: in std_logic;
Q : out std_logic);
end FLIPFLOP;

architecture EG of FLIPFLOP is
begin

process (clk)
begin

if (clk'event and clk='1') then


if reset = '1' then
Q <= '0' ;
else
Q <= D1 xor D2;
end if ;
end if;
end process;

end EG;

A. ZAKRITI Page 4
Royaume du Maroc ‫المملكة المغربية‬
Université Abdelmalek Essaâdi ‫جامعة عبد المالك السعدي‬
Ecole Nationale des Sciences Appliquées
‫المدرسة الوطنية للعلوم التطبيقية‬
Tétouan
‫تطوان‬

Exercice 4

Donner une description VHDL d’un circuit séquentiel qui réalise le comptage ou décomptage
selon une entrée de commande C. Le cycle effectué est de 0 à 15 ou de 15 à 0.

Le circuit possède une remise à 0 asynchrone.

Solution : (5pts)

library ieee;
use ieee.std_logic_1164.all;
Use ieee.numeric_std.all;
Use ieee.std_logic_unsigned.all;

entity UPDOWN is
port( H, R, C : in std_logic;
Q: out std_logic_vector(3 downto 0));
end entity;

architecture data of UPDOWN is


signal x: std_logic_vector(3 downto 0);

begin
process(H, R)
begin
If R='1' then x<= "0000";
elsif (H'event and H='1') then
if C='0' then x<=x-1; else x<= x+1;
end if ;
end if;
end process;

Q<= x;
end data;

A. ZAKRITI Page 5

Vous aimerez peut-être aussi