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

Université Saad Dahlab blida

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

Master 1 Electronique d’instrumentation

Préparer par :
Lamri yasmine

DEVOIR N°1

04/07/2020

Le 15/05/2020
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


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 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 xor B) xor (B xor C);
15 end flot de données ;

2
b) 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
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 ;
11 - - Description comportementale
12 architecteure comp_ sans_ process of exo1_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

3
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 ”001”
16 ‘1’ when ”011”
17 ‘1’ when ”100”
18 ‘1’ when ”110”
19 ‘O’ when ”others ;
20 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
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’ ;

4
24 when others=> S <=’0’ ;
25 end case ;
26 end process ;
27 end comp_ avec_ 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_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=’0’ and C=’1’) or (A=’1’ and C=’0’) them
17 S <=’1’ ;
18 else S <=’0’ ;
19 end if ;
20 end process ;
21 end comp_ avec_ process ;

III. EXERCICE N°3


 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)

5
 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 ;

IV. EXERCICE N°4


la description VHDL structurelle du circuit suivant :

 La description du XOR :

6
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 ;

7
 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 ;

8
9

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