Вы находитесь на странице: 1из 34

Université Saad Dahlab blida

Département d’Elécronique
Module : VHDL-FPGA

Master 1 Electronique d’instrumentation

Préparer par :
Lamri yasmine

EXERCICES PLD-FPGA

26/09/2020

Le 15/05/2020
Chapitre 1 et 2
I. EXERCICE N°1
le schéma d’un PLA (Programmable Logic Array) à 3 entrées A , B , C et deux sorties X et Y permettant
de réaliser les fonctions suivantes : A B C

Compte Microsoft
[Nom de la société]
[Date]

X Y

II. EXERCICE N°2


le schéma d’un PLA (Programmable Logic Array) à 3 entrées A , B , C et deux sorties X et Y permettant
de réaliser les fonctions suivantes : A B C

X Y

2
III. EXERCICE N°3
le schéma d’un PLA (Programmable Logic Array) à 3 entrées A , B , C et deux sorties X et Y permettant
de réaliser les fonctions suivantes : A B C

X Y

IV. EXERCICE N°4


Les circuits logiques programmables (également appelés PLD) sont utilisés
pour remplacer l’association de plusieurs boîtiers logiques. Le câblage est
simplifié, l’encombrement et le risque de pannes est réduit. Certains PLD ne
permettent pas la relecture de la fonction logique programmée, c’est pratique
lorsque le programme doit rester confidentiel.

Ces circuits disposent d’un certain nombre de broches d’entrées et de sorties.


L’utilisateur associe ces broches aux équations logiques (plus ou moins
complexes) qu’il programme dans le circuit.

1. Les PAL

3
Ce sont les circuits logiques programmables les plus anciens. Les PAL sont
programmés par destruction de fusibles. Ils ne sont donc programmables
qu’une fois, ce qui peut être gênant en phase de développement. Un PAL
permet de remplacer jusqu’à 10 boîtiers SSI ou 2 à 3 boîtiers MSI.
 
 

1. Principe d’un PAL

2. Exemple de programmation d’un PAL

2. Les GAL

L’appellation GAL est une marque déposée de LATTICE SEMICONDUCTOR qui a été


la première société à proposer sur le marché ce type de produits. D’autres marques
proposent des équivalents (compatibles) commercialisés sous le nom de PAL CMOS,
E2PAL ou encore PAL EECMOS.

Les GAL sont des PAL effaçables électriquement, qui utilisent la


technologie CMOS.
4
3.Les EPLD

Ces circuits ont une capacité en nombre de portes et en possibilités de


configuration est supérieure à celle des GAL.

Historiquement, les premiers EPLD étaient des GAL effaçables aux U.V. Il
existe maintenant des EPLD effaçables électriquement.

Les pLSI et ispLSI de LATTICE sont à mi-chemin entre les EPLD et les FPGA.

4.Les FPGA

Apparus il y a seulement quelques années, les FPGA sont assimilables à des


ASIC programmables par l’utilisateur.

V. EXERCICE N°5
Les technologies à fusibles :

-Circuits de faible densité.

-La programmation permet de supprimer la connexion.

-Toutes les connexions sont établies à la fabrication.

- Son principe est d’appliquer une tension de 12 à 25v (tension de claquage) aux bornes du fusible.

-La programmation dans cette technologie est irréversible.

5
PLD : programmable logic device.
SPLD : Simple programmable logic device.
CPLD : complexe programmable logic device.
FPGA : field programmable gate array.
PROR : programmable read only memory.
PAL : programme array logic.
PLA : programme logic array.

VI. EXERCICE N°6

6
les équations logiques des sorties S0, S1,S2 et S3 en fonction des entrées A,B,C et D du circuit PAL :

S0=A+ D́B+ D́C=A+ D́(B+C)


S1= D́ Ć BA +DC B́ Á =DC⨁ BA
S2=C B́ A
S3=BA+ D́ Ć
Chapitre 3 et 4
I. EXERCICE N°1

a) La Description VHDL par flot de données :


Le programme on VHDL :

CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo1_a is

7
7 port( A,B,C :in std_logic ;
8 S : out std_logic );
9
10 end exo1_a ;
11 - - Description comportementale
12 architecteure flot_de_données of exo1_a is
13 begin
14 S <= (A and not (B)) or (B and not (C));
15 end flot de données ;

b) La Description VHDL comportementale sans process :

la table de vérité :

A B C not not A and not B B and not C S


B C
0 0 0 1 1 0 0 0
0 0 1 1 0 0 0 0
0 1 0 0 1 0 1 1
0 1 1 0 0 0 0 0
1 0 0 1 1 1 0 1
1 0 1 1 0 1 0 1
1 1 0 0 1 0 1 1
1 1 1 0 0 0 0 0
S= Á BĆ +A B́ Ć + A B́C + AB Ć = A B́ (Ć +C)+BĆ ( Á +A)
Ć +C=1 et Á +A=1 donc
S= A B́+BĆ
 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo1_b1 is
7 port( A,B,C :in std_logic ;
8 S : out std_logic );
9
10 end exo1_b1 ;

8
11 - - Description comportementale
12 architecteure comp_ sans_ process of exo1_b1 is
13 begin
14 S <= ‘1’when(A=’1’and B=’0’) or (B=’1’and C=’0’)
15 else ’0’ ;
16 end comp_ sans_ process ;

2eme version :  «  sans process »


 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo1_b2 is
7 port( A,B,C :in std_logic_vector ( 2 downto 0 );
8 S : out std_logic );
9
10 end exo1_b2 ;
11 - - Description comportementale
12 architecteure comp_ sans_ process of exo1_b2 is
13 with A B C select
14 begin
15 S <= ‘1’ when ”010”
16 ‘1’ when ”100”
17 ‘1’when “101”
18 ‘1’when “110”
‘0’ when ”others ;
end comp_ sans_ process ;

c) La Description VHDL comportementale avec process :


 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo1_c1 is
7 port( A,B,C :in std_logic_vector ( 2 downto 0 );
8 S : out std_logic );
9
10 end exo1_c1 ;
11 - - Description comportementale
12 architecteure comp_ avec_ process of exo1_c1 is
13 begin

9
14 process (A B C)
15 begin
16 case A B C is
17 when “000”=> S <=’0’ ;
18 when “001”=> S <=’0’ ;
19 when “010”=> S <=’1’ ;
20 when “011”=> S <=’0’ ;
21 when “100”=> S <=’1’ ;
22 when “101”=> S <=’1’ ;
23 when “110”=> S <=’1’ ;
24 when others=> S <=’0’ ;
25 end case ;
26 end process ;
27 end comp_ avec_ process ;

2eme version :  «  avec process »


 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo1_c2 is
7 port( A,B,C :in std_logic ;
8 S : out std_logic );
9
10 end exo1_c2 ;
11 - - Description comportementale
12 architecteure comp_ avec_ process of exo1_c2 is
13 begin
14 process (A B C)
15 begin
16 if (A=’1’ and B=’0’) or (B=’1’ and C=’0’) them
17 S <=’1’ ;
18 else S <=’0’ ;
19 end if ;
20 end process ;
21 end comp_ avec_ process ;

II. EXERCICE N°2


a. La Description VHDL par flot de données :
Le programme on VHDL :

CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module

10
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo2_a is
7 port( A,B,C :in std_logic ;
8 S : out std_logic );
9
10 end exo2_a ;
11 - - Description comportementale
12 architecteure flot de données of exo2_a is
13 begin
14 S <= (A xor B) xor (B xor C);
15 end flot de données ;

d) La Description VHDL comportementale sans process :

la table de vérité :

A B C A xor B B xor C S
0 0 0 0 0 0
0 0 1 0 1 1
0 1 0 1 1 0
0 1 1 1 0 1
1 0 0 1 0 1
1 0 1 1 1 0
1 1 0 0 1 1
1 1 1 0 0 0
S= Á B́C+ Á BC +A B́ Ć +ABĆ = Á C(B+ B́)+AĆ (B+ B́)
B+ B́=1 donc
S= Á C+AĆ =A⨁ C
 Le programme
CODE : VHDL

11
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo2_b1 is
7 port( A,B,C :in std_logic ;
8 S : out std_logic );
9
10 end exo2_b1 ;
11 - - Description comportementale
12 architecteure comp_ sans_ process of exo2_b1 is
13 begin
14 S <= ‘1’when(A=’0’and C=’1’) or (A=’1’and C=’0’)
15 else ’0’ ;
16 end comp_ sans_ process ;

2eme version :  «  sans process »


 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo2_b2 is
7 port( A,B,C :in std_logic_vector ( 2 downto 0 );
8 S : out std_logic );
9
10 end exo2_b2 ;
11 - - Description comportementale
12 architecteure comp_ sans_ process of exo2_b2 is
13 with A B C select
14 begin
15 S <= ‘1’ when ”001”
16 ‘1’ when ”011”
17 ‘1’ when ”100”
18 ‘1’ when ”110”
19 ‘O’ when ”others ;
20 end comp_ sans_ process ;

e) La Description VHDL comportementale avec process :


 Le programme
CODE : VHDL

12
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo2_c1 is
7 port( A,B,C :in std_logic_vector ( 2 downto 0 );
8 S : out std_logic );
9
10 end exo2_c1 ;
11 - - Description comportementale
12 architecteure comp_ avec_ process of exo2_c1 is
13 begin
14 process (A B C)
15 begin
16 case A B C is
17 when “000”=> S <=’0’ ;
18 when “001”=> S <=’1’ ;
19 when “010”=> S <=’0’ ;
20 when “011”=> S <=’1’ ;
21 when “100”=> S <=’1’ ;
22 when “101”=> S <=’0’ ;
23 when “110”=> S <=’1’ ;
24 when others=> S <=’0’ ;
25 end case ;
26 end process ;
27 end comp_ avec_ process ;

2eme version :  «  avec process »


 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo2_c2 is
7 port( A,B,C :in std_logic ;
8 S : out std_logic );
9
10 end exo2_c2 ;
11 - - Description comportementale
12 architecteure comp_ avec_ process of exo2_c2 is
13 begin
14 process (A B C)
15 begin
16 if (A=’0’ and C=’1’) or (A=’1’ and C=’0’) them
17 S <=’1’ ;
18 else S <=’0’ ;
13
19 end if ;
20 end process ;
21 end comp_ avec_ process ;

III. EXERCICE N°3


 la description comportementale VHDL :

sum= a + b si sel= 0
sum = c + d si sel = 1
 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4 Use ieee.std_logic_unsigned.all ;
5
6 - - Description externe
7 entity exo3 is
8 port( a,b,c,d :in std_logic_vector ( 7 downto 0 ) ; 
9 sel :in std_logic ; 
10 sum: out std_logic_vector ( 7 downto 0 ) ) ;
11
12 end exo3 ;
13 - - Description comportementale
14 architecteure comportementale of exo3 is
15 signal S1,S2: std_logic_vector ( 7 downto 0 ) ; 
16 begin
17 process (a,b,c,d,sel)
18 begin
19 if SEl ='0' then
20 S1<=a ;
21 S2<=b ;
22 else
23 S1<=c ;
24 S2<=d ;
25 end if ;
26 end process ;
27 sum<=S1=S2 ;
28 end comportementale ;

14
IV. EXERCICE N°4
la description VHDL(description comportementale) d’un décodeur trois entrées et huit sorties :

 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity decodeur_3V8 is
7 port(E :in std_logic_vector ( 2 downto 0 ) ; 
8 S: out std_logic_vector ( 7 downto 0 ) ) ;
9
10 End decodeur_3V8 ;
11 - - Description comportementale
12 architecteure comportementale of decodeur_3V8 is
13 begin
14 process (E)
15 begin
16 case E is
17 when “000”=> S <=”00000001” ;
18 when “001”=> S <=”00000010” ;
19 when “010”=> S <=”00000100” ;
20 when “011”=> S <=”00001000” ;
21 when “100”=> S <=”00010000” ;
22 when “101”=> S <=”00100000” ;
23 when “110”=> S <=”01000000” ;
24 when others=> S <=”10000000” ;
end case ;

15
25 end process ;
26 end comportementale ;
27

V. EXERCICE N°5

le circuit suivant constitué de deux bascules D activant sur le front montant de l’horloge.

La Description VHDL comportementale :

 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo5 is
7 port( E ,CLK :in std_logic ;
8 A , B : out std_logic );
9
10 end exo5 ;
11 - - Description comportementale
12 architecteure description of exo5 is
13
14 signal S1,S2 : std_logic ;
15
16 begin
17 process (CLK)
18 begin
19 if CLK ='1' and CLK'event then
20 -- Ou if rising_edge(clk) then
21
22
16
23 S1<=E ;
24 S2<=S1 ;
25 end if ;
26 end process ;
27 A<=E xor S2 ;
28 B<=S2 xor S1 xor E ;
end description ;

VI. EXERCICE N°6


la description VHDL comportementale (en utilisant l’instruction CASE) d’un transcodeur à 8 entrées
E(7 :0) et 3 sorties S(2 :0) donné par par sa table de vérité :

 Le programme :
CODE : VHDL

17
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo6 is
7 port( E :in std_logic_ vector ( 7 downto 0 ) ;
8 S : out std_logic_vector ( 2 downto 0 )) ;
9
10 end exo6 ;
11 - - Description comportementale
12 architecteure comp_avec_case of exo6 is
13 begin
14
15 process (E)
16 begin
17 case E is
18 when "00000001"=> S <="000" ;
19 when "00000010"=> S <="001" ;
20 when "00000100"=> S <="010" ;
21 when "00001000"=> S <="011" ;
22 when "00010000"=> S <="100" ;
23 when "00100000"=> S <="101" ;
24 when "01000000"=> S <="110" ;
25 when "10000000"=> S <="111" ;
26 -- Ou when others => S <="111" ;
27 end case ;
28 end process ;
29 end comp_avec_case ;

VII. EXERCICE N°7


Soit la description VHDL suivante :

18
a. Le schéma correspondant (logigramme) :

b. C’est description comportementale car le système est décrit par des équations et des
comportements.
c. Le processus P1 est-il combinatoire car il n’est pas par une horloge et ne contient
pas des bascules.
d. La fonction de ce circuit : Additionneur complet 1 bit. Y=X1+X2+X3 si sel=0 et
Y=Rentenu de X1+X2+X3 si sel=1

19
VIII. EXERCICE N°8
La description VHDL du circuit suivant constitué d’un multiplexeur à deux entrées et d’une bascule D.
Tous les signaux mis en jeu sont du type « standard logique ».

 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo8 is
7 port( A,B,CLK,SEL :in std_logic ;
8 S1 , S2 : out std_logic );
9
10 end exo8 ;
11 - - Description comportementale
12 architecteure description of exo8 is
13
14 signal SG1,SG2,SG3 : std_logic ;
15
16 begin
17 SG1<=A xor B ;
18 SG2<=A and B ;
19 process (SEL)
20 begin
21 if SEL=’1’ then
22 SG3<=SG1 ;
23 else
24 SG3<=SG2 ;
25 end if ;
26 end process ;
27 process (CLK, SG3)
28 begin
if CLK ='1' and CLK'event then
-- Ou if rising_edge(clk) then
S1<=SG3 ;
S2<=not(SG3) ;
end if ;

20
end process ;
S1<=Q ;
S2<=not Q ;
end description ;

IX. EXERCICE N°9


la description VHDL d’un compteur binaire permettant de compter de 0 à 23, avec une entrée de
mise à zéro « RESET » asynchrone de l’horloge CLK.

 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4 Use ieee.numeric_std.all ;
5 use ieee . std_logic_unsigned.all ;
6
- - Description externe
7
8 entity compteur is
port( RESET ,CLK :in std_logic ;
9
10 S : out std_logic_vector ( 4 downto 0 ));
11
12 end compteur ;
- - Description comportementale
13
14 architecteure description of compteur is
15
16 begin
process (RESET,CLK)
17
18 begin
if RESET=’1’ then
19
20 comp<=  "00000" ;
elseif comp > 23 then
21
22 comp<="00000" ;
elseif (CLK ='1' and CLK'event ) then
23
24 -- Ou if rising_edge(clk) then
25 comp<=  comp+1 ;
26 end if ;
27 end process ;

21
28 A<=comp ;
29 end description ;

X. EXERCICE N°10
XI. EXERCICE N°11

 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity CLK_gen is
7 port (CLK :in std_logic ;
8 S : out std_logic);
9
10 end CLK_gen ;
11 - - Description comportementale
12 architecteure description of CLK_gen is
13 signal cmp :integer range 0 to 1000000
14 begin
15 process (CLK)
16 begin
17 if (CLK ='1' and CLK'event ) then
18 -- Ou if rising_edge(clk) then
19 cmp<=  cmp+1 ;
20 S<=’0’ ;
21 if cmp=999999 then
22 cmp<=0 ;
23 S<=’1’ ;
24 end if ;
25 end if ;
26 end process ;
27 end description ;

22
XII. EXERCICE N°12
a. la description VHDL d’un compteur 3 bits avec remise à zéro(RESET) asynchrone :
 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4 Use ieee.std_logic_arith.all ;
5 use ieee . std_logic_unsigned.all ;
6
- - Description externe
7
8 entity compteur is
port( RESET ,CLK :in std_logic ;
9
10 q : out std_logic_vector ( 2 downto 0 ));
11
12 end compteur ;
- - Description comportementale
13
14 architecteure description of compteur is
begin
15
16 process (CLK, RESET)
begin
17
18 if RESET=’1’ then
q<= (others=>’0’) ;- - ou q<= "000" ;
19
20 elsif CLK’event and CLK=’1’ then
q<=q+1 ;
21
22 end if ;
end if ;
23
24 end process ;
end description ;
25

b. la description VHDL d’un compteur 3 bits avec remise à zéro(RESET) synchrone :


 Le programme :
CODE : VHDL

23
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4 Use ieee.std_logic_arith.all ;
5 use ieee . std_logic_unsigned.all ;
6
- - Description externe
7
8 entity compteur is
port( RESET ,CLK :in std_logic ;
9
10 q : out std_logic_vector ( 2 downto 0 ));
11
12 end compteur ;
- - Description comportementale
13
14 architecteure description of compteur is
begin
15
16 process (CLK)
begin
17
18 if CLK’event and CLK=’1’ then
if RESET=’1’ then
19
20 q<= (others=>’0’) ;- - ou q<= "000" ;
else
21
22 q<=q+1 ;
end if ;
23
24 end if ;
end process ;
25
26 end description ;

XIII. EXERCICE N°13


 la description comportementale VHDL d’un compteur 4 bits avec entrée de remise à zéro
RESET asynchrone et entrée de pré-chargement LOAD synchrone, les 2 signaux étant
actifs au niveau haut.

Remise à zéro asynchrone du compteur (RESET)


Rechargement synchrone (si « LOAD =’1’ alors on transfert l’entrée DATA en sortie
Q)

24
 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4 Use ieee.numeric_std.all ;
5 Use ieee.std_logic_unsigned.all ;
6 - - Description externe
7 entity CMP4BITS is
8 port( LOAD,RESET,CLK :in std_logic ;
9 DATA :in std_logic_vector ( 3 downto 0 ) ; 
10 Q : out std_logic_vector ( 3 downto 0 ) ) ;
11
12 end CMP4BITS ;
13 - - Description comportementale
14 architecteure description of CMP4BITS is
15 signal Q: std_logic_vector ( 3 downto 0 ) ; 
16 begin
17 process (RESET,CLK)
18 begin
19 if RESET ='1' then
20 Q <=(others=>'0') ; -- Remise à zero asynchrone du compteur
21 elsif (CLK ='1' and CLK'event) then
22 -- Ou elsif (rising_edge(clk)) then
23 if (LOAD ='1') then
24 Q <= DATA ; -- Préchargement synchrone
25 end if ;
26 end if ;
27 end process ;
28 end description ;

XIV. EXERCICE N°14

a. La description structurelle en VHDL du registre à décalage à droit :

 Le programme

25
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 - - description de la bascule D
3 library ieee ;
4 use ieee . std_logic_1164.all ;
5 - - Description externe
6 entity FFD is
7 port( DATA_D :in std_logic ;
8 CLK_D :in std_logic ; 
9 Q_D : out std_logic ) ;
10
11 end FFD ;
12 - - Description comportementale
13 architecteure description of FFD is
14 signal Sig: std_logic=’0’; 
15 begin
16 process (CLK_D)
17 begin
18 if rising_edge(CLK_D) then
19 Sig_D<=DATA_D ;
20 Else
21 Sig_D<=Sig_D ;
22 end if ;
23 end process ;
24 Q_D <=Sig_D;
25 end description ;
26 - - description structurel
27 library ieee ;
28 use ieee . std_logic_1164.all ;
29 - - Description externe
30 entity registre is
31 port( DATA  :in std_logic ; 
32 CLK :in std_logic ; 
33 Q : out std_logic_vector ( 2 downto 0 )) ; 
34
35 end registre ;
36 - - Description comportementale
37 architecteure RTL_Registre of component FFD is
38 port(CLK_D :in std_logic ;
39 DATA_D :in std_logic ;
40 Q_D :in std_logic ) ; 
41
42 end component FFD ;
43 signal Q0,Q1,Q2 : std_logic ;
44 begin
45 B1 :FFD port map(CLK,DATA,Q0) ;
46 B2 :FFD port map(CLK,DATA,Q1) ;
47 B3 :FFD port map(CLK,DATA,Q2) ;
48
49 end RTL_registre ;

26
b. La description comportementale en VHDL du registre à décalage à droit :

 Le programme
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 - - Description comportementale
3 library ieee ;
4 use ieee . std_logic_1164.all ;
5 - - Description externe
6 entity exo14 is
7 port( DATA  :in std_logic ; 
8 CLK :in std_logic ; 
9 Q : out std_logic_vector ( 2 downto 0 )) ; 
10
11 end exo14 ;
12 - - Description comportementale
13 architecteure comportementale of exo14 is
14 signal q_reg : std_logic_vector ( 2 downto 0 ):”000”;
15 begin
16 process (CLK)
17 begin
18 if CLK ='1' and CLK'event then
19 -- Ou if rising_edge(clk) then
20 Q_reg<=DATA q_reg( 2 downto 0 );
21 else q_reg<=q_reg ;
22 end if ;
23 end process ;
24 Q<=q_reg ;
25 end comportementale ;

27
XV. EXERCICE N°15
Soit la description VHDL suivante :

a. le schéma :

A 00

01 D
10

11 CLK

H
b. C’est description comportementale décrit par des équations et des comportemets.
c.
 Le processus P1 est combinatoire car il n’y a pas d’horloge ou de bascules.

28
 Le processus P2 est séquentiel car il contient une horloge H dans sa liste de sensibilité, il
sera a donc décrit par une bascule.

XVI. EXERCICE N°16


XVII. EXERCICE N°17
a)Description en utilisant l’instruction « when….else » :

 Le programme :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity mux_4v1 is
7 port( A ,B,C,D :in std_logic ;
8 SEL: in std_logic_vector ( 1 downto 0 )
9 S: out std_logic) ;
10
11 end mux_4v1 ;
12 - - Description comportementale
13 architecteure description of mux4v1 is
14 begin
15 S<=A when SEL="00" else
16 B when SEL="00" else
17 C when SEL="00" else
18 D when SEL="00" else
19 0 ;
20
21 end description ;

b)Description en utilisant l’instruction « with…select…when » :

 Le programme :
CODE : VHDL

29
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity mux_4v1 is
7 port( A ,B,C,D :in std_logic ;
8 SEL: in std_logic_vector ( 1 downto 0 )
9 S: out std_logic) ;
10
11 end mux_4v1 ;
12 - - Description comportementale
13 architecteure description of mux4v1 is
14 begin
15 with SEL select
16 S<=A when "00"
17 B when "00"
18 C when "00"
19 D when "00"
20 0 when others ;
21
22 end description ;

XVIII. EXERCICE N°18

La Description VHDL comportementale :

 Le programme :

30
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity exo18 is
7 port( E ,H :in std_logic ;
8 S1, S2 : out std_logic );
9
10 end exo18 ;
11 - - Description comportementale
12 architecteure description of exo18 is
13
14 signal SG1,SG2 : std_logic ;
15
16 begin
17 process (H)
18 begin
19 if H ='1' and H'event then
20 -- Ou if rising_edge(H) then
21
22 SG1<=E ;
23 SG2<=SG1 ;
24 end if ;
25 end process ;
26 S1<=E xor S2 ;
27 S1<=SG2 or SG1 or E ;
28 end description ;

XIX. EXERCICE N°19


la description VHDL structurelle du circuit suivant :

31
 La description du XOR :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity XOR is
7 port( I1,I2 :in std_logic ;
8 out : out std_logic );
9
10 end XOR ;
11 - - Description comportementale
12 architecteure description of XOR is
13 begin
14 out<= I1 xor I2 ;
15 end description ;

 La description de l’inversseur :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity inversseur is
7 port( I :in std_logic ;
8 out : out std_logic );
9
10 end inversseur ;
11 - - Description comportementale
12 architecteure description of inversseur is
13 begin
14 out<= not I ;
15 end description ;

32
 La description structurelle  :
CODE : VHDL
1 - - Déclaration des paquetages utiles pour le module
2 library ieee ;
3 use ieee . std_logic_1164.all ;
4
5 - - Description externe
6 entity description_struct is
7 port( A ,B ,C :in std_logic ;
8 S : out std_logic );
9
10 end description_struct ;
11 - - Description comportementale
12 architecteure description of description_struct is
13
14 component xor
15 port (I1 ,I2 : in std_logic ;
16 out : out std_logic );
17 end component ;
18
19 component inversseur
20 port (I : in std_logic ;
21 out : out std_logic );
22 end component ;
23
24 signal S1,S2 : std_logic ;
25
26 begin
27
28 XOR1 : xor port map (A ,B,S1) ;
29 XOR2 : xor port map (S1 ,B,S2) ;
30 INV : inversseur port map (S2,S) ;
31
32 end description ;

33
34

Вам также может понравиться