Vous êtes sur la page 1sur 15

Université Sultan Moulay Slimane

Ecole Supérieur de Technologie de Béni Mellal (ESTBM)

Licence professionnelle
Semestre 6
Module : Conception des
Systèmes Embarqués

Série II

ESTBM – Pr. EL DAOUDI


Exercice 1 :
Ecrire un programme en VHDL pour un demi-additionneur.

2
Corrigé de l’exercice 1 :
-- Déclaration des bibliothèques utilisées
library IEEE;
use IEEE.std_logic_1164.all;

-- Déclaration de l'entité du demi-additionneur (half-adder).


entity HA is
port (A, B: in std_logic;
S, C: out std_logic);
end HA;

-- Déclaration de l'architecture en flot de données.


architecture arch_HA of HA is
begin
S <= A xor B;
C <= A and B;
end arch_HA;
3
Exercice 2 :
Ecrire un programme en VHDL du modèle combinatoire simple représenté ci-dessous :

4
Corrigé de l’exercice 2 :

library IEEE; architecture flotDeDonnees of add3bits is


use IEEE.STD_LOGIC_1164.ALL; signal T1 : std_logic;
entity add3bits is signal T2 : std_logic;
port ( signal T3 : std_logic;
Cin : in std_logic; begin
X : in std_logic; S <= T1 xor Cin;
Y : in std_logic; Cout <= T3 or T2;
Cout : out std_logic; T1 <= X xor Y;
S : out std_logic); T2 <= X and Y;
end add3bits; T3 <= Cin and T1;
end flotDeDonnees;

5
Exercice 3 :

Ecrire un programme en VHDL pour un multiplexeur 4-1 avec un « WHEN » avec deux entrées de sélection.

SEL0 SEL1 S
0 0 E0
0 1 E1
1 0 E2
1 1 E3

6
Corrigé de l’exercice 3 :

library ieee; architecture BEHAV_MUX of MUX is

use ieee.std_logic_1164.all; Begin

use ieee.std_logic_arith.all; process (E0, E1, E2, E3, SEL0, SEL1)

use ieee.std_logic_unsigned.all; begin


S <= E0 when (SEL0='0' and SEL1='0') else

entity MUX is E1 when (SEL0='0' and SEL1='1') else

port (E0, E1, E2, E3, SEL0, SEL1: in std_logic; E2 when (SEL0='1' and SEL1='0') else

S: out std_logic); E3;

end; end process;


end BEHAV_MUX;

7
Exercice 4 :

Ecrire un programme en VHDL pour un multiplexeur comportemental 4 vers 1 et une entrée de sélection d’un
2 bits avec CASE.

8
Corrigé de l’exercice 4 :
architecture CMP of MUX is
begin
process (E0, E1, E2, E3, SEL)
library ieee;
begin
use ieee.std_logic_1164.all;
case SEL is
when "00" => S <= E0;
entity MUX is
when "01" => S <= E1;
port (E0, E1, E2, E3: in std_logic;
when "10" => S <= E2;
SEL: in std_logic_vector(1 downto 0);
when "11" => S <= E3;
S: out std_logic);
end case;
end MUX;
end process;
end CMP;

9
Exercice 5 :

Donner le code VHDL d’un compteur de 0 à 9.

Description : Il s’agit de créer un circuit qui compte de 0 à 9. L’évènement qui incrémente le compteur est le
front montant d’horloge. Quand le compteur vaut 9 et que survient un nouveau front montant, il doit être remis
à 0.

10
architecture behav of compteur is
signal count : integer range 0 to 9; -- signal interne
begin
Corrigé de l’exercice 5 :
process ( clock ) -- Process sensible à l’horloge
begin
if rising_edge ( clock ) then -- if (CLK’ event and CLK=1) then -- au
library ieee ; -- On inclus la librairie IEEE front montant
use ieee.std_logic_1164.all ; if count < 9 then -- Si le compteur a une valeur inférieure à 9
use ieee.std_logic_arith.all ; count <= count + 1; -- On met le compteur à la valeur prochaine
entity compteur is -- Définition des entrées/sorties else
port (clock : in std_logic ; count <= 0; -- Sinon on met le compteur à 0
digit : out integer range 0 to 9); end if;
end compteur; end if;
end process ;
digit <= count ;

11
end behav;
Exercice 6 :

Ecrivez une description en VHDL à partir du circuit suivant :

S1

S3

S2

12
Corrigé de l’exercice 6 :
process (SEL)
begin
if SEL='0’ then
library ieee ;
S3<=S1;
use ieee.std_logic_1164.all ;
else
entity exercice is
S3<=S2;
port (A, B, SEL,CLK : in std_logic;
end if;
Out: out std_logic);
end process;
end exercice;
process (CLK,S3)
architecture desc of exercice is
begin
signal S1,S2,S3 : std_logic;
if (CLK' event and CLK=1) then
begin
Out<=S3;
Sl<=A xor B;
end if;
S2<= A and B;
end process;
end desc;
13
Exercice 7 :

Ecrivez une description en VHDL à partir du circuit suivant :

𝐴𝑁𝐷1

𝐼𝑁𝑇1

𝐴_𝐼𝑁 𝐴𝑁𝐷1
𝑂𝑅1

𝐼𝑁𝑇2
𝐵_𝐼𝑁 𝑍_𝑂𝑈𝑇

𝐶_𝐼𝑁
𝐴𝑁𝐷1

𝐼𝑁𝑇3

14
entity MAJORITY is
Corrigé de l’exercice 7 :
port (A_IN, B_IN, C_IN: in BIT;

entity AND1_OP is Z_OUT : out BIT);

port (A, B : in BIT; end MAJORITY;

C : out BIT); architecture struct of MAJORITY is

end AND1_OP ; ----Déclarer des signaux pour interconnecter les opérateurs logiques

architecture MODEL1 of AND1_OP is signal INT1, INT2, INT3 : BIT;

begin --Déclarer les opérateurs logiques

C <= A and B; component AND1_OP

end MODEL1; port (A, B : in BIT; C : out BIT);


end component;
entity OR1_OP is
component OR1_OP
port (U, V, W : in BIT;
port (U, V, W : in BIT; Z : out BIT);
Z : out BIT);
end component;
end OR1_OP ;
begin
architecture MODEL2 of OR1_OP is
A1: AND1_OP port map (A => A_IN,B => B_IN,C => INT1);
begin
A2: AND1_OP port map (A => A_IN,B => C_IN,C => INT2);
Z <= U or V or W;
A3: AND1_OP port map (A => B_IN,B => C_IN,C => INT3);
end MODEL2;
A4: OR1_OP port map (U => INT1,V => INT2,W => INT3,Z => Z_OUT)
15 end struct;

Vous aimerez peut-être aussi