You are on page 1of 71

ENSL1

ENSL1 :
Electronique numrique et synthse logique Logique combinatoire

1
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Logique combinatoire et squentielle :


Soit le circuit :
e0 e1 en-1 s0 sm-1

Ce circuit sera dit combinatoire si, chaque fois quon lui prsente une mme combinaison en entre, il donnera toujours la mme rponse en sortie. Il sera dit squentiel si, une mme combinaison en entre, prsente des instants diffrents, peut donner des rponses diffrentes en sortie.

2
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Circuits combinatoires
Dcodeurs Binaire naturel binaire rflchi Dcodeur 2 4, 3 8, BCD 7 segments, Encodeurs Encodeur 4 2, 8 3,
Encodeur de priorit

Multiplexeur Multiplexeur 2 1, 4 1, Dmultiplexeur Dmultiplexeur 1 2, 1 4, Additionneur /Soustracteur Comparateur Unit Arithmtique et logique (A.L.U)
3
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Mthode de conception dune fonction combinatoire


Comment trouver le schma (logigramme) correspondant une fonction combinatoire que lon souhaite raliser ?
1/ 2/ 3/ 4/ 5/ Bien comprendre le problme pos. Faire le bilan des entres et des sorties. Etablir la table de vrit correspondant au comportement de la fonction. Avec laide (ou pas) de tableaux de Karnaugh, rechercher les quations simplifies de toutes les sorties. Une fois les quations trouves, tablir le schma.

4
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN
1/

BR (Recherche du schma)

Bien comprendre le problme pos.

trouver le schma logique du circuit combinatoire qui gnre une valeur de sortie en binaire rflchie, correspondant une valeur dentre exprime en binaire naturel

2/

Faire le bilan des entres et des sorties.


( la dmarche est la mme pour un autre format )
E2 E1 E0 S2 S1 S0

on dfinit pour cet exemple le format des valeurs dentre/sortie 3 bits

5
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN
3/

BR (Recherche du schma)
E2 E1 E0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 S2 S1 S0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0

Etablir la table de vrit

4/

Recherche des quations des sorties


S2 = E2 S1 = E2 S0 = E1

quations videntes (on exploite les particularits de la table)


E1 E0
6
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN
5/

BR
S2 = E2 S1 = E2 S0 = E1 E1 E0

(Recherche du schma)
Etablir le schma
E2 E1 E0
E2
INPUT VCC XOR OUTPUT OUTPUT

S2

E1

INPUT VCC

S1

S2 S1 S0

inst
XOR OUTPUT

E0

INPUT VCC

S0

inst2

7
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Mthode de conception dune fonction combinatoire


Comment dcrire en VHDL la fonction combinatoire que lon souhaite raliser ?
1/ 2/ 3/ 4/ Bien comprendre le problme pos. Faire le bilan des entres et des sorties. Ecrire la dclaration dentit. Etablir la table de vrit correspondant au comportement de la fonction. Si les quations sont simples, crire la dclaration darchitecture laide daffectations simples. Si les quations ne sont pas videntes, dcrire directement la table de vrit, dans larchitecture laide daffectations conditionnelles ou slectives.
8
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

5/ 6/

ENSL1

Dcodeur BN
1/

BR (Description VHDL)

Bien comprendre le problme pos.

trouver le schma logique du circuit combinatoire qui gnre une valeur de sortie en binaire rflchie, correspondant une valeur dentre exprime en binaire naturel

2/

Faire le bilan des entres et des sorties.


( la dmarche est la mme pour un autre format )
E2 E1 E0 S2 S1 S0

on dfinit pour cet exemple le format des valeurs dentre/sortie 3 bits

9
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN
3/

BR (Description VHDL)

Ecrire la dclaration dentit.


E2 E1 E0 S2 S1 S0

entity bn_br is port ( E2,E1,E0 : in std_logic; S2,S1,S0 : out std_logic ); end bn_br;

10
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN
4/

BR (Description VHDL)
E2 E1 E0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 S2 S1 S0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0

Etablir la table de vrit

5/

Si les quations sont simples, crire la dclaration darchitecture laide daffectations simples.
Cest le cas S2 = E2 S1 = E2 S0 = E1 E1 E0

11
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN
S2 = E2 S1 = E2 S0 = E1

BR (Description VHDL)
E1 E0

(Description VHDL utilisant des affectations simples)

5/ Dclaration darchitecture
architecture bn_br_arch of bn_br is begin S2 <= E2; S1 <= E2 xor E1; S0 <= E1 xor E0; end bn_br_arch; bn_br_arch

12
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BN

BR (Description VHDL)

6/ Description complte du dcodeur


library ieee; use ieee.std_logic_1164.all; entity bn_br is port ( E2,E1,E0 : in std_logic; S2,S1,S0 : out std_logic ); end bn_br; architecture bn_br_arch1 of bn_br is begin S2 <= E2; S1 <= E2 xor E1; S0 <= E1 xor E0; end bn_br_arch1;

13
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
Dcodeur BN BR (Description VHDL utilisant une affectation conditionnelle) 6/ Description faite directement partir de la table de vrit :
architecture bn_br_arch2 of bn_br is signal entree,sortie : std_logic_vector (2 downto 0); begin entree(2) <= E2; Ne pas oublier dinitialiser les entree(1) <= E1; cases du tableau des entres entree(0) <= E0; avant de lutiliser. sortie <= "000" when entree="000" else "001" when entree="001" else "011" when entree="010" else "010" when entree="011" else "110" when entree="100" else "111" when entree="101" else "101" when entree="110" else "100" ; S2 <= sortie(2); Ne pas oublier daffecter les S1 <= sortie(1); signaux de sorties avant de S0 <= sortie(0); fermer larchitecture end bn_br_arch2; 14
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

E2 E1 E0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

S2 S1 S0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0

ENSL1
Dcodeur BN BR (Description VHDL utilisant une affectation slective) 6/ Description faite directement partir de la table de vrit :

E2 E1 E0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

S2 S1 S0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0

architecture bn_br_arch2 of bn_br is signal entree,sortie : std_logic_vector (2 downto 0); begin entree(2) <= E2; entree(1) <= E1; entree(0) <= E0; with entree select sortie <= "000" when "000" , "001" when "001" , "011" when "010" , "010" when "011" , "110" when "100" , "111" when "101" , "101" when "110" , "100" when others; others; S2 <= sortie(2); S1 <= sortie(1); S0 <= sortie(0); end bn_br_arch2; 15
Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

Michel KRAMMER

ENSL1

Dcodeur 2 4, 3 8, (Recherche du schma)


1/ Bien comprendre le problme pos.

Un dcodeur 2 4 est un circuit 2 entres et 4 sorties. Un dcodeur 3 8 est un circuit 3 entres et 8 sorties. Cest un circuit qui, a un instant donn, na quune seule sortie active, parmi les 4 ou les 8. Cest la sortie dont lindice correspond la valeur dentre. Ltat actif dune sortie peut tre ltat 1 ou ltat 0.

16
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur 2 4 (Recherche du schma)


2/ Faire le bilan des entres et des sorties.

Pour un dcodeur 2 4 , on a donc 2 entres et 4 sorties


( on fait le choix dun tat actif 1 )
0 1 1 0 1 0 1 0

S3

0 1 0 1

E1 E0

S2 S1 S0

17
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur 2 4 (Recherche du schma)


3/ Etablir la table de vrit
E1 E0 0 0 1 1 0 1 0 1 S3 S2 S1 S0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0

4/

Recherche des quations des sorties


S0 = E1.E0 S1 = E1.E0 S2 = E1.E0 S3 = E1.E0

quations videntes

18
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur 2 4
5/

(Recherche du schma)
S0 = E1.E0 S1 = E1.E0 S2 = E1.E0 S3 = E1.E0

Etablir le schma

E1 E0

NOT

AND2 OUTPUT

E1

INPUT VCC

inst3
NOT

S0

S0 S1 S2 S3

inst4
AND2 OUTPUT

E0

INPUT VCC

inst

S1

inst5
AND2 OUTPUT

S2

inst6
AND2 OUTPUT

S3

inst7

19
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur 2 4 (Description VHDL)


6/ Description complte du dcodeur
library ieee; use ieee.std_logic_1164.all; entity dec2_4 is port ( E1,E0 : in std_logic; S3,S2,S1,S0 : out std_logic ); end dec2_4; architecture dec2_4_arch1 of dec2_4 is begin S3 <= E1 and E0; S2 <= E1 and (not E0); S1 <= (not E1) and E0; S0 <= (not E1) and (not E0); end dec2_4_arch1;
20
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BCD 7 segments


1/

(Description VHDL)

Bien comprendre le problme pos.

Un dcodeur BCD 7 segments est un circuit de commande dun afficheur 7 segments. Il gnre en sortie les 7 signaux ncessaires laffichage du symbole hexadcimal, correspondant la valeur binaire dentre comprise entre 0 et 15

2/

Faire le bilan des entres et des sorties.

Il possde 4 entres (valeur binaire de 0 15) , et 7 sorties commandant chacune les segments de lafficheur.

21
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BCD 7 segments


3/ Table de vrit.
E3 E2 E1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 E0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

(Description VHDL)

a b c d e f g S0 S1 S2 S3 S4 S5 S6 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1

22
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
Dcodeur BCD 7 segments Schma interne

23
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Dcodeur BCD 7 segments


Description VHDL Dclaration dentit library ieee; use ieee.std_logic_1164.all;

(Description VHDL)

entity bcd_7seg is port ( E : in std_logic_vector (3 downto 0) ; S : out std_logic_vector (0 to 6) ); end bcd_7seg ;

24
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Dcodeur BCD 7 segments (Description VHDL)


Dclaration darchitecture (en utilisant une affectation conditionnelle) conditionnelle) a E3 E2 E1 E0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 b c d e f g architecture bcd_7seg_arch of bcd_7seg is begin S <= "1111110" when E="0000" else "0110000" when E="0001" else "1101101" when E="0010" else "1111001" when E="0011" else "0110011" when E="0100" else "1011011" when E="0101" else "1011111" when E="0110" else "1110000" when E="0111" else "1111111" when E="1000" else "1111011" when E="1001" else "1110111" when E="1010" else "0011111" when E="1011" else "1001110" when E="1100" else "0111101" when E="1101" else "1001110" when E="1110" else "1000111" ; end bcd_7seg_arch; 25
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2009/2010

S0 S1 S2 S3 S4 S5 S6 1 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1

ENSL1 Dcodeur BCD 7 segments (Description VHDL)

Dclaration darchitecture (en utilisant une affectation slective) slective) a E3 E2 E1 E0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 b c d e f g architecture bcd_7seg_2_arch of bcd_7seg_2 is begin with E select S <= "1111110" when "0000" , "0110000" when "0001" , "1101101" when "0010" , "1111001" when "0011" , "0110011" when "0100" , "1011011" when "0101" , "1011111" when "0110" , "1110000" when "0111" , "1111111" when "1000" , "1111011" when "1001" , "1110111" when "1010" , "0011111" when "1011" , "1001110" when "1100" , "0111101" when "1101" , "1001110" when "1110" , "1000111" when others ; end bcd_7seg_2_arch; 26
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

S0 S1 S2 S3 S4 S5 S6 1 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1

ENSL1 Multiplexeurs 2 1, 4 1 (Recherche du schma)


Les multiplexeurs logiques sont des circuits daiguillage qui :
ne possdent quune sortie et qui possdent deux types dentres : les entres aiguiller, dont le nombre est quasiment toujours une puissance de 2 (2 entres, 4 entres, 8 entres, ) les entres de slection, qui permettent de choisir parmi les entres aiguiller, celle dont ltat logique va se retrouver en sortie

Bilan des entres/sorties pour un multiplexeur 4 1


nombre de sortie : 1 sortie nombre dentres : 4 entres aiguiller + 2 entres de slection
E0 E1 E2 E3

S sel1 sel0

27
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Multiplexeurs 4 1 (Recherche du schma)


E0 E1 E2 E3 S sel1 sel0

Table de vrit
Sel1 Sel0 0 0 1 1 0 1 0 1 S E0 E1 E2 E3

Equation
S = Sel1.Sel0.E0 + Sel1.Sel0.E1 + Sel1.Sel0.E2 + Sel1.Sel0.E3

28
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Multiplexeurs 4 1 (Recherche du schma)


S = Sel1.Sel0.E0 + Sel1.Sel0.E1 + Sel1.Sel0.E2 + Sel1.Sel0.E3

Schma

E3 E2 E1 E0 Sel1 Sel0

AND3

E3

INPUT VCC

inst
AND3

E2

INPUT VCC

OR4

inst7
OUTPUT AND3

E1

INPUT VCC

inst8
AND3

inst11

E0

INPUT VCC

inst9
NOT

Sel1

INPUT VCC INPUT VCC

inst12
NOT

Sel0

inst13

29
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Multiplexeurs 4 1
( 1re Description VHDL utilisant une affectation simple) S = Sel1.Sel0.E0 + Sel1.Sel0.E1 + Sel1.Sel0.E2 + Sel1.Sel0.E3
library ieee; use ieee.std_logic_1164.all; entity mux4_1 is port ( ); end mux4_1; architecture mux4_1_arch1 of mux4_1 is begin S <= ((not Sel1) and (not Sel0) and E0) or ((not Sel1) and Sel0 and E1) or (Sel1 and (not Sel0) and E2) or (Sel1 and Sel0 and E3) ; end mux4_1_arch1; E3,E2,E1,E0,Sel1,Sel0 : in std_logic; S: out std_logic

30
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Multiplexeurs 4 1
conditionnelle) (2me Description VHDL utilisant une affectation

toutes les entres sont dclares sous forme de simple bit


library ieee; use ieee.std_logic_1164.all; entity mux4_1 is port ( end mux4_1; architecture mux4_1_arch2 of mux4_1 is signal sel : std_logic_vector ( 1 downto 0); begin sel(1) <= Sel1; sel(0) <= Sel0; s <= E0 when sel="00" else E1 when sel="01" else E2 when sel="10" else E3 ; end mux4_1_arch2; 31
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

Symbole :
mux4_1 E3 E2 E1 E0 Sel1 Sel0 S

E3,E2,E1,E0,Sel1,Sel0 : in std_logic; S: out std_logic );

inst

Sel1 Sel0 0 0 1 1 0 1 0 1

S E0 E1 E2 E3

ENSL1 Multiplexeurs 4 1
slective ) ( 3me Description VHDL utilisant une affectation

les entres aiguiller sont dclares sous forme de simple bit les entres de slection sont dclares sous forme de BUS
library ieee; use ieee.std_logic_1164.all; entity mux_4_1 is port ( E3,E2,E1,E0 : in std_logic; sel: in std_logic_vector ( 1 downto 0); S: out std_logic ); end mux_4_1; architecture mux_4_1_arch3 of mux_4_1 is begin with sel select s <= E0 when "00" , E1 when "01" , E2 when "10" , E3 when others; end mux_4_1_arch3; 32
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

Symbole :
mux_4_1 E3 E2 E1 E0 sel[1..0] inst1 S

Sel1 Sel0 0 0 1 1 0 1 0 1

S E0 E1 E2 E3

ENSL1 Dmultiplexeurs 1 2, 1 4 (Recherche du schma)


Les dmultiplexeurs sont des circuits daiguillage qui ralisent lopration inverse du multiplexeur :
leur nombre de sorties est quasiment toujours une puissance de 2

(2 sorties, 4 sorties, 8 sorties, )


ils ne possdent quune seule entre aiguiller et des entres de slection, pour choisir la sortie vers laquelle lentre aiguiller sera dirige.

Bilan des entres/sorties pour un dmultiplexeur 1 4


Nombre de sortie : 4 sorties Nombre dentres : 1 entre aiguiller + 2 entres de slection
S0 S1 S2 S3 sel1 sel0

33
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Dmultiplexeur 1 4 (Recherche du schma)


E sel1 sel0 S0 S1 S2 S3

Table de vrit
Sel1 Sel0 0 0 1 1 0 1 0 1 S0 S1 S2 S3 E 0 0 0 0 E 0 0 0 0 E 0 0 0 0 E

Equations
S0 = Sel1.Sel0.E S1 = Sel1.Sel0.E S2 = Sel1.Sel0.E S3 = Sel1.Sel0.E

34
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Dmultiplexeur 1 4 (Schma)


S0 = Sel1.Sel0.E S1 = Sel1.Sel0.E S2 = Sel1.Sel0.E S3 = Sel1.Sel0.E

Schma

AND3

INPUT VCC

OUTPUT

S3

S3 S2 S1 S0

inst5
AND3 OUTPUT

S2

inst6
AND3 OUTPUT

S1

Sel1 Sel0

NOT

Sel1

INPUT VCC

inst7
AND3 OUTPUT

inst
NOT

Sel0

INPUT VCC

S0

inst4

inst8

35
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Dmultiplexeurs 1 4 ( Description VHDL )


library ieee; use ieee.std_logic_1164.all; entity dmux1_4 is port ( E: in std_logic; sel: in std_logic_vector ( 1 downto 0); S3,S2,S1,S0: out std_logic ); end dmux1_4; architecture dmux1_4_arch1 of dmux1_4 is begin S3 <= sel(1) and sel(0) and E ; S2 <= sel(1) and (not sel(0)) and E ; S1 <= (not sel(1)) and sel(0) and E ; S0 <= (not sel(1)) and (not sel(0)) and E ; end dmux1_4_arch1;

Symbole:
dmux1_4 E S3

sel[1..0] S2 S1 S0

inst

S3 = Sel1.Sel0.E S2 = Sel1.Sel0.E S1 = Sel1.Sel0.E S0 = Sel1.Sel0.E

36
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit


(Recherche du schma)

Les encodeurs de priorit sont des circuits qui :


comportent n lignes dentre et m lignes de sortie, avec n > m lorsque une ou plusieurs lignes dentre sont actives, lencodeur fournit en sortie une valeur binaire correspondant lindice de lentre active de rang le plus lev

Bilan des entres/sorties pour un encodeur de priorit 4 2


nombre de sorties : 2 sorties + 1 nombre dentres : 4 entres

I3

I2

I1

I0

Gs Q1 Q0

37
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 4 2


(Recherche du schma)

Table de vrit
I3 I2 I1 I0 0 0 0 0 1 0 0 0 1 X 0 0 1 X X 0 1 X X X Gs Q1 Q0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1

I3

I2

I1

I0

Gs Q1 Q0

Les lignes dentres sont notes de I3 I0 Les sorties dencodage sont Q1 et Q0 Lorsque deux entres sont actives simultanment la priorit est donne au poids le plus fort (indice le plus grand) Si toutes les entres sont inactives alors Q1 Q0 = 00 et Gs=0 La sorties Gs (Got Something), indique par un 1 quun code est valide en sortie ( au moins une ligne est active).

38
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 4 2


(Recherche du schma)

- Les quations
I3 I2 I1 I0 0 0 0 0 1 0 0 0 1 X 0 0 1 X X 0 1 X X X Gs Q1 Q0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1

Q0
I3 I2

I1 I0

00 01 11 0 0 1 1 0 0 1 1 1 0 1 1

10 1 0 1 1

00 01 11 10

Equations videntes :

Gs = I3 + I2 + I1 + I0 Q1 = I3 + I2 Q0 = I3 + ( I2 . I1 )

Tableau de Karnaugh pour Q0 :

39
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 4 2


(Recherche du schma)

Gs = I3 + I2 + I1 + I0 Q1 = I3 + I2 Q0 = I3 + ( I2 . I1 ) - Le schma
I3 I2 I1 I0
OR4

I3 I2 I1 I0

INPUT VCC INPUT VCC INPUT VCC INPUT VCC OUTPUT

Gs

Gs

inst
OR2 OUTPUT

Q1

Q1 Q0

inst5 inst6
NOT OR2 OUTPUT AND2

Q2

inst8

inst7

40
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 4 2 cascadable

(Recherche du schma)

En vue dassocier plusieurs encodeurs entre eux, deux lignes sont rajoutes : Ei en entre et Eo en sortie

I3 Ei

I2

I1

I0 Eo

Gs Q1 Q0

Le fonctionnement est le suivant :


Si lentre Ei (Enable Input) est 0, alors : Gs = Q1 = Q0 = Eo = 0 . Sinon ( si Ei =1 ) : Si toutes les lignes dentre sont inactives alors : Q1Q0 = 00 et Eo = 1 Si une entre est active alors Eo = 0 La sortie Gs (Got something) indique par un 1 quune ligne dentre au moins est active

41
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 4 2 cascadable - Table de vrit


Ei I3 I2 I1 I0 0 X X 1 0 0 1 0 0 1 0 0 1 0 1 1 1 X X 0 0 1 X X X 0 1 X X X

(Recherche du schma)
Eo Gs Q1 Q0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 1 1 1

- Equations

Gs = Ei . ( I3 + I2 + I1 + I0 ) Q1 = Ei . ( I3 + I2 ) Q0 = Ei . ( I3 + ( I2 . I1 ) ) Eo = Ei . ( I3 + I2 + I1 + I0 )

42
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 4 2 cascadable


(Recherche du schma)

Gs = Ei . ( I3 + I2 + I1 + I0 ) Q1 = Ei . ( I3 + I2 ) Q0 = Ei . ( I3 + ( I2 . I1 ) ) Eo = Ei . ( I3 + I2 + I1 + I0 ) - Le schma
NOT AND2 OUTPUT

Ei I3 I2 I1 I0

inst10 Ei I3 I2 I1 I0
INPUT VCC OR4 INPUT VCC INPUT VCC INPUT VCC INPUT VCC AND2

Eo

Eo Gs Q1 Q0

inst9

OUTPUT

Gs

inst4 inst
AND2 OR2 OUTPUT

Q1

inst5 inst6
NOT OR2

inst2
AND2 OUTPUT

Q0

AND2

inst8

inst3

inst7

43
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Lencodeur de priorit 8 3


(Recherche du schma)

- Ralisation par une mise en cascade de 2 encodeurs 4


E7 E6 E5 E4
I3 I2 I1 I0 Eo Gs Q1 Q0

E3 E2 E1 E0
I3 Ei Gs Q1 Q0 I2 I1 I0 Eo

Ei

Gs2 Q3 Q2

Gs1 Q1 Q0

?
Gs S2 S1 S0

44
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

E7 E6 E5 E4
I3 I2 I1 I0 Eo Gs Q1 Q0

ENSL1

E3 E2 E1 E0
I3 Ei Gs Q1 Q0 I2 I1 I0 Eo

Ei

Gs2 Q3 Q2

Gs1 Q1 Q0

?
Table de vrit
E7 E6 E5 E4 E3 E2 E1 E0

Gs

S2

S1

S0

- Equations
Gs S2 S1 S0

Gs2 Q3 Q2

Gs1 Q1 Q0

Gs = Gs2 + Gs1 S2 = Gs2 S1 = Q3 + Q1 S0 = Q2 + Q0

0 0 0 0 0 0 0 0 1

X X X X X X X X X X X X X X X X X X

0 0 0 0 0 0 0 1

0 0 0 0 0 0 1

0 0 0 0 0 1

0 0 0 0 1

0 0 0 1 X

0 0 0 1 1 X
X X

X X
X X X X

0 0 0 0 0 1 1 1 1

0 0 0 0 0 0 0 1 1

0 0 0 0 0 0 1 0 1

0 1 1 1 1 0 0 0 0

0 0 0 1 1 0 0 0 0

0 0 1 0 1 0 0 0 0

0 1 1 1 1 1 1 1 1

0 0 0 0 0 1 1 1 1

0 0 0 1 1 0 0 1 1

0 0 1 0 1 0 1 0 1

45
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Additionneur (Recherche du schma)


Le principe de laddition est le mme quelle que soit la base utilise:
En dcimal :
1 1

En binaire:
bit de retenue
1 1 1

bits dentres
Si on arrive trouver le schma logique, dune cellule capable de gnrer le bit de somme et le bit de retenue, pour toutes les combinaisons possibles des bits dentres, alors en cascadant n cellules identiques, on arrivera faire laddition de nombres au format n bits.

7372 5465 12837

(A) (B) (A+B)

1010 1111 11001

(A) (B) (A+B)

bit de somme
Chaque cellule additionneur aura : 3 bits dentres : an (bit de rang n du nombre A) bn (bit de rang n du nombre B) rn (retenue gnre par la cellule de rang n-1) sn (bit de somme de rang n) rn+1 (retenue de rang n applique la cellule de rang n+1)
an bn Add rn+1 sn rn

2 bits de sortie :

46
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Additionneur 4 bits


a3 a2 a1 a0 b3 b2 b1 b0

s4 s3 s2 s1 s0

Ralis en cascadant 4 cellules

a3

b3

r3

a2

b2

r2

a1

b1

r1

a0

b0

r0

an

bn Add

rn

an

bn Add

rn

an

bn Add

rn

an

bn Add

rn

rn+1 sn

rn+1 sn

rn+1 sn

rn+1 sn

s4

s3

s2

s1

s0

47
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
an bn Add rn+1 sn rn

Cellule Additionneur (Recherche du schma)


Table de vrit:
rn an bn 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 rn+1 sn 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1

Karnaugh:

rn+1

rn

an bn 00

01 0 1

11 1 1

10 0 1

0 1

0 0

rn+1 = rn.bn + an.bn + rn.an


sn an bn 00

rn

01 1 0

11 0 1

10 1 0

0 1

0 1

sn= rn.an.bn + rn.an.bn + rn.an.bn + rn.an.bn sn= rn.(an.bn + an.bn) + rn.(an.bn + an.bn) sn= rn.(an bn) + rn.(an bn) = rn an

bn

sn= rn

an

bn

48
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Cellule Additionneur (Recherche du schma) Equations: Schma:


an bn rn
XOR

sn= rn an bn rn+1 = rn.bn + an.bn + rn.an

Symbole:
inst
XOR OUTPUT

INPUT VCC INPUT VCC INPUT VCC

sn

Add rin a b s rout

rin

inst3
AND2

inst1
AND2 OR3 OUTPUT

rout

rn+1

inst

inst2
AND2

inst5

inst4

49
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Additionneur 4 bits


Add
s[0]
GND

a[0] b[0]

rin a b
inst

s rout

a[3..0]

INPUT VCC

OUTPUT

s[4..0]

b[3..0]

INPUT VCC

Add
s[1] a[1] b[1]

rin a b
inst1

s rout

Add
s[2] a[2] b[2]

rin a b
inst2

s rout

Add
s[3] a[3] b[3]

rin a b
inst3

s rout

s[4]

50
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Cellule Additionneur (description VHDL)


library ieee; use ieee.std_logic_1164.all; entity add is port ( end add; architecture add_arch of add is signal entree : std_logic_vector (2 downto 0); signal sortie : std_logic_vector (1 downto 0); begin entree(2) <= rin; entree(1) <= a; entree(0) <= b; with entree select sortie <= "00" when "000" , "01" when "001" , "01" when "010" , "10" when "011" , "01" when "100" , "10" when "101" , "10" when "110" , "11" when others; rout <= sortie(1); s <= sortie(0); end add_arch;

Symbole:
Add rin a b
inst

rin,a,b : in std_logic; s,rout : out std_logic

);

s rout

rn an 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1

bn 0 1 0 1 0 1 0 1

rn+1 sn 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1

51
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Comparateur
Cest un circuit qui reoit deux nombres binaire A & B, en entre, comme ladditionneur, et qui dtermine sur trois sorties si : A>B, A<B ou A=B. Principe de la comparaison :
Soit deux nombres A= 01101101 et B= 01110100, simplement en les observant, on peut dire que

A<B
Il suffit pour cela de comparer leurs bits de mme rang, en commenant par les poids forts :

A= 0 1 1 0 B= 0 1 1 1

Le premier bit 1 rencontr sur lun des deux nombres, alors que son quivalent est 0 sur lautre, permet de dterminer le plus grand des deux nombres

52
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Comparateur (recherche du schma)


Comme ladditionneur, le comparateur, sera ralis par une mise en cascade de cellules de comparaison fonctionnant de la faon suivante: Chaque cellule aura 5 entres et 3 sorties:
an bn an & bn : bits de rang n des nombres A & B comparer sin ein iin

sin, ein & iin : bits dentre, utiliss lors de la mise en cascade de plusieurs cellules

sout eout iout

Deux cas dterminerons des comportements diffrents de la cellule : 1er cas : 2me cas : Si an = bn , alors sout = sin, eout = ein, iout = iin Si an bn , soit 2 possibilits : an=1 et bn=0 (an > bn) , alors sout=1, eout=0, iout=0 an=0 et bn=1 (an < bn) , alors sout=0, eout=0, iout=1

53
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Comparateur (recherche du schma) Table de vrit


an bn 0 0 1 1 0 1 0 1 sout eout iout sin 0 1 sin ein iin 0 1 0 0 ein iin

Equations

sout = an.bn + sin.(an . bn) e = e .(a . b )


out in n n

iout = an.bn + iin.(an . bn)

54
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
sout = an.bn + sin.(an . bn) e = e .(a . b )
out in n n
Comp_sch sin ein iin b a
inst

sout eout iout

Schma

iout = an.bn + iin.(an . bn)

bn

NOT

AND2 OR2 OUTPUT

INPUT VCC

inst inst6
AND2 OR2

sout

sout iout

inst12

an

NOT

INPUT VCC

OUTPUT

iout

inst5
XNOR

inst7

inst13

AND2

sin ein iin

inst9 sin
INPUT VCC

inst8
AND2 OUTPUT

ein

INPUT VCC

eout

eout

inst10
AND2

iin

INPUT VCC

inst11

55
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
Comparateur 4 bits
GND VCC

Comp_sch sin ein iin b a


inst

b[3..0]

INPUT VCC INPUT VCC

b[0] a[0]

sout eout iout

a[3..0]

Comp_sch sin ein iin b a


inst1

b[1] a[1]

sout eout iout

Comp_sch sin ein iin b a


inst2

b[2] a[2]

sout eout iout

Comp_sch sin ein iin b a


inst3

b[3] a[3]

sout eout iout

OUTPUT OUTPUT OUTPUT

S E I

56
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
Comparateur (description VHDL) Symbole :
library ieee; use ieee.std_logic_1164.all; entity comp is port ( sin,ein,iin,b,a : in std_logic; sout,eout,iout : out std_logic ); end comp; architecture comp_arch of comp is signal entree : std_logic_vector (1 downto 0); begin entree(1) <= a; entree(0) <= b; sout <= iout <= eout <= '1' when entree="10" else '0' when entree="01" else sin; '0' when entree="10" else '1' when entree="01" else iin; '0' when entree="10" else '0' when entree="01" else ein;
Comp_sch sin ein iin b a
inst

sout eout iout

end comp_arch;

57
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Paramtres dynamiques des oprateurs logiques


NOT

INPUT VCC

OUTPUT

inst

E
50% 50%

90% 50% 10%

90% 50% 10%

Ralit

tPHL tf
E

tPLH tr

Reprsentation

tp temps de propagation (~ns)


58
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Paramtres dynamiques des oprateurs logiques


Les temps de propagation travers les portes logiques sont gnrateurs dalas Un ala apparat en sortie dune fonction logique combinatoire, suite un changement de valeur sur une entre Alors quune fonction ne devrait pas changer dtat, cause des temps de propagation, il apparat un tat transitoire de trs courte dure o la fonction change de valeur malgr tout, cest lala Les simulateurs lappellent glitch

59
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Paramtres dynamiques des oprateurs logiques


Soit une fonction F dfinie par le tableau de Karnaugh suivant :
BA C

00 01 11 0 0 1 0 1 0 A.C

10 1 1 A.B

0 1

F = A.C + A.B
Lala se rencontre lorsque lon passe dune case une case adjacente de mme valeur ntant pas dans un mme groupement
Dans notre exemple on risque de rencontrer un ala sur un changement dtat de la variable dentre A lorsque C=0 et B=1

60
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
Schma :

F = A.C + A.B
NOT

A B=1 C=0

INPUT VCC

AND2

inst inst2

A.B
OR2 OUTPUT

INPUT VCC NOT INPUT VCC

AND2

inst4

inst1

C=1

inst3

A.C

A A A.C A.B F
0 1 0

Etat transitoire de trs courte dure, du aux temps de propagation travers les portes logiques, o pendant environ 1ns les 2 entres du OU sont 0. Ce qui provoque un ala.

61
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Paramtres dynamiques des oprateurs logiques


Si on dsire conserver la continuit de ltat dune sortie, pendant une transition entre 2 cases o la fonction prend pour valeur 1, il faut et il suffit, que la transition se passe dans un mme groupement Il ny a de risque dalas quentre 2 cases adjacentes, ntant pas prises dans un mme groupement Pour viter les alas il faut donc rajouter des groupements redondants
BA C

00 01 11 0 0 1 0 1 0 A.C

10 1 1 A.B B.C

0 1

F = A.C + A.B + B.C


Il nest pas toujours utile de supprimer tous les alas
62
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Retour sur ladditionneur 4 bits ralis en cascadant 4 cellules

a3 a2 a1 a0

b3 b2 b1 b0

s4 s3 s2 s1 s0

a3

b3

r3

a2

b2

r2

a1

b1

r1

a0

b0

r0

an

bn Add

rn

an

bn Add

rn

an

bn Add

rn

an

bn Add

rn

rn+1 sn

rn+1 sn

rn+1 sn

rn+1 sn

s4

s3

s2

s1

s0

63
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Cellule Additionneur (description VHDL)


library ieee; use ieee.std_logic_1164.all; entity add is port ( end add; architecture add_arch of add is signal entree : std_logic_vector (2 downto 0); signal sortie : std_logic_vector (1 downto 0); begin entree(2) <= rin; entree(1) <= a; entree(0) <= b; with entree select sortie <= "00" when "000" , "01" when "001" , "01" when "010" , "10" when "011" , "01" when "100" , "10" when "101" , "10" when "110" , "11" when others; rout <= sortie(1); s <= sortie(0); end add_arch;

Symbole:
Add rin a b
inst

rin,a,b : in std_logic; s,rout : out std_logic

);

s rout

rn an 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1

bn 0 1 0 1 0 1 0 1

rn+1 sn 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1

64
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Additionneur 4 bits


Add
s[0]
GND

a[0] b[0]

rin a b
inst

s rout

a[3..0]

INPUT VCC

OUTPUT

s[4..0]

b[3..0]

INPUT VCC

Add
s[1] a[1] b[1]

rin a b
inst1

s rout

Add
s[2] a[2] b[2]

rin a b
inst2

s rout

Add
s[3] a[3] b[3]

rin a b
inst3

s rout

s[4]

65
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Additionneur
a b

Additionneur
s

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity addi is port ( a,b : in std_logic_vector (3 downto 0); s : out std_logic_vector (4 downto 0) ); end addi; architecture addi_a of addi is begin s <= ('0'&a) + ('0'&b); end addi_a; Pour pouvoir utiliser des oprateurs arithmtiques standards (+,-, ) sur des std_logic_vector

& :oprateur de concatnation La concatnation est dfinie sur des tableaux une dimension : std_logic_vector Lopration : CONCAT & ENATION donne : CONCATENATION

66
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
En VHDL il est possible de fusionner deux tableaux, on appelle cette opration la concatnation, pour affecter les valeurs correspondantes un tableau plus grand

signal etat : std_logic_vector ( 4 downto 0 ) ; signal sous_etat1 : std_logic_vector ( 1 downto 0 ) ; signal sous_etat2 : std_logic_vector ( 2 downto 0 ) ; etat <= sous_etat1 & sous_etat2 ; --concatenation

67
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

Lutilisation de la librairie ieee.std_logic_unsigned.all va permettre de faciliter la tche du concepteur. On a bien vu que la description de ladditionneur est beaucoup plus simple en utilisant la librairie ieee.std_logic_unsigned.all

68
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1
Unit Arithmtique et logique (A.L.U)
a sel b cin

A.L.U.
y

a[7..0] b[7..0]

L.U. M U X

Y[7..0]

A.U.
cin sel[3..0] sel[2..0]

sel[3]

69
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1 Unit Arithmtique et Logique (description VHDL)


a[7..0] b[7..0]

L.U. M U X

Y[7..0]

A.U.
cin sel[3..0] sel[2..0]

sel[3]

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity ALU is port ( a, b: in std_logic_vector(7 downto 0); sel: in std_logic_vector(3 downto 0); cin: in std_logic; y: out std_logic_vector(7 downto 0) ); end ALU;

architecture ALU_arch of ALU is signal arith, logic: std_logic_vector(7 downto 0); begin ----- Unit arithmtique: -----with sel(2 downto 0) select arith <= a when "000", a+1 when "001", a-1 when "010", b when "011", b+1 when "100", b-1 when "101", a+b when "110", a+b+cin when others; ----- Unit logique: ----------with sel(2 downto 0) select logic <= not(a) when "000", not(b) when "001", a and b when "010", a or b when "011", a nand b when "100", a nor b when "101", a xor b when "110", not(a xor b) when others; -------- Mux: --------------with sel(3) select y <= arith when '0', logic when others; end ALU_arch;

70
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

ENSL1

71
Michel KRAMMER Iut de Toulon Dpt: GEII - Semestre 1 2010/2011

You might also like