Université Hassiba Benbouali de Chlef Master 1 Télécommunication
Faculté de Technologie option : systèmes des Télécommunications
Dépa te e t d’Elect o i ue
Série TD n°3 (Circuits séquentiels)
Exercices 1
1) Ecrire une description VHDL selon le principe d’une bascule D latch
D Q
D_Latch
CLK Qb
2) Compléter le chronogramme suivant en se basant sur les données de D et CLK
clk
D
Q
Qb
Exercice 2
Réaliser un registre composé de 4 bascules D latch.
D1 D2 D3 D4
D1_Latch D2_Latch D3_Latch D4_Latch
CLK
Reset
Q1 Q2 Q3 Q4
Exercice 3
Réaliser un registre à décalage à droite de 4bits avec un reset asynchrone :
1) Description simple.
2) Description en utilisant une boucle.
FPGA et programmation VHDL Dr. MOHAMMED ZAKARYA BABA-AHMED
86
Université Hassiba Benbouali de Chlef Master 1 Télécommunication
Faculté de Technologie option : systèmes des Télécommunications
Dépa te e t d’Elect o i ue
Solution de la série TD n°3 (Circuits séquentiels)
Exercice 1
1) Ecrire une description VHDL selon le principe d’une bascule D latch
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity d_latch is
port ( clk : in std_logic;
d : in std_logic;
q : out std_logic;
qb : out std_logic);
end d_latch;
architecture Behavioral of d_latch is clk d q qb
signal t1, t2 : STD_LOGIC; 0 0 q- q-
begin 0 1 q- q-
process (clk) 1 0 0 1
begin 1 1 1 0
if clk= '1' then
t1<= d; t2<= not d;
else
t1<= t1; t2<= t2;
end if;
end process;
q<= t1; qb<= t2;
end Behavioral;
2) Compléter le chronogramme suivant en se basant sur les données de D et CLK
clk
D
Q
Qb
Exercice 2
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
FPGA et programmation VHDL Dr. MOHAMMED ZAKARYA BABA-AHMED
87
Université Hassiba Benbouali de Chlef Master 1 Télécommunication
Faculté de Technologie option : systèmes des Télécommunications
Dépa te e t d’Elect o i ue
entity registre_latch is
port ( clk, reset : in std_logic;
d : in std_logic_vector (3 downto 0);
q : out std_logic_vector (3 downto 0);
qb : out std_logic_vector (3 downto 0));
end registre_latch;
architecture Behavioral of registre_latch is
signal E1, E2: std_logic_vector (3 downto 0);
begin
process (d, reset, clk)
begin
if reset= '1' then E1<="0000"; E2<="1111";
else if clk= '1' then
E1<= d; E2<= not d;
else E1<= E1; E2<= E2;
end if;
end if;
end process;
q<= E1; qb<= E2;
end Behavioral;
Exercice 3
D1 D2 D3 D4
Bascule D Bascule D Bascule D Bascule D
CLK
Reset
Q1 Q2 Q3 Q4
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
FPGA et programmation VHDL Dr. MOHAMMED ZAKARYA BABA-AHMED
88
Université Hassiba Benbouali de Chlef Master 1 Télécommunication
Faculté de Technologie option : systèmes des Télécommunications
Dépa te e t d’Elect o i ue
entity registre_decalage is
port ( clk, reset :in std_logic;
d : in std_logic;
q : out std_logic_vector (3 downto 0));
end registre_decalage;
Description simple
architecture Description_simple of registre_decalage is
signal S: std_logic_vector (3 downto 0);
begin
process (d, reset, clk)
begin
if reset= '1' then S<="0000";
else if clk’event and clk= '1' then
S(3) <= d;
S(2) <= S(3); ou S(2 downto 0) <= S(3 downto 1);
S(1) <= S(2);
S(0) <= S(1);
else S <= S;
end if;
end process;
q<= S;
end Description_simple;
Description en boucle
architecture Description_boucle of registre_decalage is
signal S: std_logic_vector (3 downto 0);
begin
process (d, reset, clk)
begin
if reset= '1' then S<="0000";
else if clk’event and clk= '1' then
S(3) <= d;
U1: for i in 0 to 2 loop
S(i) <= S(i + 1);
End loop U1;
end if;
end if;
end process;
q<= S;
end Description_boucle;
FPGA et programmation VHDL Dr. MOHAMMED ZAKARYA BABA-AHMED
89