Serie TD1

Télécharger au format pdf ou txt
Télécharger au format pdf ou txt
Vous êtes sur la page 1sur 5

ECOLE NATIONALE POLYTECHNIQUE

1° ANNEE ELN
Modélisation et Synthèse des Circuits Logiques

1° Année Notions de Base


Série d’Exercices
VHDL
VHDL : VHSIC Hardware Description
Language
VHSIC : Very High Speed Integrated
Circuit

Langage de description
de matériel utilisé pour
la modélisation du
fonctionnement, la
simulation et la
synthèse automatique de
circuits

Flot de Conception d’un circuit numérique

ENP/ ELN/ 1 Année Modélisation et Synthèse de Circuits Logiques MSCL


Taghi Serie de TD N°1 Page 1
Exercices
Exercice1
Décrire en VHDL la Porte AND3 réalisant la fonction logique ET de 3 variables booléennes.
Flot de données (équations logiques)
entity AND_3 is
port( e1 : in bit ;
e2 : in bit ;
e3 : in bit ;
s : out bit );
end entity;
-- on peut également écrire :
-- end entity AND_3;
-- ou -- end AND_3
architecture arc of AND_3 is
begin s <= e1 and e2 and e3;
end arc;

Exercice 2
Signaux internes
Signaux (fils de liaison) servent à passer les résultats intermédiaires d'un bloc fonctionnel à un autre
Décrire en Vhdl l’architecture DF du circuit donné sur le schéma suivant de 2 manières différentes
Entity AOI is • Avec des signaux internes
Port ( architecture V2 of AOI
A, B, C,D : in BIT; is
F : out Bit --zone de declaration
); des signaux
End Entity; signal AB,CD,O: BIT;
begin
• Sans signaux internes --instructions
architecture V1 of AOI concurrentes
is AB <= A and B;
Begin CD <= C and D;
F <= not ((A and B) or O <= AB or CD;
(C and D)); F <= not O;
end architecture V1; end V2;

Exercice 3
Donner la description vhdl, de la porte AND3 en utilisant le style table de vérité
Flot de données, Style Table de vérité (Avec "with select when")
ENTITY AND3 IS
PORT(
E : in BIT_VECTOR(2 DOWNTO 0); -- 3 entrées
s : out BIT; -- 1 sortie
END ENTITY;

ARCHITECTURE Arc_tt OF AND3 IS


BEGIN
WITH E SELECT
s <= ‘1’ WHEN "111",
‘0’ WHEN OTHERS;
END Arc_tt ;

ENP/ ELN/ 1 Année Modélisation et Synthèse de Circuits Logiques MSCL


Taghi Serie de TD N°1 Page 2
Exercice 4 FULL ADDER
Etant Donné Les équations Logiques D’un Additionneur Complet, Ecrire Le Code Vhdl décrivant Ce Circuit En
Utilisant Ces Equations

Description Flot de Données


entity add1 is
port (
opa, opb, cin: in bit; -- opérandes, retenue entrante
sum, cout : out bit -- somme, retenue sortante
);
end entity add1;
architecture dfl of add1 is
begin
sum <= opa xor opb xor cin ;
cout <= (opa and opb) or (opa and cin) or (opb and cin;
end architecture dfl;

b) Réécrire un programme VHDL pour un additionneur 1 bit avec un style "with select when".
Le style "with select when"
-- ******** VHDL *************
ENTITY adder IS PORT(
e : in BIT_VECTOR(2 DOWNTO 0); -- 3 entrées
s : out BIT_VECTOR(1 DOWNTO 0)); -- 2 sorties
END demo;
ARCHITECTURE aAdder of adder IS BEGIN
With e select
s <= "00" WHEN "000",
"01" WHEN "001",
"01" WHEN "010",
"10" WHEN "011" |"101"|"110" ,
"01" WHEN "100",
"11" WHEN OTHERS;
END aAdder;

c) Refaire le code vhdl de l’additionneur complet utiilisant le style when else


Le style "when else"
ENTITY adder IS PORT(
e : in BIT_VECTOR(2 DOWNTO 0); -- 3 entrées
s : out BIT_VECTOR(1 DOWNTO 0)); -- 2 sorties
END demo;
ARCITECTURE aAdder of adder IS BEGIN

s <= "00" WHEN e= "000" ELSE


"01" WHEN e= "001" ELSE
"01" WHEN e= "010" ELSE
"10" WHEN e="011" |"101"|"110" ELSE
"01" WHEN e="100" ELSE
"11" ;
END aAdder;

ENP/ ELN/ 1 Année Modélisation et Synthèse de Circuits Logiques MSCL


Taghi Serie de TD N°1 Page 3
Exercice 5
ECRIRE LE CODE VHDL DU CIRCUIT Ci-
CONTRE en utilisant des signaux intermédiaires
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity add3bits is
port ( Cin : in std_logic;
X : in std_logic;
Y : in std_logic;
Cout : out std_logic;
S : out std_logic );
end add3bits;
architecture flotDeDonnees of
add3bits is signal T1 : std_logic;
signal T2 : std_logic;
signal T3 : std_logic; begin
S <= T1 xor Cin;
Cout <= T3 or T2;
T1 <= X xor Y;
T2 <= X and Y;
T3 <= Cin and T1;
end flotDeDonnees;
Description structurelle
Exercice 6 Réécrire le modèle vhdl de la porte AND3 en utilisant une description
structurelle à l’aide du composant AND2
entity AND_3 is -- description du (des) composant(s)
port( e1, e2, e3 : in bit ; s:
out bit);
end entity;
architecture arc3 of AND_3 is
signal z : bit;
component and2
port( a, b : in bit ; s : out bit);
end component;
begin
inst1 : and2 port map (a => e1, b => e2, s=> z);
inst2 : and2 port map (z, e3, s);
end arc3;

Exercice 7
Etablir la Description structurelle d’un additionneur 1 BIT EN FONCTION DES PORTES DE BASE
ARCHITECTURE structure OF add1 IS
COMPONENT et PORT(e1,e2:IN std_logic; s:OUT
std_logic);
END COMPONENT;
COMPONENT ou PORT(e1,e2:IN std_logic;s:OUT
std_logic);
END COMPONENT;
COMPONENT oux PORT(e:IN std_logic; s:OUT
std_logic);
END COMPONENT;
SIGNAL f1,f2,f3: 3std_logic;
BEGIN
a1: et PORT MAP (a,b,f1);
a2: et PORT MAP (f3,c,f2);
o1: ou PORT MAP (f1,f2,r);
x1: oux PORT MAP (a,b,f3);
x2: oux PORT MAP (f3,c,s);
END structure;

ENP/ ELN/ 1 Année Modélisation et Synthèse de Circuits Logiques MSCL


Taghi Serie de TD N°1 Page 4
Exercice 8
Ecrire le code VHDL correspondant au circuit Fct ,
Donner une description Data Flow et l’autre
structurelle

Exercice 9
1- Ecrire la description Vhdl du 2- Décrire en vhdl le circuit C2
circuit C1

Exercice 10
Donner le code VHDL d’un Multiplexeur 4-2 dans les 3 styles Flot de données, et proposer
une description structurelle à base de multiplexeurs élémentaires

Exercice 11
Décrire en VHDL un circuit additionneur/soustracteur 4 bits à base de 4 Full Adders.

Exercice 12

Donner le code VHDL du circuit UALM4


qui effectue la somme ou le produit modulo 4
de deux entiers de 2 bits chacun.

Choisir la description la plus adaptée.

ENP/ ELN/ 1 Année Modélisation et Synthèse de Circuits Logiques MSCL


Taghi Serie de TD N°1 Page 5

Vous aimerez peut-être aussi