You are on page 1of 121

Chuong 1.

H thng s dm v khi nim v m Trang 1


Chuong 1
HE THNG S M V KHI NIEM V M
1.1. HE THNG S M
1.1.1. H dm
1. Khi nim
H dm l tp hop cc phuong php goi v biu din cc con s bng cc k hiu c gi tri s
luong xc dinh goi l cc chu s.
2. Phn loi
C th chia cc h dm lm hai loai: h dm theo vi tr v h dm khng theo vi tr.
a. H dm theo vi tr:
H dm theo vi tr l h dm m trong d gi tri s luong cua chu s cn phu thuc vo vi tr cua
n dung trong con s cu th.
V du: H thp phn l mt h dm theo vi tr. S 1991 trong h thp phn duoc biu din bng
2 chu s 1 v 9, nhung do vi tr dung cua cc chu s ny trong con s l khc nhau nn s mang
cc gi tri s luong khc nhau, chng han chu s 1 o vi tr hng don vi biu din cho gi tri s
luong l 1 song chu s 1 o vi tr hng nghn lai biu din cho gi tri s luong l 1000, hay chu s
9 khi o hng chuc biu din gi tri l 90 cn khi o hng trm lai biu din cho gi tri l 900.
b. H dm khng theo vi tr:
H dm khng theo vi tr l h dm m trong d gi tri s luong cua chu s khng phu thuc vo
vi tr cua n dung trong con s.
H dm La M l mt h dm khng theo vi tr. H dm ny su dung cc k tu I, V, X...
d biu din cc con s, trong d I biu din cho gi tri s luong 1, V biu din cho gi tri s
luong 5, X biu din cho gi tri s luong 10... m khng phu thuc vo vi tr cc chu s ny dung
trong con s cu th.
Cc h dm khng theo vi tr s khng duoc d cp dn trong gio trnh ny.
1.1.2. Co s ca h dm
Mt s A bt ky c th biu din bng dy sau:
A= a
m-1
a
m-2
.....a
0
a
-1
......a
-n
Trong d a
i
l cc chu s, ( 1 m n i = ); i l cc hng s, i nho: hng tre, i lon: hng gi.
Gi tri s luong cua cc chu s a
i
s nhn mt gi tri no d sao cho thoa mn bt dng thuc sau:
1 N a 0
i
(a
i
nguyn)
N duc gi l co s cua h dm. Co s cua mt h dm l s lung k t phn bit duc su
dng trong mt h dm. Cc h thng s dm duoc phn bit voi nhau bng mt co s N cua h
dm d. Mi k tu biu din mt chu s.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 2
Trong doi sng hng ngy chng ta quen su dung h dm thp phn (decimal) voi N=10. Trong
h thng s cn su dung nhung h dm khc l h dm nhi phn (binary) voi N=2, h dm bt phn
(octal) voi N=8 v h dm thp luc phn (hexadecimal) voi N=16.
- H nhi phn : N =2 a
i
= 0, 1.
- H thp phn : N =10 a
i
= 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
- H bt phn : N =8 a
i
= 0, 1, 2, 3, 4, 5, 6, 7.
- H thp luc phn : N =16 a
i
= 0, 1, 2, 8, 9, A, B, C,D, E, F.
Khi d xut hin co s N, ta c th biu din s A duoi dang mt da thuc theo co s N, duoc k
hiu l A
(N)
:
A
(N)
= a
m-1
.N
m-1
+ a
m-2
.N
m-2
+...+ a
0
.N
0
+ a
-1
.N
-1
+ ... + a
-n
.N
-n
Hay:

=
=
1 m
n i
i
i (N)
N a A (1.1)
Joi N=10 (h thap phn):
A
(10)
= a
m-1
.10
m-1
+ a
m-2
.10
m-2
+....+ a
0
.10
0
+...+ a
-n
.10
-n
1999,959
(10)
=1.10
3
+ 9.10
2
+ 9.10
1
+ 9.10
0
+ 9.10
-1
+ 5.10
-2
+ 9.10
-3
Joi N=2 (h nhi phn):
A
(2)
= a
m-1
.2
m-1
+ a
m-2
.2
m-2
+...+ a
0
.2
0
....+a
-n
2
-n
1101
(2)
= 1.2
3
+1.2
2
+ 0.2
1
+ 1.2
0
= 13
(10)
Joi N=16 (h thap luc phn):
A
(16)
= a
m-1
.16
m-1
+ a
m-2
.16
m-2
+...+ a
0
.16
0
+ a
-1
16
-1
+ ... + a
-n
16
-n
3FF
(16)
= 3.16
2
+ 15.16
1
+ 15.16
0
= 1023
(10)
Joi N=8 (h bt phn):
A
(8)
= a
m-1
.8
m-1
+ a
m-2
.8
m-2
+...+ a
0
.8
0
+ a
-1
.8
-1
+ ... + a
-n
.8
-n
376
(8)
= 3.8
2
+ 7.8
1
+ 6.8
0
= 254
(10)
Nhu vy, biu thuc (1.1) cho php di cc s o bt ky h no sang h thp phn (h 10).
1.1.3. i co s
1. Di t co s d sang co s 10
D chuyn di mt s o h dm co s d sang h dm co s 10 nguoi ta khai trin con s trong co
s d duoi dang da thuc theo co s cua n (theo biu thuc 1.3).
V d 1.1 Di s 1101
(2)
o h nhi phn sang h thp phn nhu sau:
1011
(2)
= 1.2
3
+ 0.2
2
+ 1.2
1
+ 1.2
0
= 11
(10)
2. Di t co s 10 sang co s d
D chuyn di mt s tu co s 10 sang co s d (d = 2, 8, 16) nguoi ta ly con s trong co s 10
chia lin tip cho d dn khi thuong s bng khng th dung lai. Kt qua chuyn di c duoc trong
h dm co s d l tp hop cc s du cua php chia duoc vit theo thu tu nguoc lai, nghia l s du
du tin c trong s nho nht. (xem v du 1.2)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 1. H thng s dm v khi nim v m Trang 3
V d 1.2:
Kt lun: Goi d
1
, d
2
, ..,d
n
ln luot l du s cua php chia s thp phn cho co s d o ln thu 1, 2,
3, 4, .., n th kt qua chuyn di mt s tu h dm co s 10 (thp phn) sang h dm co s d s l:
d
n
d
n-1
d
n-2
...d
1
,
nghia l du s sau cng cua php chia l bt c trong s cao nht (MSB), cn du s du tin l bt
c trong s nho nht (LSB).
Trong cc v du trn, co s cua h dm duoc ghi o dang chi s bn duoi. Ngoi ra cung c th k
tu chu d phn bit nhu sau:
B - H nhi phn (Binary) O - H bt phn (Octal)
D - H thp phn (Decmal) H - H thp luc phn (Hexadecimal)
V du: 1010B c nghia l 1010
(2)
37FH c nghia l 37F
(16)
& Quy tc chuyn doi gia cc h dm co so 2, 8, 16 ?
1.2. HE M NH[ PHN V KHI NIEM V M
1.2.1. H dm nh[ phn
1. Khi nim
H dm nhi phn, cn goi l h dm co s 2, l h dm trong d nguoi ta chi su dung hai k hiu
0 v 1 d biu din tt ca cc s. Hai k hiu d goi chung l bit hoc digit, n dc trung cho mach
din tu c hai trang thi n dinh hay cn goi l 2 trang thi bn cua FLIP- FLOP (k hiu l FF).
Trong h dm nhi phn nguoi ta quy uoc nhu sau:
- Mt nhm 4 bt goi l 1 nibble.
- Mt nhm 8 bt goi l 1 byte.
- Nhm nhiu bytes gi l t (word), c th c tu 2 bytes (16 bt), tu 4 bytes (32 bt), ...
D hiu r hon mt s khi nim, ta xt s nhi phn 4 bt: a
3
a
2
a
1
a
0
. Biu din duoi dang da thuc
theo co s cua n l:
a
3
a
2
a
1
a
0 (2)
= a
3
.2
3
+ a
2
.2
2
+ a
1
.2
1
+ a
0
.2
0
Trong d:
- 2
3
, 2
2
, 2
1
, 2
0
(hay 8, 4, 2, 1) duoc goi l cc trong s.
- a
0
duoc goi l bit c trong s nho nht, hay cn goi bit c nghia nho nht (LSB - Least
Significant Bit), cn goi l bt tre nht.
1023 16
63 16
3 16
0
15
15
3
A
(10)
=1023 A
(16)
=3FFH
13 2
6 2
3 2
1
1
0
1 2
0 1
A
(10)
=13 A
(2)
=1101
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 4
- a
3
duoc goi l bit c trong s lon nht, hay cn goi l bt c nghia lon nht (MSB - Most
Significant Bit), cn goi l bt gi nht.
Nhu vy, voi s nhi phn 4 bit a
3
a
2
a
1
a
0
trong d mi chu s a
i
(i tu 0 dn 3) chi nhn duoc hai
gi tri {0,1} ta c 2
4
= 16 t hop nhi phn phn bit.
Bang sau dy lit k cc t hop m nhi phn 4 bt cng cc gi tri s thp phn, s bt phn v s
thp luc phn tuong ung.
& Tu bang ny hy cho bit moi quan h gia cc so trong h nhi phn voi cc so trong h
bt phn (N=8) v h thap luc phn (N=16)? Tu d suy ra phuong php chuyn doi nhanh gia cc
h ny?
S thp phn a
3
a
2
a
1
a
0
S bt phn S thp luc phn
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Bang 1.1. Cc to hop m nhi phn 4 bt
Su chuyn di giua cc h thng s dm khc nhau giu vai tr quan trong trong my tnh s.
Chng ta bit rng 2
3
= 8 v 2
4
= 16, tu bang m trn c th nhn thy mi chu s trong h bt phn
tuong duong voi mt nhm ba chu s (3 bt) trong h nhi phn, mi chu s trong h thp luc phn
tuong duong voi mt nhm bn chu s (4 bt) trong h nhi phn. Do d, khi biu din s nhi phn
nhiu bit trn my tnh d trnh sai st nguoi ta thuong biu din thng qua s thp phn hoc thp
luc phn hoc bt phn.
V d 1.3: Xt vic biu din s nhi phn 1011111011111110
(2)
.
1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0
Vy, c th biu din : 137376
(8)
theo h bt phn
hoc : BEFE
(H)
theo h thp luc phn.
6 7 3 7 3 1
E F E B
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 1. H thng s dm v khi nim v m Trang 5
& Voi so nhi phn n bt c bao nhiu to hop nhi phn khc nhau? Xt truong hop so nhi
phn 8 bt (n=8) a
7
a
6
a
5
a
4
a
3
a
2
a
1
a
0
c bao nhiu to hop nhi phn (tu m nhi phn) khc nhau?
2. Cc php tnh trn s nh| phn
a. Php cong
D cng hai s nhi phn, nguoi ta dua trn qui tc cng nhu sau:
0 + 0 = 0 nho 0
0 + 1 = 1 nho 0
1 + 0 = 1 nho 0
1 + 1 = 0 nho 1
V d 1.4:
3 0011
2 0010
5 0101 = 1.2
2
+ 1.2
0
= 5
(10)
b. Php tru
0 - 0 = 0 muon 0
0 - 1 = 1 muon 1
1 - 0 = 1 muon 0
1 - 1 = 0 muon 0
V d 1.5:
7 0111
5 0101
2 0010 = 0.2
3
+ 0.2
2
+ 1.2
1
+ 0.2
0
= 2
(10)
c. Php nhn
0 . 0 = 0
0 . 1 = 0
1 . 0 = 0
1 . 1 = 1
V d 1.6:
7 0111
5 0101
35 0111
0000
0111
0000
0100011 = 1.2
5
+ 1.2
1
+ 1.2
0
= 35
(10)
d. Php chia
0 : 1 = 0
1 : 1 = 1
Luu : Khi chia so chia phai khc 0
+ +
-
-
x x
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 6
V d 1.7: 10 5 1010 101
2 101 10
(2)
= 2
(10)
00
0
Ung dng thanh ghi d|ch thc hin php ton nhn hai, chia hai:
1.2.2. Khi nim v m
1. Di cuong
Trong doi sng hng ngy, con nguoi giao tip voi nhau thng qua mt h thng ngn ngu qui
uoc, nhung trong my tnh v cc h thng s chi xu l cc du liu nhi phn. Do d, mt vn d dt
ra l lm th no tao ra mt giao din d dng giua nguoi v my tnh, nghia l my tnh thuc hin
duoc nhung bi ton do con nguoi dt ra.
V cc my tnh s hin nay chi hiu cc s 0 v s 1, nn bt ky thng tin no duoi dang cc chu
s, chu ci hoc cc k tu phai duoc bin di thnh dang s nhi phn truoc khi n c th duoc xu
l bng cc mach s.
D thuc hin diu d, nguoi ta dt ra vn d v m ha du liu. Nhu vy, m ha l qu trnh
bin di nhung k hiu quen thuc cua con nguoi sang nhung k hiu quen thuc voi my tnh.
Nhung s liu d m ha ny duoc nhp vo my tnh, my tnh tnh ton xu l v sau d my tnh
thuc hin qu trnh nguoc lai l giai m d chuyn di cc bt thng tin nhi phn thnh cc k hiu
quen thuc voi con nguoi m con nguoi c th hiu duoc.
Cc linh vuc m ha bao gm:
- M ha s thp phn
- M ha k tu
- M ha tp lnh
- M ha ting ni
- M ha hnh anh ..v..v..
Phn tip theo chng ta khao st linh vuc m ha don gian nht l m ha s thp phn bng
cch su dung cc tu m nhi phn. Vic m ha k tu, tp lnh, ting ni, hnh anh... du dua trn co
so m ha s thp phn.
0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 1 1 1
Thanh ghi ban du
Thanh ghi sau khi dich tri 1 bt
Dich tri 1 bt nhn 2
0 0 0 0 0 0 1 0 1 1
0
Thanh ghi sau khi dich phai 1 bt
Dich phai 1 bt chia 2 0
du
Hnh 1.1. Ung dung thanh ghi dich thuc hin php ton nhn v chia 2
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 1. H thng s dm v khi nim v m Trang 7
2. M ha s thp phn
a. Khi nim
Trong thuc t d m ha s thp phn nguoi ta su dung cc s nhi phn 4 bit (a
3
a
2
a
1
a
0
) theo quy
tc sau:
0 0000 ; 5 0101
1 0001 ; 6 0110
2 0010 ; 7 0101
3 0011 ; 8 1000
4 0100 ; 9 1001
Cc s nhi phn dng d m ha cc s thp phn duoc goi l cc s BCD (Binary Coded
Decimal: S thp phn duoc m ha bng s nhi phn).
b. Phn loai
Khi su dung s nhi phn 4 bit d m ha cc s thp phn tuong ung voi 2
4
= 16 t hop m nhi
phn phn bit.
Do vic chon 10 t hop trong 16 t hop d m ha cc k hiu thp phn tu 0 dn 9 m trong
thuc t xut hin nhiu loai m BCD khc nhau.
Mc d tn tai nhiu loai m BCD khc nhau, nhung c th chia lm hai loai chnh: M BCD c
trong so v m BCD khng c trong so.
b1. M BCD c trng s l loai m cho php phn tch thnh da thuc theo trong s cua n. M
BCD c trong s duoc chia lm 2 loai l: m BCD tu nhin v m BCD s hoc.
M BCD t nhin l loai m m trong d cc trong s thuong duoc sp xp theo thu tu tng
dn. V du: M BCD 8421, BCD 5421.
M BCD s hc l loai m m trong d c tng cc trong s lun lun bng 9.V du: BCD
2421, BCD 5121, BCD8 4-2-1
D}c trung cua m BCD s hc l c tnh cht di xng qua mt dung trung gian. Do
vy, d tm tu m BCD cua mt s thp phn no d ta ly b (dao) tu m BCD cua s b 9
tuong ung.
V d xt m BCD 2421. Dy l m BCD s hoc (tng cc trong s bng 9), trong d s 3
(thp phn) c tu m l 0011, s 6 (thp phn) l b 9 cua 3. Do vy, c th suy ra tu m cua 6
bng cch ly b tu m cua 3, nghia l ly b 0011, ta s c tu m cua 6 l 1100.
b2. M BCD khng c trng s l loai m khng cho php phn tch thnh da thuc theo trong
s cua n. Cc m BCD khng c trong s l: M Gray, M Gray thua 3.
Dc trung cua m Gray l b m trong d hai tu m nhi phn dung k tip nhau bao gio cung chi
khc nhau 1 bit.
V du:
Cc bang duoi dy trnh by mt s loai m thng dung.
M Gray: 2 0011
3 0010
4 0110
Cn voi m BCD 8421:
3 0011
4 0100
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 8
Bang 1.2: Cc m BCD tu nhin.
BCD 8421 BCD 5421 BCD qu 3
a
3
a
2
a
1
a
0
b
3
b
2
b
1
b
0
c
3
c
2
c
1
c
0
S thp
phn
0 0 0 0 0 0 0 0 0 0 1 1 0
0 0 0 1 0 0 0 1 0 1 0 0 1
0 0 1 0 0 0 1 0 0 1 0 1 2
0 0 1 1 0 0 1 1 0 1 1 0 3
0 1 0 0 0 1 0 0 0 1 1 1 4
0 1 0 1 1 0 0 0 1 0 0 0 5
0 1 1 0 1 0 0 1 1 0 0 1 6
0 1 1 1 1 0 1 0 1 0 1 0 7
1 0 0 0 1 0 1 1 1 0 1 1 8
1 0 0 1 1 1 0 0 1 1 0 0 9
Bang 1.3: Cc m BCD so hoc
BCD 2421 BCD 5121 BCD 84-2-1
a
3
a
2
a
1
a
0
b
3
b
2
b
1
b
0
c
3
c
2
c
1
c
0
S thp
phn
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1 0 1 1 1 1
0 0 1 0 0 0 1 0 0 1 1 0 2
0 0 1 1 0 0 1 1 0 1 0 1 3
0 1 0 0 0 1 1 1 0 1 0 0 4
1 0 1 1 1 0 0 0 1 0 1 1 5
1 1 0 0 1 1 0 0 1 0 1 0 6
1 1 0 1 1 1 0 1 1 0 0 1 7
1 1 1 0 1 1 1 0 1 0 0 0 8
1 1 1 1 1 1 1 1 1 1 1 1 9
Bang 1.4: BCD tu nhin v m Gray.
BCD 8421 BCD qu 3 M Gray Gray qu 3
a
3
a
2
a
1
a
0
c
3
c
2
c
1
c
0
G
3
G
2
G
1
G
0
g
3
g
2
g
1
g
0
S thp
phn
0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0
0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0 1
0 0 1 0 0 1 0 1 0 0 1 1 0 1 1 1 2
0 0 1 1 0 1 1 0 0 0 1 0 0 1 0 1 3
0 1 0 0 0 1 1 1 0 1 1 0 0 1 0 0 4
0 1 0 1 1 0 0 0 0 1 1 1 1 1 0 0 5
0 1 1 0 1 0 0 1 0 1 0 1 1 1 0 1 6
0 1 1 1 1 0 1 0 0 1 0 0 1 1 1 1 7
1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 8
1 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 9
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 1. H thng s dm v khi nim v m Trang 9
Ch : M Gray duc suy ra t m BCD 8421 bng cch: cc bit 0,1 dung sau bit 0 (o m
BCD 8421) khi chuyn sang m Gray duoc giu nguyn, cn cc bit 0,1 dung sau bit 1 (o m BCD
8421) khi chuyn sang m Gray th dao bt, nghia l tu bit 1 thnh bit 0 v bit 0 thnh bit 1.
3. Mch nhn dng s BCD 8421:
Mach nhn dang s BCD 8421 nhn tn hiu vo l cc bt a
3
, a
2
, a
1
cua s nhi phn 4 bt
a
3
a
2
a
1
a
0
, du ra y duoc quy dinh nhu sau:
- Nu y = 1 th a
3
a
2
a
1
a
0
khng phai s BCD 8421
- Nu y = 0 th a
3
a
2
a
1
a
0
l s BCD 8421
Nhu vy, nu mt s nhi phn 4 bit khng phai l mt s BCD 8421 th ng ra y = 1. Tu bang
1.1 ta thy mt s nhi phn 4 bt khng phai l s BCD 8421 khi bt a
3
lun lun bng 1 v (bit a
1
ng 1 hoc bt a
2
bng 1).
Suy ra phuong trnh logic cua ng ra y: y = a
3
(a
1
+ a
2
) = a
3
a
1
+ a
3
a
2
So d logic:
Cung do vic xut hin s BCD nn c hai cch nhp du liu vo my tnh: nhp s nhi phn,
nhp bng m BCD.
D nhp s BCD thp phn hai chu s th my tnh chia s thp phn thnh cc dcc v mi
dcc duoc biu din bng s BCD tuong ung. Chng han: 11
(10)
c th duoc nhp vo my tnh
theo 2 cch:
- S nhi phn : 1011
- M BCD : 0001 0001
4. Cc php tnh trn s BCD
a. Php cong
Do s BCD chi c tu 0 dn 9 nn di voi nhung s thp phn lon hon s chia s thp phn thnh
nhiu dcc, mi dcc duoc biu din bng s BCD tuong ung.
V d 1.8 Cng 2 s BCD mt dcc:
5 0101 7 0111
3 0011 5 0101
8 1000 12 1100
0110
0001 0010
Mch nhn dng
s BCD 8421
y
a
3
a
2
a
1
a
1
a
2
a
3
y
a
1
a
2
a
3
y
S hiu chinh
+ + + +
+
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 10
C hai trung hp phai hiu chinh kt qua cua php cng 2 s BCD 8421:
- Khi kt qua cua php cong l mot so khng phai l so BCD 8421
- Khi kt qua cua php cong l mot so BCD 8421 nhung lai xuat hin so nho bng 1.
Vic hiu chinh duc thc hin bng cch cng kt qua vi s hiu chinh l 6 (0110
2
).
O v du 1.8 d xem xt truong hop hiu chinh khi kt qua khng phai l mt s BCD 8421.
Truong hop hiu chinh khi kt qua l mt s BCD 8421 nhung php cng lai xut hin s nho bng
1 duoc xem xt trong v du sau dy:
V d 1.9 Hiu chinh kt qua cng 2 s BCD mt dcc khi xut hin s nho bng 1:
8 1000
9 1001
17 1 0001
0110
0001 0111
b. Php tru
Php ton tru 2 s BCD duoc thuc hin theo quy tc sau dy:
A - B = A + B
Trong d B l s b 2 cua B.
V d 1.10 Thuc hin tru 2 s BCD mt dcc:
7 0111 0111
5 0101 1010
2 0010 1 0001
1
0010
Luu :
- B 1 cua mot so nhi phn l lay dao tat ca cc bt cua so d (bit 0 thnh 1, bit 1 thnh 0).
- B 2 cua mot so nhi phn bng so b 1 cong thm 1 vo bt LSB.
Xt cc truong hop mo rong sau dy:
1. Thuc hin tru 2 so BCD 1 dcc m so bi tru nho hon so tru ?
2. Mo rong cho cong v tru 2 so BCD nhiu dcc ?
S hiu chinh (6)
+ +
Kt qua l s BCD 8421 nhung
lai xut hin s nho bng 1
Kt qua sau khi hiu chinh l 17
B 1 cua 5
- -
+
+
Cng 1 LSB d c b 2 cua 5
Bo di s nho
Kt qua cui cng
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 11
Chuong 2
AI S BOOLE
2.1. CC TIN V [NH L AI S BOOLE
Trong cc mach s, cc tn hiu thuong duoc cho o 2 muc din p, v du: 0V v 5V. Nhung linh
kin din tu dng trong mach s lm vic o mt trong hai trang thi, v du Transistor lung cuc
(BJT) lm vic o hai ch d l tt hoc dn bo ho Do vy, d m ta cc mach s nguoi ta dng
h nhi phn (binary), hai trang thi cua cc linh kin trong mach s duoc m ho tuong ung l 0
hoc 1.
Mt b mn dai s pht trin tu cui th ky 19 mang tn nguoi sng lp ra n: dai s Boole, cn
duoc goi l dai s logic, thch hop cho vic m ta mach s. Dai s Boole l cng cu ton hoc quan
trong d phn tch v thit k cc mach s, duoc dng lm cha kho d di su vo moi linh vuc lin
quan dn k thut s.
2.1.1. Cc tin d ca dai s Boole
Cho mt tp hop B huu han trong d ta trang bi cc php ton + (cng logic), x (nhn logic), -
(b logic/nghich dao logic) v hai phn tu 0 v 1 lp thnh mt cu trc dai s Boole (doc l Bun).
x,y B th: x+y B, x*y B v thoa mn 5 tin d sau:
1. Tin d giao hon
x,y B: x + y = y + x
2. Tin d phi hp
x,y,z B: (x+y)+z = x+(y+z) = x+y+z
(x.y).z = x.(y.z) = x.y.z
3. Tin d phn phi
x,y, z B: x.(y + z ) = x.y + x.z
x + (y.z) = (x + y).(x + z)
4. Tin d v phn tu trung ha
Trong tp B tn tai hai phn tu trung ha l phn tu don v| v phn tu khng. Phn tu don vi
k hiu l 1, phn tu khng k hiu l 0.
x B: x + 1 = 1
x . 1 = x
x + 0 = x
x . 0 = 0
5. Tin d v phn tu b
x B, bao gio cung tn tai phn tu b tuong ung, k hiu x , sao cho lun thoa mn:
x + x = 1 v x. x = 0
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 12
Nu B = B* = {0,1} (B* chi gm 2 phn tu 0 v 1) v thoa mn 5 tin d trn th cung lp thnh
cu trc dai s Boole nhung l cu trc dai s Boole nho nht.
2.1.2. Cc d[nh l co bn ca dai s Boole
1. Vn d di ngu trong di s Boole
Hai mnh d (hai biu thuc, hai dinh l) duoc goi l di ngu voi nhau nu trong mnh d ny
nguoi ta thay php ton cng thnh php ton nhn v nguoc lai, thay 0 bng 1 v nguoc lai, th s
suy ra duoc mnh d kia.
Khi hai mnh d di ngu voi nhau, nu 1 trong 2 mnh d duoc chung minh l dng th mnh
d cn lai l dng. Duoi dy l v du v cc cp mnh d di ngu voi nhau.
V d 2.1: x.(y+z) = (x.y) + (x.z)
x + (y.z) = (x+y).(x+z)
V d 2.2: x + x = 1
x. x = 0
2. Cc d|nh l
a. inh l 1 (inh l v phan tu b l duy nhat)
x, y B, ta c:
x y
0 x.y
1 y x
=
=
= +

l duy nht (x v y l 2 phn tu b cua nhau)


Phn tu b cua mt phn tu bt ky l duy nht.
b. inh l 2 (l v su dong nhat cua php cong v php nhn logic)
x B, ta c:
x + x +. . . . . + x = x
x. x. x. . . . . . x = x
c. inh l 3 (inh l v phu dinh hai lan)
x B, ta c: x = x
d. inh l 4 (inh l De Morgan)
x, y, z B, ta c:
z y x . . z y x = + +
z y x x.y.z + + =
H qua: x, y, z B, ta c:
x + y + z = z y x + + = z . y . x
x. y. z = x.y.z = z y x + +
e. inh l 5 (inh l dn)
x, y B, ta c:
x. ( x + y) = x.y
x + ( x .y) = x + y
Hai mnh d ny l doi ngau
Hai mnh d ny l doi ngau
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 13
f. inh l 6 (inh l nuot)
x, y B, ta c:
x + x. y = x
x.(x + y) = x
g. inh l 7 (Quy tc tnh doi voi hng)
Voi 0, 1 B, ta c:
0 = 1
1 = 0
2.2. HM BOOLE V CC PHUONG PHP BIEU DIEN
2.2.1. Hm Boole
1. D|nh nghia
Hm Boole l mt nh xa tu dai s Boole vo chnh n. Nghia l x, y B duoc goi l cc
bin Boole th hm Boole, k hiu l f, duoc hnh thnh trn co so lin kt cc bin Boole bng cc
php ton + (cng logic), x / . (nhn logic), ngh|ch dao logic (-).
Hm Boole don gian nht l hm Boole theo 1 bin Boole, duoc cho nhu sau:
f(x) = x, f(x) = x , f(x) = ( l hng s )
Trong truong hop tng qut, ta c hm Boole theo n bin Boole duoc k hiu nhu sau:
f(x
1
, x
2
, ...., x
n
)
2. Cc tnh cht cua hm Boole
Nu f(x
1
, x
2
, ...., x
n
) l mt hm Boole th:
- .f(x
1
, x
2
, ...., x
n
) cung l mt hm Boole.
- f (x
1
, x
2
, ...., x
n
) cung l mt hm Boole.
Nu f
1
(x
1
, x
2
, ...., x
n
) v f
2
(x
1
, x
2
, ...., x
n
) l nhung hm Boole th:
- f
1
(x
1
, x
2
, ...., x
n
) + f
2
(x
1
, x
2
, ...., x
n
) cung l mt hm Boole.
- f
1
(x
1
, x
2
, ...., x
n
).f
2
(x
1
, x
2
, ...., x
n
) cung l mt hm Boole.
Vy, mt hm Boole f cng duc hnh thnh trn co so lin kt cc hm Boole bng cc
php ton + (cng logic), x (.) (nhn logic) ho}c ngh|ch dao logic (-).
3. Gi tr| cua hm Boole
Gia su f(x
1
, x
2
, ...., x
n
) l mt hm Boole theo n bin Boole.
Trong f nguoi ta thay cc bin x
i
bng cc gi tri cu th
i
( n , 1 i = ) th gi tri f (
1
,
2
, ...,
n
)
duoc goi l gi tri cua hm Boole theo n bin.
V d 2.3:
Xt hm f(x
1
, x
2
) = x
1
+ x
2
Xt trong tp B = B* ={0,1, ta c cc truong hop sau (luu dy l php cng logic hay cn goi
php ton HOAC / php OR):
- x
1
= 0, x
2
= 0 f(0,0) = 0 + 0 = 0
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 14
- x
1
= 0, x
2
= 1 f(0,1) = 0 + 1 = 1
- x
1
= 1, x
2
= 0 f(1,0) = 1 + 0 = 1
- x
1
= 1, x
2
= 1 f(1,1) = 1 + 1 = 1
Ta lp duoc bang gi tri cua hm trn.
V d 2.4:
Xt hm cho boi biu thuc sau: f(x
1
, x
2
, x
3
) = x
1
+ x
2
.x
3
Xt tp B = B* = {0,1}. Hon ton tuong tu ta lp duoc bang gi tri cua hm:
x
1
x
2
x
3
f (x
1
, x
2
, x
3
) = x
1
+ x
2
.x
3
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
2.2.2. Cc phuong php biu din hm Boole
1. Phuong php biu din hm bng bang gi tr|
Dy l phuong php thuong dng d biu din hm s ni chung v cung duoc su dung d biu
din cc hm logic. Phuong php ny gm mt bang duoc chia lm hai phn:
- Mt phn dnh cho bin d ghi cc t hop gi tri c th c cua bin vo.
- Mt phn dnh cho hm d ghi cc gi tri cua hm ra tuong ung voi cc t hop bin vo.
Bang gi tri cn duoc goi l bang chn tri hay bang chn l (TRUE TABLE). Nhu vy voi mt
hm Boole n bin bang chn l s c:
- (n+1) ct: n ct tuong ung voi n bin vo, 1 ct tuong ung voi gi tri ra cua hm.
- 2
n
hng: 2
n
gi tri khc nhau cua t hop n bin.
V d 2.5: Hm 3 bin f(x
1
, x
2
, x
3
) c th duoc cho bng bang gi tri nhu sau:
x
1
x
2
x
3
f (x
1
, x
2
, x
3
)
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
Trong cc v du 2.3 v 2.4 chng ta cung d quen thuc voi phuong php biu din hm bng
bang gi tri.
x
1
x
2
f(x
1
, x
2
) = x
1
+ x
2
0
0
1
1
0
1
0
1
0
1
1
1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 15
2. Phuong php giai tch
Dy l phuong php biu din hm logic bng cc biu thuc dai s. Phuong php ny c 2 dang:
tng cua cc tch s hoc tch cua cc tng s.
Dang tng cua cc tch s goi l dang chnh tc thu nht (Dang chnh tc 1).
Dang tch cua cc tng s goi l dang chnh tc thu hai (Dang chnh tc 2).
Hai dang chnh tc ny l di ngu nhau.
Dang tng cc tch s cn goi l dang chuan tc tuyn (CTT), dang tch cc tng s cn goi l
dang chuan tc hoi (CTH).
a. Dang chnh tc 1(Dang tong cua cc tch so)
Xt cc hm Boole mt bin don gian: f(x) = x, f(x) = x , f(x) = ( l hng s).
Dy l nhung truong hop c th c di voi hm Boole 1 bin.
Chng ta s di chung minh biu thuc tng qut cua hm logic 1 bin s di voi dang chnh tc 1.
Sau d p dung biu thuc tng qut cua hm 1 bin d tm biu thuc tng qut cua hm 2 bin voi
vic xem 1 bin l hng s. Cui cng, chng ta suy ra biu thuc tng qut cua hm logic n bin cho
truong hop dang chnh tc 1 (tng cc tch s).
Xt f(x) = x:
Ta c: x =0. x + 1.x
mt khc:
( )
( )
( )

=
=
=
0 0 f
1 1 f
x x f
Suy ra: f(x) = x c th biu din:
f(x) = x = f(0). x + f (1).x
trong d: f (0), f (1) duoc goi l cc gi tri cua hm Boole theo mt bin.
Xt f(x) = x :
Ta c: x = 1. x + 0. x
Mt khc:
( )
( )
( )

=
=
=
1 0 f
0 1 f
x x f
Suy ra: f(x) = x c th biu din:
f(x) = x = f(0). x + f(1).x
Xt f(x) = ( l hng s):
Ta c: = .1 = .(x + x ) = . x + .x
Mt khc:
( )
( )
( )

=
=
=
u 0 f
u 1 f
u x f
Suy ra f(x) = c th biu din:
f(x) = = f(0). x + f(1).x
Kt luan: D f(x) = x, f(x) = x hay f(x) = , ta du c biu thuc tng qut cua hm mt bin vit
theo dang chnh tc thu nht nhu sau:
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 16
f(x) = f(0). x + f(1).x
Vy f(x) = f(0). x + f(1).x, trong d f(0), f(1) l gi tri cua hm Boole theo mt bin, duoc goi l
biu thuc tng qut cua hm 1 bin vit o dang chnh tc thu nhat (dang tong cua cc tch).
Biu thc tng qut cua hm hai bin f(x
1
, x
2
):
Biu thuc tng qut cua hm 2 bin vit theo dang chnh tc thu nht cung hon ton dua trn
cch biu din cua dang chnh tc thu nht cua hm 1 bin, trong d xem mt bin l hng s.
Cu th l: nu xem x
2
l hng s, x
1
l bin s v p dung biu thuc tng qut cua dang chnh tc
thu nht cho hm 1 bin, ta c:
f(x
1
,x
2
) = f(0,x
2
). x
1
+ f(1,x
2
).x
1
By gio, cc hm f(0,x
2
) v f(1,x
2
) tro thnh cc hm 1 bin s theo x
2
. Tip tuc p dung biu
thuc tng qut cua dang chnh tc thu nht cho hm 1 bin, ta c:
f(0,x
2
) = f(0,0). x
2
+ f(0,1).x
2
f(1,x
2
) = f(1,0). x
2
+ f(1,1).x
2
Suy ra:
f(x
1
,x
2
) = f(0,0). x
1
x
2
+ f(0,1). x
1
x
2
+ f(1,0).x
1
x
2
+ f(1,1).x
1
x
2
Dy chnh l biu thuc tng qut cua dang chnh tc thu nht (dang tng cua cc tch s) vit cho
hm Boole hai bin s f(x
1
,x
2
).
Biu thuc tng qut ny c th biu din bng cng thuc sau:
f(x
1
,x
2
) =
2
u
2
1
u
1 2
1
0 e
1
x )x u , u f(
2
2

=
Trong d e l s thp phn tuong ung voi m nhi phn (
1
,
2
) v:
x
1
nu
1
= 1
x
1
nu
1
= 0
x
2
nu
2
= 1
x
2
nu
2
= 0
Biu thc tng qut cho hm Boole n bin:
Tu biu thuc tng qut vit o dang chnh tc thu nht cua hm Boole 2 bin, ta c th tng qut
ho cho hm Boole n bin f(x
1
,x
2
, ..,x
n
) nhu sau:
f(x
1
,x
2
, ..,x
n
) =
n
n
2
2 1
...x x )x ,...., , f(
n 2
1
n
2
0 e
1
u u u
1
u u u

=
trong d e l s thp phn tuong ung voi m nhi phn (
1
,
2
, ...,
n
);
v: x
i
nu
i
= 1
x
i
nu
i
= 0 (voi i = 1, 2, 3,,n)
1
1
x
u
=
2
2
x
u
=
i
i
u
x =
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 17
V d 2.6:
Vit biu thuc cua hm 3 bin theo dang chnh tc 1:
f(x
1
,x
2
,x
3
) =

=
1 2
0 e
3
f (
1
,
2
,
3
).x
1
1
.x
2
2
.x
3
3
Bang duoi dy cho ta gi tri cua s thp phn e v t hop m nhi phn (
1
,
2
,
3
) tuong ung:
e
1

2

3
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
Biu thuc cua hm 3 bin vit theo dang tng cc tch nhu sau:
f(x
1
, x
2
, x
3
) = f(0,0,0) x
1
x
2
x
3
+ f(0,0,1) x
1
x
2
x
3
+ f(0,1,0) x
1
x
2
x
3
+ f(0,1,1) x
1
x
2
x
3
+ f(1,0,0) x
1
x
2
x
3
+ f(1,0,1)x
1
x
2
x
3
+ f(1,1,0) x
1
x
2
x
3
+ f(1,1,1) x
1
x
2
x
3
Vay dang chnh tc thu nhat l dang tong cua cc tch so m trong moi tch so chua day
du cc bin Boole duoi dang that hoc dang b (nghich dao).
b. Dang chnh tc 2 (tch cua cc tong so):
Dang chnh tc 2 l dang di ngu cua dang chnh tc 1 nn biu thc tng qut cua dng
chnh tc 2 cho n bin duoc vit nhu sau:
f(x
1
, x
2
, ..., x
n
) =

=
1 2
0 e
n
[f(
1
,
2
,
3
) + x
1
1
+ x
2
2
+ ...+ x
n
n
)]
trong d e l s thp phn tuong ung voi m nhi phn (
1
,
2
, ...,
n
);
v:
x
i
nu
i
= 1
x
i
nu
i
= 0 (voi i = 1, 2, 3,,n)
V d 2.7: Biu thuc cua hm Boole 2 bin o dang tch cc tng s (dang chnh tc 2) duoc vit
nhu sau:
f(x
1
,x
2
)=[f(0,0)+x
1
+x
2
][f(0,1)+x
1
+ x
2
][f(1,0)+ x
1
+x
2
][f(1,1)+ x
1
+ x
2
]
V d 2.8: Biu thuc cua hm Boole 3 bin o dang chnh tc 2:
f(x
1
,x
2
,x
3
) = [f(0,0,0)+x
1
+ x
2
+x
3
].[f(0,0,1)+x
1
+x
2
+ x
3
].
[f(0,1,0)+x
1
+ x
2
+x
3
].[f(0,1,1)+x
1
+ x
2
+ x
3
].
[f(1,0,0)+ x
1
+x
2
+x
3
].[f(1,0,1)+ x
1
+x
2
+ x
3
].
[f(1,1,0)+ x
1
+ x
2
+x
3
].[f(1,1,1)+ x
1
+ x
2
+ x
3
]
i
i
x
u
=
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 18
Vay, dang chnh tc thu hai l dang tch cua cc tong so m trong d moi tong so ny
chua day du cc bin Boole duoi dang that hoc dang b.
V d 2.9:
Hy vit biu thuc biu din cho hm Boole 2 bin f(x
1
,x
2
) o dang chnh tc 1, voi bang gi tri
cua hm duoc cho nhu sau:
x
1
x
2
f(x
1
,x
2
)
0 0 0
0 1 1
1 0 1
1 1 1
Vit duoi dang chnh tc 1 ta c:
f(x
1
,x
2
) = f(0,0). x
1
x
2
+ f(0,1). x
1
.x
2
+ f(1,0).x
1
. x
2
+ f(1,1).x
1
.x
2
= 0. x
1
x
2
+ 1. x
1
.x
2
+ 1.x
1
. x
2
+ 1.x
1
.x
2
= x
1
.x
2
+ x
1
. x
2
+ x
1
.x
2
Nhn xt:
Dang chnh tc thu nhat, tong cua cc tch so, l dang lit k tat ca cc to hop nhi
phn cc bin vo sao cho tuong ung voi nhng to hop d gi tri cua hm ra bng 1
chi can lit k nhng to hop bin lm cho gi tri hm ra bng 1.
Khi lit k nu bin tuong ung bng 1 duoc vit o dang that (x
i
), nu bin tuong ung
bng 0 duoc vit o dang b ( x
i
).
V d 2.10:
Vit biu thuc biu din hm f(x
1
,x
2
,x
3
) o dang chnh tc 2 voi bang gi tri cua hm ra duoc cho
nhu sau:
x
3
x
2
x
1
f(x
1
,x
2,
x
3
)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
Vit duoi dang chnh tc 2 (tch cc tng s):
f(x
1
,x
2
,x
3
) = (0+x
1
+x
2
+x
3
).(0+x
1
+x
2
+ x
3
).(0+x
1
+ x
2
+x
3
).
(1+x
1
+ x
2
+ x
3
).(1+ x
1
+x
2
+x
3
).(1+ x
1
+x
2
+ x
3
).
(1+ x
1
+ x
2
+x
3
).(1+ x
1
+ x
2
+ x
3
)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 19
p dung tin d v phn tu trung ha 0 v 1 ta c:
x + 1 = 1, x . 1 = x
x + 0 = x, x . 0 = 0
nn suy ra biu thuc trn c th vit gon lai:
f(x
1
,x
2
,x
3
) = (x
1
+x
2
+x
3
).(x
1
+x
2
+ x
3
).(x
1
+ x
2
+x
3
)
Nhn xt:
Dang chnh tc thu hai l dang lit k tat ca cc to hop nhi phn cc bin vo sao cho
tuong ung voi nhng to hop d gi tri cua hm ra bng 0 chi can lit k nhng to
hop bin lm cho gi tri hm ra bng 0.
Khi lit k nu bin tuong ung bng 0 duoc vit o dang that (x
i
), nu bin tuong ung
bng 1 duoc vit o dang b ( x
i
).
V du don gian sau gip SV hiu r hon v cch thnh lp bang gi tri cua hm, tm hm mach
v thit k mach.
V d 2.11
Hy thit k mach din sao cho khi cng tc 1 dng th dn do, khi cng tc 2 dng dn do, khi
ca hai cng tc dng dn do ?
Loi giai:
Du tin, ta qui dinh trang thi cua cc cng tc v bng dn:
- Cng tc ho : 0 Dn tt : 0
- Cng tc dng : 1 Dn do : 1
Bang trang thi m ta hoat dng cua mach nhu sau:
Cng tc 1 Cng tc 2 Trang thi dn
x
1
x
2
f(x
1
,x
2
)
0
0
1
1
0
1
0
1
0
1
1
1
Tu bang trang thi c th vit biu thuc cua hm f(x
1
,x
2
) theo dang chnh tc 1 hoc chnh tc 2.
- Theo dang chnh tc 1 ta c:
f(x
1
, x
2
) = x
1
.x
2
+ x
1
. x
2
+ x
1
.x
2
= x
1
.x
2
+ x
1
( x
2
+ x
2
)
= x
1
.x
2
+ x
1
= x
1
+ x
2
- Theo dang chnh tc 2 ta c:
f(x
1
, x
2
) = (0+x
1
+x
2
) = x
1
+ x
2
Tu biu thuc m ta trang thi do/tt cua dn f(x
1
,x
2
) thy rng c th thuc hin mach bng phn
tu logic HOAC c 2 ng vo (cng OR 2 ng vo).
Bi tap p dung: Mot hoi dong gim khao gom 3 thnh vin. Moi thnh vin c th lua chon ONG
hoc KHNG ONG . Kt qua goi l AT khi da so cc thnh vin trong hoi dong gim khao
ONG , nguoc lai l KHNG AT. Hy thit k mach giai quyt bi ton trn.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 20
3. Biu din hm bng bang Karnaugh (ba Karnaugh)
Dy l cch biu din lai cua phuong php bang duoi dang bang gm cc
vung nhu hnh bn.
Trn bang ny nguoi ta b tr cc bin vo theo hng hoc theo ct cua
bang. Trong truong hop s luong bin vo l chn, nguoi ta b tr s luong
bin vo theo hng ngang bng s luong bin vo theo ct doc cua bang.
Trong truong hop s luong bin vo l le, nguoi ta b tr s luong bin vo
theo hng ngang nhiu hon s luong bin vo theo ct doc 1 bin hoc nguoc lai.
Cc t hop gi tri cua bin vo theo hng ngang hoc theo ct doc cua bang duoc b tr sao cho
khi ta di tu mt sang mt ln cn voi n chi lm thay di mt gi tri cua bin, nhu vy thu tu
b tr hay sp xp cc t hop gi tri cua bin vo theo hng ngang hoc theo ct doc cua bang
Karnaugh hon ton tun thu theo m Gray.
Gi tri ghi trong mi vung ny chnh l gi tri cua hm ra tuong ung voi cc t hop gi tri cua
bin vo. O nhung m gi tri hm l khng xc dinh (c th bng 0 hay bng 1), c nghia l gi tri
cua hm l ty (hay ty dinh), nguoi ta k hiu bng chu X.
Nu hm c n bin vo s c 2
n
vung.
Phuong php biu din hm bng bang Karnaugh chi thch hop cho hm c ti da 6 bin, nu
vuot qu vic biu din s rt rc ri.
Duoi dy l bang Karnaugh cho cc truong hop hm 2 bin, 3 bin, 4 bin v 5 bin:
2.3. TI THIEU HA HM BOOLE
2.3.1. ai cuong
Trong thit bi my tnh nguoi ta thuong thit k gm nhiu modul (khu) v mi modul ny
duoc dc trung bng mt phuong trnh logic. Trong d, muc d phuc tap cua so d ty thuc vo
phuong trnh logic biu din chng. Vic dat duoc d n dinh cao hay khng l ty thuc vo
phuong trnh logic biu din chng o dang ti thiu ha hay chua. D thuc hin duoc diu d, khi
thit k mach s nguoi ta dt ra vn d ti thiu ha cc hm logic. Diu d c nghia l phuong
f(x
1
,x
2
)
x
1
x
2
0
1
0 1
f
x
1
x
2
x
3
0
1
00 01 11 10
f
x
1
x
2
x
3
x
4
00
01
11
10
00 01 11 10
f
x
2
x
3
x
4
x
5
00
01
11
10
00 01 11 10 10 11 01 00
x
1
=0 x
1
=1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 21
trnh logic biu din sao cho thuc su gon nht (s luong cc php tnh v s luong cc s duoc biu
din duoi dang tht hoc b l t nht).
Cc k thut d dat duoc su thuc hin hm Boole mt cch don gian nht phu thuc vo nhiu
yu t m chng ta cn cn nhc:
Mot l so luong cc php tnh v so luong cc so (s luong literal) duoc biu din duoi dang tht
hoc b l t nht, diu ny dng nghia voi vic s luong dy ni v s luong du vo cua mach l t
nht.
Hai l so luong cong cn thit d thuc hin mach phai t nht, chnh s luong cng xc dinh kch
thuoc cua mach. Mt thit k don gian nht phai ung voi s luong cng t nht chu khng phai s
luong literal t nht.
Ba l so muc logic cua cc cng. Giam s muc logic s giam tr tng cng cua mach v tn hiu
s qua t cng hon. Tuy nhin nu ch trong dn vn d giam tr s phai tra gi s luong cng tng
ln.
Boi vy trong thuc t khng phai lc no cung dat duoc loi giai ti uu cho bi ton ti thiu ha.
2.3.2. Cc buc tin hnh ti thiu ha
Dng cc php ti thiu d ti thiu ha cc hm s logic.
Rt ra nhung thua s chung nhm muc dch ti thiu ha thm mt buoc nua cc phuong
trnh logic.
2.3.3. Cc phuong php ti thiu ha
C nhiu phuong php thuc hin ti thiu ho hm Boole v c th dua v 2 nhm l bin doi
dai so v dng thuat ton. Phuong php bin di dai s (phuong php giai tch) dua vo cc tin d,
dinh l, tnh cht cua hm Boole d thuc hin ti thiu ho.
O nhm thuat ton c 2 phuong php thuong duoc dng l: phuong php bang Karnaugh (cn
goi l ba Karnaugh ba K) dng cho cc hm c tu 6 bin tro xung, v phuong php Quine-
Mc.Cluskey c th su dung cho hm c s bin bt ky cung nhu cho php thuc hin tu dng theo
chuong trnh duoc vit trn my tnh.
Trong phn ny chi gioi thiu 2 phuong php dai din cho 2 nhm:
Phuong php bin doi dai so (nhm bin di dai s).
Phuong php bang Karnaugh (nhm thut ton).
1. Phuong php bin di di s
Dy l phuong php ti thiu ha hm Boole (phuong trnh logic) dua vo cc tin d, dinh l,
tnh cht cua dai s Boole.
V d 2.12 Ti thiu ho hm f(x
1
,x
2
) = x
1
x
2
+ x
1
x
2
+ x
1
x
2
f(x
1
,x
2
) = x
1
x
2
+ x
1
x
2
+ x
1
x
2
= ( x
1
+ x
1
).x
2
+ x
1
x
2
= x
2
+ x
1
x
2
= x
2
+ x
1
V d 2.13 Ti thiu ho hm 3 bin sau
f(x
1
,x
2
,x
3
) = x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
2
x
3
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 22
= x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
2
( x
3
+ x
3
)
= x
1
x
2
x
3
+ x
1
x
2
( x
3
+ x
3
) + x
1
x
2
= x
1
x
2
x
3
+ x
1
( x
2
+ x
2
)
= x
1
x
2
x
3
+ x
1
= x
1
+ x
2
x
3
V d 2.14 Rt gon biu thuc: f = B C A C AB + + +
p dung dinh l De Morgan ta c:
f = B C A C AB + + .
= B C A C B A + + + ). (
= B C A C B C A + + +
= C B C A C A + + +
= B C A C A + + + ). 1 (
= B A C C + +
= C B A + +
Vy, d thuc hin mach ny c th dng cng OR 3 ng vo.
2. Phuong php bang Karnaugh
D ti thiu ha hm Boole bng phuong php bang Karnaugh phai tun thu theo qui tc v k
cn: Hai duc gi l k cn nhau l hai m khi ta t ny sang kia ch lm thay
di gi trj cua 1 bin.
Quy tc chung cua phuong php rt gon bng bang Karnaugh l gom (kt hop) cc k cn lai
voi nhau.
Khi gom 2 k cn s loai duoc 1 bin (2=2
1
loai 1 bin).
Khi gom 4 k cn vng trn s loai duoc 2 bin (4=2
2
loai 2 bin).
Khi gom 8 k cn vng trn s loai duoc 3 bin (8=2
3
loai 3 bin).
Tng qut, khi gom 2
n
k cn vng trn s loi duc n bin. Nhng bin bj loi l
nhng bin khi tadi vng qua cc k cn m gi trj cua chng thaydi.
Nhng diu cn luu :
Vng gom duoc goi l hop l khi trong vng gom d c t nht 1 chua thuc vng gom no.
Cc k cn mun gom duoc phai l k cn vng trn nghia l k cn cui cung l k cn
du tin.
Vic kt hop nhung k cn voi nhau cn ty thuc vo phuong php biu din hm Boole theo
dang chnh tc 1 hoc chnh tc 2, cu th l:
Nu biu din hm theo dang chnh tc 1 (tong cc tch so) ta chi quan tm nhung k
cn c gi tri bng 1 v ty dinh. Kt qua mi vng gom lc ny s l mt tch rt gon.
Kt qua cua hm biu din theo dang chnh tc 1 s l tng tt ca cc tch s rt gon cua
tt ca cc vng gom.
Nu biu din hm theo dang chnh tc 2 (tch cc tong so) ta chi quan tm nhung k
cn c gi tri bng 0 v ty dinh. Kt qua mi vng gom lc ny s l mt tng rt gon.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 23
Kt qua cua hm biu din theo dang chnh tc 2 s l tch tt ca cc tng s rt gon cua
tt ca cc vng gom.
Ta quan tm nhung ty dinh (X) sao cho nhung ny kt hop voi nhung c gi tri bng 1
(nu biu din theo dang chnh tc 1) hoc bng 0 (nu biu din theo dang chnh tc 2) lm cho s
lung k cn l 2
n
ln nht. Luu cc ty dinh (X) chi l nhung thm vo vng gom d rt
gon hon cc bin m thi.
Cc vng gom bt buc phai phu ht tt ca cc c gi tri bng 1 c trong bang (nu ti thiu
theo dang chnh tc 1), tuong tu cc vng gom bt buc phai phu ht tt ca cc c gi tri bng 0
c trong bang (nu ti thiu theo dang chnh tc 2) th kt qua ti thiu ho moi hop l.
Cc trung hp d}c bit:
Nu tt ca cc cua bang Karnaugh du bng 1 v tuy dinh (X) nghia l tt ca cc du k cn
gi tri cua hm bng 1.
Nu tt ca cc cua bang Karnaugh du bng 0 v tuy dinh (X) nghia l tt ca cc du k cn
gi tri cua hm bng 0.
V d 2.15: Ti thiu ha hm sau
0 1
0 0 1
1 1 1
V d 2.16:
1i thiu theo chnh tc 1: Ta chi quan tm dn nhung c gi tri bng 1 v ty dinh (X), nhu
vy s c 2 vng gom d phu ht cc c gi tri bng 1: vng gom 1 gm 4 k cn, v vng gom
2 gm 2 k cn (hnh v).
Di voi vng gom 1: C 4 = 2
2
nn loai duoc 2 bin. Khi di vng qua 4 k cn trong vng
gom chi c gi tri cua bin x
1
khng di (lun bng 1), cn gi tri cua bin x
2
thay di (tu 10) v
gi tri cua bin x
3
thay di (tu 01) nn cc bin x
2
v x
3
bi loai, chi cn lai bin x
1
trong kt qua
cua vng gom 1. V x
1
=1 nn kt qua cua vng gom 1 theo dang chnh tc 1 s c x
1
vit o dang
tht: x
1
Di voi vng gom 2: C 2 = 2
1
nn s loai duoc 1 bin. Khi di vng qua 2 k cn trong vng
gom gi tri cua bin x
2
v x
3
khng di, cn gi tri cua bin x
1
thay di (tu 01) nn cc bin x
2
v
x
3
duoc giu lai, chi c bin x
1
bi loai. V x
2
=1 v x
3
=1 nn kt qua cua vng gom 2 theo dang chnh
tc 1 s c x
2
v x
3
vit o dang tht: x
2
.x
3
Kt hop 2 vng gom ta c kt qua ti gian theo chnh tc 1:
f(x
1
,x
2
,x
3
) = x
1
+ x
2
.x
3
00 01 11 10
0 0 0 1 1
1 0 1 1 1
x
1
x
2
f(x
1
,x
2
)
Ti thiu ho theo chnh tc 2:
f(x
1
,x
2
) = x
1
+ x
2
x
1
,x
2
x
3
f(x
1
,x
2
,x
3
)
Vng gom 2: x
2
.x
3
Vng gom 1: x
1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 24
1i thiu theo chnh tc 2: Ta quan tm dn nhung c gi tri bng 0 v ty dinh (X), nhu vy
cung c 2 vng gom (hnh v), mi vng gom du gm 2 k cn.
Di voi vng gom 1: C 2 = 2
1
nn loai duoc 1 bin, bin bi loai l x
2
(v c gi tri thay di tu
01). V x
1
=0 v x
3
=0 nn kt qua cua vng gom 1 theo dang chnh tc 2 s c x
1
v x
3
o dang
tht: x
1
+ x
3
.
Di voi vng gom 2: C 2 = 2
1
nn loai duoc 1 bin, bin bi loai l x
3
(v c gi tri thay di tu
01). V x
1
=0 v x
2
=0 nn kt qua cua vng gom 2 theo dang chnh tc 2 s c x
1
v x
2
o dang
tht: x
1
+x
2
.
Kt hop 2 vng gom c kt qua cua hm f vit theo dang chnh tc 2 nhu sau:
f (x
1
,x
2
,x
3
) = (x
1
+x
3
).(x
1
+x
2
)
= x
1
.x
1
+ x
1
.x
2
+ x
1
.x
3
+ x
2
.x
3
= x
1
+ x
1
.x
2
+ x
1
.x
3
+ x
2
.x
3
= x
1
(1+ x
2
+ x
3
) + x
2
.x
3
= x
1
+ x
2
.x
3
Nhn xt: Trong v du ny, hm ra vit theo dang chnh tc 1 v hm ra vit theo dang chnh tc 2
l ging nhau. Tuy nhin c truong hop hm ra cua hai dang chnh tc 1 v 2 l khc nhau, nhung
gi tri cua hm ra ung voi mt t hop bin du vo l duy nht trong ca 2 dang chnh tc.
Ch : Nguoi ta thuong cho hm Boole duoi dang biu thuc rt gon. V c 2 cch biu din hm
Boole theo dang chnh tc 1 hoc 2 nn s c 2 cch cho gi tri cua hm Boole ung voi 2 dang
chnh tc d:
Dang chnh tc 1: Tong cc tch so.
f(x
1
,x
2
,x
3
) = (3,4,7) + d(5,6)
Trong d k hiu d chi gi tri cc ny l ty dinh (d: Dont care)
Lc d bang Karnaugh s duoc cho nhu hnh trn. Tu biu thuc rt gon cua hm ta thy tai cc
ung voi t hop nhi phn cc bin vo c gi tri l 3, 4, 7 hm ra c gi tri bng 1; tai cc ung voi
t hop nhi phn cc bin vo c gi tri l 5, 6 hm ra c gi tri l ty dinh; hm ra c gi tri bng 0
o nhung cn lai ung voi t hop cc bin vo c gi tri l 0, 1, 2.
Dang chnh tc 2: Tch cc tong so.
Phuong trnh trn cung tuong duong voi cch cho hm nhu sau:
f(x
1
,x
2
,x
3
) = (0, 1, 2) + d(5, 6)
00 01 11 10
0 0 0 1 1
1 0 1 1 1
00 01 11 10
0 0 0 X 1
1 0 1 1 X
x
1
,x
2
x
3
f(x
1
,x
2
,x
3
)
Vng gom 2: x
1
+ x
2
Vng gom 1: x
1
+ x
3
x
1
,x
2
x
3
f(x
1
,x
2
,x
3
)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 2. Di s BOOLE Trang 25
V d 2.17: Ti thiu ha hm 4 bin cho duoi dang biu thuc sau:
f(x
1
,x
2
,x
3
,x
4
) = (2,6,10,11,12,13) + d(0,1,4,7,8,9,14,15)
Thuc hin ti thiu ha theo dang chnh tc 1: tu ban d Karnaugh ta c 2 vng gom, vng gom 1
gm 8 k cn v vng gom 2 gm 8 k cn. Kt qua ti thiu ha nhu sau:
Vng gom 1: x
1
Vng gom 2: x
4
Vy: f(x
1
,x
2
,x
3
,x
4
) = x
1
+ x
4
00 01 11 10
00 X X 1 X
01 X 0 1 X
11 0 X X 1
10 1 1 X 1
00 01 11 10
00 X X 1 X
01 X 0 1 X
11 0 X X 1
10 1 1 X 1
x
4
x
3
x
2
x
1
f(x
1
,x
2
,x
3
,x
4
)
x
4
x
3
x
2
x
1
f(x
1
,x
2
,x
3
,x
4
)
Vng gom 2
Vng gom 1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 26
Chuong 3
CC PHN T LOGIC CO BN
3.1. KHI NIEM V MACH S
3.1.1. Mach tuong t
Mach tuong tu (cn goi l mach Analog) l mach dng d xu l cc tn hiu tuong tu. Tn hiu
tuong tu l tn hiu c bin d bin thin lin tuc theo thoi gian.
Vic xu l bao gm cc vn d: Chinh luu, khuch dai, diu ch, tch sng
Nhuoc dim cua mach tuong tu:
- Kha nng chng nhiu thp (nhiu d xm nhp).
- Vic phn tch thit k mach phuc tap.
D khc phuc nhung nhuoc dim ny nguoi ta su dung mach s.
3.1.2. Mach s
Mach s (cn goi l mach Digital) l mach dng d xu l tn hiu s. Tn hiu s l tn hiu c
bin d bin thin khng lin tuc theo thoi gian hay cn goi l tn hiu gin doan, duoc biu din
duoi dang sng xung voi 2 muc din th cao v thp m tuong ung voi hai muc din th ny l hai
muc logic 1 v 0 cua mach s.
Vic xu l trong mach s bao gm cc vn d nhu:
- Loc s.
- Diu ch s / Giai diu ch s.
- M ha / Giai m
Uu dim cua mach s so voi mach tuong tu :
- D chng nhiu cao (nhiu kh xm nhp).
- Phn tch thit k mach s tuong di don gian.
V vy, hin nay mach s duoc su dung kh ph bin trong tt ca cc linh vuc nhu: Do luong s,
truyn hnh s, diu khin s. . .
3.1.3. H logic duong/m
Trang thi logic cua mach s c th biu din bng mach din don gian nhu trn hnh 3.1:
Hoat dng cua mach din ny nhu sau:
- K Mo : Dn Tt
- K Dng : Dn Sng
Trang thi Dng/Mo cua kha K hoc trang thi Sng/Tt cua
dn D cung duoc dc trung cho hai trang thi logic cua mach s.
D
K
v
i
Hnh 3.1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 27
Cung c th thay kha K bng kha din tu dng BJT nhu sau (hnh 3.2):
Giai thch cc so d mach:
Hnh 3.2a:
- Khi V
i
= 0 : BJT tt V
0
= +Vcc
- Khi V
i
> a : BJT dn bo ha V
0
= V
ces
= 0,2 (V) 0 (V).
Hnh 3.2b:
- Khi V
i
= 0 : BJT tt V
0
= -Vcc
- Khi V
i
< -a: BJT dn bo ha V
0
= V
ces
= -V
ecs
= - 0,2 (V) 0 (V).
Vy, trong ca 2 so d muc din th vo/ra cua kho din tu dng BJT cung tuong ung voi 2
trang thi logic cua mach s.
Nguoi ta phn bit ra hai ho logic ty thuc vo muc din p:
- Nu chon : V
logic 1
> V
logic 0
ho logic duong
- Nu chon : V
logic 1
< V
logic 0
ho logic m
Logic duong v logic m l nhung ho logic to, ngoi ra cn c ho logic mo (Fuzzy Logic) hin
dang duoc ung dung kh ph bin trong cc thit bi din tu v cc h thng diu khin tu dng.
3.2. CONG LOGIC (LOGIC GATE)
3.2.1. Khi nim
Cng logic l mt trong cc thnh phn co ban d xy dung mach s. Cng logic duoc ch tao
trn co so cc linh kin bn dn nhu Diode, BJT, FET d hoat dng theo bang trang thi cho truoc.
3.2.2 Phn loai
C ba cch phn loai cng logic:
- Phn loai cng theo chuc nng.
- Phn loai cng theo phuong php ch tao.
- Phn loai cng theo ng ra.
1. Phn loi cng logic theo chc nng
a)
RB
Rc
Q
+Vcc
V
i
V
0
b)
Rc
Q
R
B
-Vcc
V
i
V
0
Hnh 3.2. Biu din trang thi logic cua mach so bng kha din tu dng BJT
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 28
a. Cong EM (BUFFER)
Cng dm (BUFFER) hay cn goi l cng khng dao l cng c mt ng vo v mt ng ra voi
k hiu v bang trang thi hoat dng nhu hnh v.
Phuong trnh logic m ta hoat dng cua cng dm: y = x
Trong d:
- x l ng vo c tro khng vo Zv v cng lon do d dng vo cua cng dm rt nho.
- y l ng ra c tro khng ra Zra nho cng dm c kha nng cung cp dng ng ra lon.
Chnh v vy nguoi ta su dung cng dm theo 2 nghia sau:
- Dng d phi hop tro khng.
- Dng d cch ly v nng dng cho tai.
V phuong din mach din c th xem cng dm (cng khng dao) ging nhu mach khuych dai C
chung (dng pha).
b.Cong AO (NOT)
Cng DAO (cn goi l cng NOT) l cng logic c 1 ng vo v 1 ng ra, voi k hiu v bang
trang thi hoat dng nhu hnh v:
Phuong trnh logic m ta hoat dng cua cng DAO: y = x
Cng dao giu chuc nng nhu mt cng dm, nhung nguoi ta goi l dm dao v tn hiu ng ra
nguoc muc logic (nguoc pha) voi tn hiu ng vo.
Trong thuc t ta c th ghp hai cng DAO ni tng voi nhau d thuc hin chuc nng cua cng
DEM (cng khng dao) (hnh 3.5):
Bang trang thi
x
y
0
0
1 1
x
y
Hnh 3.3. K hiu v bang trang thi cua cong dm
Bang trang thi:
x
y
0
1
1 0
x
y
Hnh 3.4. K hiu v bang trang thi hoat dong cua cong dao
x
x
x
x x =
Hnh 3.5. Su dung 2 cong AO tao ra cong EM
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 29
V phuong din mach din, cng DAO ging nhu tng khuych dai E chung.
c. Cong V (AND)
Cng AND l cng logic thuc hin chuc nng cua php ton nhn logic cc tn hiu vo. Cng
AND 2 ng vo c 2 ng vo 1 ng ra k hiu nhu hnh v:
Phuong trnh logic m ta hoat dng cua cng AND:
y = x
1
.x
2
Bang trang thi hoat dng cua cng AND 2 ng vo:
x
1
x
2
y
0 0 0
0 1 0
1 0 0
1 1 1
Tu bang trang thi ny c nhn xt: Ng ra y chi bng 1 (muc logic 1) khi ca 2 ng vo du bng
1, ng ra y bng 0 (muc logic 0) khi c mt ng vo bt ky (x
1
hoc x
2
) bng 0.
Xt truong hop tng qut cho cng AND c n ng vo x
1
, x
2
... x
n
:
y
AND
=

= =
=
) n 1, (i 1 x 1
0 x 0
i
i
Jy, dc dim cua cng AND l: ng ra y ch bng 1
khi tt ca cc ng vo du bng 1, ng ra y bng 0 khi
c t nht mt ng vo bng 0.
Su dng cng AND d dng mo tn hiu:
Cho cng AND c hai ng vo x
1
v x
2
. Ta chon:
- x
1
dng vai tr ng vo diu khin (control).
- x
2
dng vai tr ng vo du liu (data).
Xt cc truong hop cu th sau dy:
- Khi x
1
= 0: y = 0 bt chp trang thi cua x
2
, ta ni cng AND kha lai khng cho du liu dua
vo ng vo x
2
qua cng AND dn ng ra.
- Khi x
1
= 1
2
x y
1 y 1
2
x
0 y 0
2
x
=
= =
= =

Ta ni cng AND mo cho du liu dua vo ng vo x


2
qua cng AND dn ng ra.
Vy, c th su dung mt ng vo bt ky cua cng AND dng vai tr tn hiu diu khin cho php
hoc khng cho php lung du liu di qua cng AND.
Su dng cng AND d to ra cng logic khc:
Nu su dung 2 t hop du v cui trong bang gi tri cua cng AND v ni cng AND theo so d
nhu hnh 3.8 th c th su dung cng AND d tao ra cng dm.
Trong thuc t, c th tn dung ht cc cng chua dng trong IC d thuc hin chuc nng cua cc
cng logic khc.
x
1
y
x
2
Hnh 3.6. Cong AND
x
1
y
x
n
Hnh 3.7. Cong AND voi n ng vo
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 30
d. Cong HOC (OR)
Cng OR l cng thuc hin chuc nng cua php ton cng logic cc tn hiu vo. Trn hnh v l
k hiu cua cng OR 2 ng vo:
Phuong trnh logic cng OR 2 ng vo: y = x
1
+ x
2
Bang trang thi m ta hoat dng:
x
1
x
2
y = x
1
+x
2
0 0 0
0 1 1
1 0 1
1 1 1
Xt truong hop tng qut di voi cng OR c n ng vo.
Phuong trnh logic:
y
OR
=

= =
=
) n 1, (i 0 x 0
1 x 1
i
i
Dc dim cua cng OR l: Tn hiu ng ra ch bng 0 khi v ch khi tt ca cc ng vo du
bng 0, nguc li tn hiu ng ra bng 1 khi ch cn c t nht mt ng vo bng 1.
Su dng cng OR d dng mo tn hiu:
Xt cng OR c 2 ng vo x
1
, x
2
. Nu chon x
1
l ng vo diu khin (control), x
2
ng vo du liu
(data), ta c cc truong hop cu th sau dy:
- x
1
= 1: y = 1, y lun bng 1 bt chp x
2
Ta ni cng OR kha khng cho du liu di qua.
x
1
x
2
y
+x = 0 x
1
= x
2
= 0 y = 0
+x = 1 x
1
= x
2
= 1 y = 1 y = x
Hnh 3.8. Su dung cong AND tao ra cong dm.
K hiu Chu u
K hiu theo M, Nht, c
x
1
x
2
y
x
1
x
2
y
Hnh 3.9a Cong OR 2 ng vo
x
1
x
n
y
Hnh 3.9b Cong OR n ng vo
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 31
- x
1
= 0:
2
x y
1 y 1
2
x
0 y 0
2
x
=
= =
= =

Ta ni cng OR mo cho du liu tu ng vo x


2
qua
cng dn ng ra y.
Su dng cng OR d thc hin chc nng cng logic khc: Su dung hai t hop gi tri du v
cui cua bang trang thi cua cng OR v ni mach cng OR nhu so d hnh 3.10:
- x = 0, x
1
= x
2
= 0 y = 0
- x = 1, x
1
= x
2
= 1 y = 1 y = x: cng OR dng vai tr nhu cng dm.
e. Cong NAND
Dy l cng thuc hin php ton nhn dao, v so d logic cng NAND gm 1 cng AND mc
ni tng voi 1 cng NOT, k hiu v bang trang thi cng NAND duoc cho nhu hnh 3.11:
Phuong trnh logic m ta hoat dng cua cng NAND 2 ng vo:
2 1
.x x y =
Xt truong hop tng qut: Cng NAND c n ng vo.
y
NAND
=

= =
=
) n 1, (i 1 x 0
0 x 1
i
i
Jy, dc dim cua cng NAND l: tn hiu ng ra ch bng 0 khi tt ca cc ng vo du bng
1, v tn hiu ng ra s bng 1 khi ch cn t nht mt ng vo bng 0.
Su dng cng NAND d dng mo tn hiu:
Xt cng NAND c hai ng vo. Chon x
1
l ng vo diu khin (control), x
2
l ng vo du liu
(data), ln luot xt cc truong hop sau:
- x
1
= 0: y = 1 (y lun bng 1 bt chp gi tri cua x
2
) ta ni cng NAND kha.
- x
1
= 1:
2
x y
0 y 1
2
x
1 y 0
2
x
=
= =
= =

Cng NAND mo cho du liu vo ng vo x


2
dn
ng ra dng thoi dao muc tn hiu ng vo x
2
, lc ny cng NAND dng vai tr l cng DAO.
x
1
x
2
y
x
Hnh 3.10. Su dung cong OR lm cong dm
Hnh 3.11. Cong NAND: K hiu, so do logic tuong duong v bang trang thi
x
1
x
2
y
0 0 1
0 1 1
1 0 1
1 1 0
x
1
y
x
2
x
1
x
2
y
x
1
y
x
n
Hnh 3.12.Cong NAND n ng vo
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 32
x
1
x
2
y
1
x
2
x
y =
2 1 2 1 2 1
. x x x x x x + = + =
x
1
x
2
y
Hnh 3.13d. Dng cong NAND tao cong OR
Su dng cng NAND d to cc cng logic khc:
- dng cng NAND tao cng NOT:
- dng cng NAND tao cng BUFFER (cng dm):
- dng cng NAND tao cng AND:
- dng cng NAND tao cng OR:
x
1
y
x
2
x
y = x x x x x = + =
2 1 2 1
x
y
Hnh 3.13a.Dng cong NAND tao cong NOT
x x y = =
y x
x
1
x
2
x
x
y
Hnh 3.13b.Dng cong NAND tao cong EM (BUFFER)
y
x
1
x
2
2 1
.x x y =
2 1 2 1
.x x x x =
x
1
x
2
y
Hnh 3.13c. Su dung cong NAND tao cong AND
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 33
f. Cong NOR
Cng NOR, cn goi l cng Hoc-Khng, l cng thuc hin chuc nng cua php ton cng dao
logic, l cng c hai ng vo v mt ng ra c k hiu nhu hnh v:
Phuong trnh logic m ta hoat dng cua cng :
y =
2 1
x x +
Bang trang thi m ta hoat dng cua cng NOR :
x
1
x
2
y
0 0 1
0 1 0
1 0 0
1 1 0
Xt truong hop tng qut cho cng NOR c n ng vo.
y
NOR
=

= =
=
) n 1, (i 0 x 1
1 x 0
i
i
Jy dc dim cua cng NOR l: Tn hiu ng ra ch
bng 1 khi tt ca cc ng vo du bng 0, tn hiu ng
ra s bng 0 khi c t nht mt ng vo bng 1.
Su dng cng NOR d dng mo tn hiu:
Xt cng NOR c 2 ng vo, chon x
1
l ng vo diu khin, x
2
l ng vo du liu. Ta c:
- x
1
= 1: y = 0 (y lun bng 0 bt chp x
2
), ta ni cng NOR kha khng cho du liu di qua.
- x
1
= 0:
2
x y
0 y 1
2
x
1 y 0
2
x
=
= =
= =

ta ni cng NOR mo cho du liu tu ng vo x


2
qua
cng NOR dn ng ra dng thoi dao muc tn hiu ng vo x
2
, lc ny cng NOR dng vai tr
l cng DAO.
Su dng cng NOR d thc hin chc nng cng logic khc:
- Dng cng NOR lm cng NOT:
x
1
x
2
y
K hiu theo Chu u K hiu theo M, Nht
x
1
x
2
y
Hnh 3.14. K hiu cong NOR
x
1
x
n
y
Hnh 3.15. Cong NOR n ng vo
x
1
y
x
2
x
y = x x x x x = = +
2 1 2 1
.
y x
Hnh 3.16a. Su dung cong NOR tao cong NOT
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 34
- Dng cng NOR lm cng OR :
- Dng cng NOR lm cng BUFFER :
- Dng cng NOR lm cng AND :
- Dng cng NOR lm cng NAND:
y =
2 1 2 1
x x x x + = +
y
x
1
x
2
2 1
x x +
Hnh 3.16b. Su dung cong NOR tao cong OR
x
1
x
2
y
y x
x
1
x
2
x
y = x x =
x y
Hnh 3.16c. Su dung cong NOR tao cong BUFFER
y =
2 1 2 1 2 1
. . x x x x x x = = +
x
1
x
2
y
1
x
2
x
x
1
x
2
y
Hnh 3.16d. Su dung cong NOR lm cong AND
Hnh 3.16e. Su dung cong NOR lm cong NAND
y =
2 1 2 1 2 1
. 1 x x x x x x y = + = + =
x
1
x
2
y
1
1
x
2
x
x
1
x
2
y y
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 35
g. Cong XOR (EX - OR)
Dy l cng logic thuc hin chuc nng cua mach cng modulo 2 (cng khng nho), l cng c
hai ng vo v mt ng ra c k hiu v bang trang thi nhu hnh v.
Phuong trnh logic m ta hoat dng cua cng XOR :
y
XOR
= x
1
2
x +
1
x .x
2
= x
1
x
2
Cng XOR duoc dng d so snh hai tn hiu vo:
- Nu hai tn hiu vo l bng nhau th tn hiu ng ra bng 0
- Nu hai tn hiu vo l khc nhau th tn hiu ng ra bng 1.
Cc tnh cht cua php ton XOR:
1. x
1
x
2
= x
2
x
1
2. x
1
x
2
x
3
= (x
1
x
2
) x
3
= x
1
(x
2
x
3
)
3. x
1
.(x
2
x
3
) = (x
1
.x
2
) (x
3
.x
1
)
Chung minh:
V tri = x
1.
(x
2
x
3
) = x
1
(x
2
. x
3
+ x
2
.x
3
) = x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
1
.x
3
+ x
1
x
1
.x
2
= x
1
x
2
x
3
+ x
1
x
2
x
3
+ x
1
x
1
.x
3
+ x
1
x
1
.x
2
= x
1
x
2
( x
3
+x
1
) + x
1
x
3
( x
2
+ x
1
)
= x
1
x
2
3 1
x x +
2 1
x x x
1
x
3
= (x
1
x
2
)(x
1
x
3
) = V phai (dpcm).
4. x
1
(x
2
. x
3
) = (x
1
x
3
).(x
1
x
2
)
5. x 0 = x
x 1 = x
x x = 0
x x = 1
h. Cong XNOR (EX NOR)
Dy l cng logic thuc hin chuc nng cua mach cng dao modulo 2 (cng khng nho), l cng
c hai ng vo v mt ng ra c k hiu v bang trang thi nhu trn hnh 3.19.
Phuong trnh logic m ta hoat dng cua cng: y =
2 1 2 1 2 1
x x x x x x = +
x
1
x
2
y
0 0 0
0
1 1
1 0 1
1 1 0
y
x
1
x
2
Hnh 3.17. Cong XOR
Mo rng tnh cht 5: Nu x
1
x
2
= x
3
th x
1
x
3
=x
2
x
1
x
2
y
0 0 1
0 1 0
1 0 0
1 1 1
y
x
1
x
2
Hnh 3.19. Cong XNOR
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 36
Tnh cht cua cng XNOR:
1. ) x (x ) x (x ) x )(x x (x
4 3 2 1 4 3 2 1
+ =
2. ) x (x ) x (x ) x (x ) x (x
4 3 2 1 4 3 2 1
= +
3.
2 1 2 1 2 1
x x x x x x = =
4.
2 1 2 1
x x x x =
5.
2 3 1 3 2 1
x x x x x x = =
Cu hoi: Hy thu chng minh cc tnh cht t 1 dn 5 ?
2. Phn loi cng logic theo phuong php ch to
a. Cong logic dng Diode
Xt so d mach don gian trn hnh 3.20
So d hnh a:
- Vx
1
= Vx
2
= 0V D
1
, D
2
tt: V
y
=V
R
= 0V y = 0
- Vx
1
= 0V, Vx
2
= 5V D
1
tt, D
2
dn: V
y
=V
R
= 5V y = 1
- Vx
1
= 5V, Vx
2
= 0V D
1
dn, D
2
tt: V
y
=V
R
= 5V y = 1
- Vx
1
= Vx
2
=5V D
1
, D
2
dn: V
y
=V
R
= 5V y = 1
Dy chnh l cng OR duoc ch tao trn co so diode v din tro hay cn goi l ho DRL (Diode
Resistor Logic) hoc DL (Diode logic).
So d hnh b:
- Vx
1
= Vx
2
= 0V D
1
, D
2
dn: V
y
=V
R
= 0V y = 0
- Vx
1
= 0V, Vx
2
=5V D
1
dn, D
2
tt: V
y
=V
R
= 0V y = 0
- Vx
1
= 5V, Vx
2
=0V D
1
tt, D
2
dn: V
y
=V
R
= 0V y = 0
- Vx
1
= Vx
2
=5V D
1
, D
2
tt: V
y
=V
R
= 5V y = 1
Dy chnh l mach thuc hin chuc nng cua cng AND duoc ch tao trn co so diode v din tro
(ho DRL hoc DL).
Hnh 3.20. So do mach cong logic dng diode
a.Cong OR - b.Cong AND
a) b)
y
x2
D2
D1 x1
.
R
y
x2
R
x1
VCC
D1
D2
x
1
x
2
y
0 0 0
0 1 1
1 0 1
1 1 1
x
1
x
2
y
0 0 0
0 1 0
1 0 0
1 1 1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 37
x
Rc
y
Rb
R1
VCC
VCC
Q1
R2
x1
Q1
y
Rc
x2
a)
b)
Hnh 3.21.(a,b)
b. Cong logic dng BJT
H RTL (Resistor Transistor Logic)
Cng NOT (hnh 3.21a)
- x = 0 BJT tt V
y
= V
cc
= 5V y = 1
- x = 1 BJT dn bo ha V
y
= V
ces
0V y = 0
Dy l cng NOT ho RTL (Resistor Transistor Logic).
Cng NOR (hnh 3.21b)
- x
1
= x
2
= 0 BJT tt
V
y
= V
cc
= 5V y = 1
- x
1
= 0, x
2
=1 BJT dn bo ho
V
y
=V
ces
0V y = 0
- x
1
=1, x
2
= 0 BJT dn bo ho
Vy = V
ces
0V y = 0
- x
1
= x
2
=1 BJT dn bo ho
V
y
= V
ces
0V y = 0
Dy chnh l cng NOR ho RTL (Resistor Transistor Logic).
Tuy nhin mach ny c nhuoc dim l su anh huong giua cc ng vo x
1
v x
2
rt lon dc bit l
khi hai ng vo c muc din p (muc logic) nguoc nhau. D khc phuc nhuoc dim ny nguoi ta
cai tin mach bng cch su dung 2 BJT o 2 ng vo dc lp voi nhau nhu so d trn hnh 3.21c.
Hy giai thch hot dng cua mch ny?
H DTL (Diode-Transistor-Logic)
Trn hnh 3.22 l so d mach cng NAND ho DTL.
x2
R1
Q1
R2
VCC
Q2
y
Rc
x1
Hnh 3.21c. Cong NOR dng 2 BJT
x2
R2
R1
VCC
Q
y
x1
R3
D2 D4
A
D3
D1
Hnh 3.22. Cong NAND ho DTL
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 38
- Khi x
1
= x
2
= 0: cc diode D
1
, D
2
duoc phn cuc thun nn D
1
, D
2
dn V
A
= V = 0,7V
(diode ghim din p). M diu kin d cc diode D
3
, D
4
v BJT Q dn l:
V
A
2V
/D
+ V
/BJT
= 2.0,7 + 0,6 = 2 (V)
Khi D
1
, D
2
dn D
3
, D
4
tt BJT tt ng ra y = 1.
- Khi x
1
= 0, x
2
= 1: D
1
dn, D
2
tt V
A
= 0,7V (diode D
1
ghim din p) D
3
, D
4
, BJT tt
ng ra y = 1.
- Khi x
1
= 1, x
2
= 0: D
1
tt, D
2
dn V
A
= 0,7V (diode D
2
ghim din p) D
3
, D
4
, BJT tt
ng ra y = 1.
- Khi x
1
= x
2
= 1: ca hai diode D
1
, D
2
du tt V
A
V
cc
, (thuc t V
A
= V
cc
- V
R1
) diu kin
d diode D
3
, D
4
dn thoa mn nn D
3
, D
4
dn BJT dn bo ha ng ra y = 0.
Vy dy chnh l so d mach thuc hin cng NAND ho DTL.
Nhim vu cua cc linh kin:
Nu chi c mt diode D
3
, gia su x
1
= x
2
= 0, ng ra y=1, lc ny D
1
v D
2
dn, ta c V
A
= V/D
3
= 0,7(V). Nu c mt tn hiu nhiu bn ngoi chi khoang 0,6V tc dng vo mach s lm din p
tai A tng ln thnh 1,3(V), v s lm cho diode D
3
v Q dn. Nhung nu mc ni tip thm D
4
mach c th ngn tn hiu nhiu ln dn 2V= 1,2(V). Vy, D
3
v D
4
c tc dung nng cao kha nng
chng nhiu cua mach.
Ngoi ra, R
2
lm tng tc d chuyn di trang thi cua Q, v lc du khi Q dn s c dng d qua
R
2
tao mt phn p cho tip gip J
E
cua Q d phn cuc thun lm cho Q nhanh chng dn, v khi Q
tt th luong din tch s x qua R
2
nn BJT nhanh chng tt.
H TTL (Transistor - Transistor -Logic)
Transistor Q
1
duoc su dung gm 2 tip gip BE
1
, BE
2
v mt tip gip BC. Tip gip BE
1
, BE
2
cua Q
1
thay th cho D
1
, D
2
v tip gip BC thay th cho D
3
trong so d mach cng NAND ho DTR
(hnh 3.22).
Giai thch hoat dong cua mach (hnh 3.23):
- x
1
= x
2
= 0 cc tip gip BE
1
, BE
2
s duoc mo lm cho din p cuc nn cua Q
1
: V
B
= V =
0,6V. M diu kin d cho tip gip BC, diode D v Q
2
dn th din th o cuc nn cua Q
1
phai bng:
V
B
= V
/BC
+ V
/BE1
+V
/BE2
= 0,6 + 0,7 + 0,6 = 1,9V
Chung to khi cc tip gip BE
1
, BE
2
mo th tip gip BC, diode D v BJT Q
2
tt y = 1.
- x
1
= 0, x
2
= 1 cc tip gip BE
1
mo, BE
2
tt th tip gip BC, diode D v BJT Q
2
tt y = 1.
- x
1
= 1, x
2
= 0 cc tip gip BE
1
tt, BE
2
mo th tip gip BC, diode D v BJT Q
2
tt y = 1.
c
x2
.
x2
VCC
R3
x1
Q2
x1
x2
x1
R2
D Q1
Q1
R1
Hnh 3.23. Cong NAND ho TTL
a. So do mach, b.Transistor 2 tip gip v so do tuong duong
a) b)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 39
- x
1
= x
2
= 1 cc tip gip BE
1
, BE
2
tt th tip gip BC, diode D dn v BJT Q
2
dn bo ha
y = 0
Vy, dy chnh l mach thuc hin cng NAND theo cng ngh TTL.
D nng cao kha nng tai cua cng, nguoi ta thuong mc thm o ng ra mt tng khuch dai kiu
C chung (CC) nhu so d mach trn hnh 3.24:
D nng cao tn s lm vic cua cng, nguoi ta cho cc BJT lm vic o ch d khuch dai, diu
d c nghia l nguoi ta khng ch d sao cho cc tip xc J
C
cua BJT bao gio cung o trang thi
phn cuc nguoc. Bng cch mc song song voi tip gip J
C
cua BJT mt diode Schottky. Dc dim
cua diode Schottky l tip xc cua n gm mt cht bn dn voi mt kim loai, nn n khng tch
luy din tch trong trang thi phn cuc thun nghia l thoi gian chuyn tu phn cuc thun sang phn
cuc nguoc nhanh hon, ni cch khc BJT s chuyn di trang thi nhanh hon.
Luu : Nguoi ta cng khng dng diode Zener boi v tip xc cua diode Zener l chat bn dan
nn se tch tr din tch du.
So d mach cai tin c diode Schottky trn s v tuong duong nhu sau (hnh 3.25):
D
R
4
R
2
x
1
x
2
Q
1
R
1
Q
2
R
3
R
5
y
Q
3
Q
4
V
cc
Hnh 3.24
D
R
4
R
2
x
1
x
2
Q
1
R
1
Q
2
R
3
R
5
y
Q
3
Q
4
V
cc
Hnh 3.25. Cong logic ho TTL dng diode Shottky
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 40
H ECL (Emitter-Coupled-Logic)
Logic ghp emitter chung (ECL) l ho logic c tc d hoat dng rt cao v thuong duoc dng
trong cc ung dung di hoi tc d cao. Tc d cao dat duoc l nho vo cc transistor duoc thit k
d hoat dng trong ch d khuych dai, v vy chng khng bao gio roi vo trang thi bo ho v do
d thoi gian tch lu hon ton bi loai bo. Ho ECL dat duoc thoi gian tr lan truyn nho hon 1ns
trn mi cng.
Nhuoc dim cua ho ECL: Ng ra c din th m nn n khng tuong thch v muc logic voi cc
ho logic khc.
Giai thch hoat dong cua mach (hnh 3.26):
- Khi x
1
= x
2
= 0: Q
1
, Q
2
dn nn din th tai cuc nn (2), (3) cua Q
3
, Q
4
cng m (do 1 v 1
m) nn Q
3
, Q
4
tt y
1
= 1, y
2
= 1.
- Khi x
1
= 0, x
2
=1: Q
1
dn, Q
2
tt nn din th tai cuc nn (2) cua Q
3
duong, din th tai cuc nn
(3) cua Q
4
cng m nn Q
3
dn, Q
4
tt y
1
= 0, y
2
= 1.
- Khi x
1
=1, x
2
=0: Q
1
tt, Q
2
dn nn din th tai cuc nn (2) cua Q
3
m, din th tai cuc nn (3)
cua Q
4
cng duong nn Q3 dn, Q
4
tt y
1
= 1, y
2
= 0.
- Khi x
1
= x
2
=1: Q
1
, Q
2
tt nn din th tai cuc nn (2), (3) cua Q
3
, Q
4
cng duong nn Q
3
, Q
4
dn y
1
= 0, y
2
= 0.
R4
x1
y2
Q2
Q4
R7
2
Q1
1
R1
Q3
y1
R6
1'
x2
R3
-VEE
3
VCC = 0V
R5 R2
RE
Hnh 3.26. Cong logic ho ECL (Emitter Coupled Logic)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 41
Hnh 3.27. K hiu cc loai MOSFET khc nhau
B
D
G
S
PMOS
B
D
G
S
NMOS
a. MOSFET knh dt sn
B
D
G
S
PMOS
B
D
G
S
NMOS
b. MOSFET knh cam ung
c. Cong logic dng MOSFET
MOSFET (Metal Oxyt Semiconductor Field Effect Transistor), cn goi l IGFET (Isolated Gate
FET - Transistor truong c cuc cng cch ly).
MOSFET c hai loai: Loai c knh dt sn v loai c knh cam ung.
D l MOSFET c knh dt sn hay knh cam ung du c th phn chia lm hai loai:
- MOSFET knh N goi l NMOS
- MOSFET knh P goi l PMOS.
Dc dim cua 2 loai ny khc nhau nhu sau:
- PMOS: Tiu thu cng sut thp, tc d chuyn di trang thi chm.
- NMOS: Tiu thu cng sut lon hon, tc d chuyn di trang thi nhanh hon.
Trn hnh 3.27 l k hiu cua cc loai MOSFET khc nhau.
Ch : MOSFET knh dt sn c th lm vic o hai ch d giu knh v ngho knh trong khi
MOSFET knh cam ung chi lm vic o ch d giu knh.
Dng NMOS knh cam ng ch to cc cng logic
Xt cc cng logic loai NMOS trn hnh 3.28.
Diu kin d cng NMOS dn: V
D
> V
S
, V
G
> V
B
Trong tt ca hnh v ta c :

=
=
K R
K R
Q Q
OF DS
ON DS
7
) (
) (
3 2
10
1
,

=
=
) (
) (
1
200
OF DS
ON DS
R
K R
Q
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 42
Hnh 3.28a (cong NOT)
Theo diu kin d cng NMOS dn: V
D
> V
S
, V
G
> V
B
Ta thy Q
1
c B ni mass thoa mn diu kin nn: Q
1
lun lun dn.
- Khi x = 0: Q
1
dn, Q
2
tt (v V
G2
= V
B2
= 0 nn khng hnh thnh din truong giua G v B
khng ht duoc cc e- l hat dn thiu s o vng d B khng hnh thnh duoc knh dn).
Lc ny, theo so d tuong duong (hnh 3.29a) ta c:
DD
DS(OFF)/Q2 DS(ON)/Q1
DS(OFF)/Q2
y
V
R R
R
V
+
=
DD 7
7
V
K 10 200K
K 10
+
=
V
y
V
DD
y = 1
- Khi x = 1: lc ny V
G/Q2
> V
B/Q2
hnh thnh mt din truong huong tu G dn B, din
truong ny ht cc din tu l cc hat dn thiu s trong vng d B di chuyn theo chiu nguoc
lai v mt di din, hnh thnh knh dn ni lin giua G v B v c dng din i
D
di tu D qua
Q
2
dn. Nhu vy Q
1
, Q
2
du dn, ta s c so d tuong duong (hnh 3.29b). Theo so d ny
ta c:
DD
DS(ON)/Q2 DS(ON)/Q1
DS(ON)/Q2
y
V
R R
R
V
+
=
DD
V
1K 200K
1K
+
=
V
y
-
200
1
V
DD
= 0,025V y = 0
VDD
Q1
Q2
x
y
Q1
Q2
Q3
VDD
x1
x2
y
Q1
Q2
Q3
VDD
x1
x2
y
a) Cong NOT b) Cong NOR c) Cong NAND
Hnh 3.28 Cc cong logic ch tao bng NMOS
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 43
Vy mach o hnh 3.28a l mach thuc hin cng NOT.
Hnh 3.28c (cong NAND)
- Khi x
1
= x
2
= 0 (hnh 3.30a): Q
1
lun dn, Q
2
v Q
3
du tt, lc d theo so d tuong duong ta
c:
DD
DS(OFF)/Q3 DS(OFF)/Q2 DS(ON)/Q1
DS(OFF)/Q3 DS(OFF)/Q2
y
V
R R R
R R
V
+ +
+
=
DD 7 7
7 7
V
K 10 K 10 200K
K 10 K 10
+ +
+
= V
y
- V
DD
y = 1.
- Khi x
1
= 1, x
2
=0 (hnh 3.30b): Q
1
, Q
2
dn v Q
3
tt lc d theo so d tuong duong ta c:
DD
Q OFF DS Q ON DS Q ON DS
Q OFF DS Q ON DS
y
V
R R R
R R
V
3 / ) ( 2 / ) ( 1 / ) (
3 / ) ( 2 / ) (
+ +
+
=
DD
V
K K K
K K
7
7
10 1 200
10 1
+ +
+
=
V
y
- V
DD
y = 1
- Khi x
1
= 0, x
2
=1: Q
1
, Q
3
dn v Q
2
tt, giai thch tuong tu ta c Vy - VDD y = 1.
- Khi x
1
=1, x
2
=1 (hnh 3.30c): Q
1
, Q
2
v Q
3
du dn, lc d theo so d tuong duong ta c:
DD
DS(ON)/Q3 DS(ON)/Q2 DS(ON)/Q1
DS(ON)/Q3 DS(ON)/Q2
y
V
R R R
R R
V
+ +
+
=
DD
V
1K 1K 200K
1K K 1
+ +
+
=
V
y
- 0,05V y = 0.
Vy hnh 3.28c l mach thuc hin cng NAND.
V
DD
y
R
DS(ON)/Q1
R
DS(OFF)/Q2
R
DS(OFF)/Q3
Hnh 3.30a.
(x
1
=x
2
=0)
V
DD
y
R
DS(ON)/Q1
R
DS(ON)/Q2
R
DS(OFF)/Q3
Hnh 3.30b
(x
1
=1, x
2
=0)
V
DD
y
R
DS(ON)/Q1
R
DS(ON)/Q2
R
DS(ON)/Q3
Hnh 3.30c
(x
1
=x
2
=1)
V
DD
y
R
DS(ON)/Q1
R
DS(OFF)/Q2
a) x=0
V
DD
y
R
DS(ON)/Q1
R
DS(ON)/Q2
b) x=1
Hnh 3.29 So do tuong duong mach hnh 3.28a
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 44
Hnh 3.28b (cong NOR)
Ta ln luot xt cc truong hop sau: (so d tuong duong hnh 3.31)
- Khi x
1
= x
2
= 0 (hnh 3.31a) : Q
1
dn, Q
2
v Q
3
du tt, lc d theo so d tuong duong ta c:
DD
DS(OFF)/Q3 DS(OFF)/Q2 DS(ON)/Q1
DS(OFF)/Q3 DS(OFF)/Q2
y
V
)] )//(R [(R R
) )//(R (R
V
+
=
DD 7 7
7 7
V
K) K//10 (10 200K
K K//10 10
+
=
V
y
- V
DD
y = 1
- Khi x
1
=0, x
2
=1 (hnh 3.31b): Q
1
v Q
3
dn, Q
2
tt, ta c:
DD
DS(ON)/Q3 DS(OFF)/Q2 DS(ON)/Q1
DS(ON)/Q3 DS(OFF)/Q2
y
V
)] )//(R [(R R
) )//(R (R
V
+
=
DD 7
7
V
K//1K) (10 200K
K//1K 10
+
=
V
y
-
201
1
V
DD
- 0,005V y = 0
- Khi x
1
=1, x
2
=0: Q
1
v Q
2
dn, Q
3
tt, giai thch tuong tu ta c:
V
y
-
201
1
V
DD
- 0,005V y = 0
- Khi x
1
=x
2
=1 (hnh 3.31c): Q
1
, Q
2
, Q
3
du dn, ta c:
DD
DS(ON)/Q3 DS(ON)/Q2 DS(ON)/Q1
DS(ON)/Q3 DS(ON)/Q2
y
V
)] )//(R [(R R
) )//(R (R
V
+
=
DD
V
(1K//1K) 200K
1K//1K
+
=
V
y
-
200
0,5
V
DD
y = 0.
Vy, so d mach trn hnh 3.28b chnh l mach thuc hin
cng NOR.
V
DD
y
R
DS(ON)/Q1
R
DS(OFF)/Q3
R
DS(OFF)/Q2
Hnh 3.31a
(x
1
=x
2
=0)
V
DD
y
R
DS(ON)/Q1
R
DS(ON)/Q3
R
DS(OFF)/Q2
Hnh 3.31a
(x
1
=0, x
2
=1)
V
DD
y
R
DS(ON)/Q1
R
DS(ON)/Q2
R
DS(ON)/Q3
Hnh 3.31c
(x
1
=x
2
=1)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 45
Cc cng logic h CMOS (Complementation MOS)
Dy l loai cng trong d cc transistor duoc su dung thuc loai MOSFET v lun c su kt hop
giua PMOS v NMOS, v vy m nguoi ta goi l CMOS. Nho cu trc ny m vi mach CMOS c
nhung uu dim sau:
- Cng sut tiu thu o trang thi tinh rt nho.
- Tc d chuyn di trang thi cao.
- Kha nng chng nhiu tt.
- Kha nng tai cao.
Trn hnh 3.32 l cc cng logic ho CMOS, chng ta s ln luot giai thch hoat dng cua mi so
d mach.
Hnh 3.32a (cong NOT)
Diu kin d cng PMOS dn : V
S
> V
D
, V
G
< V
B
Diu kin d cng NMOS dn : V
D
> V
S
, V
G
> V
B
- Khi x = 0 (hnh 3.33a): Q
1
dn, Q
2
tt, tu so d tuong duong ta c:
DD
DS(OFF)/Q2 DS(ON)/Q1
DS(OFF)/Q2
y
V
R R
R
V
+
=
DD 7
7
V
K 10 1K
K 10
+
=
V
y
- V
DD
y = 1
- Khi x =1 (hnh 3.33b): Q
1
tt, Q
2
dn, ta c:
DD
Q ON DS Q OFF DS
Q ON DS
y
V
R R
R
V
2 / ) ( 1 / ) (
2 / ) (
+
=
DD
V
K K
K
7
10 1
1
+
= V
y
-
7
10
1
V
DD
v rt nho so voi din th bo ha cua CMOS o muc logic 0 y = 0.
Vy mach o hnh 3.32a l mach thuc hin cng NOT theo cng ngh CMOS. So d tuong duong
tuong ung voi 2 truong hop x=0 v x=1 duoc cho trn hnh 3.33.
Q1
Q2
x
y
VDD
y
x2
x1
Q2
Q1
VDD
Q3 Q4
a) Cng NOT
b) Cng NAND
Hnh 3.32 Cc cong logic ho CMOS
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 46
V
DD
y
R
DS/ Q1
R
DS/Q4
R
DS/Q3
R
DS/ Q2
Hnh 3.34.
Hnh 3.32b (cong NAND)
So d tuong duong cua mach cng NAND ho CMOS duoc cho trn hnh 3.34.
- Khi x
1
=x
2
= 0: Q
4
v Q
3
dn, Q
2
v Q
1
tt, ta c:
DD
DS(ON)/Q3 DS(ON)/Q4 DS(OFF)/Q2 DS(OFF)/Q1
DS(OFF)/Q1 DS(OFF)/Q2
y
V
)] )//(R [(R R R
) )//(R (R
V
+ +
=
DD 7 7
7 7
V
(1K//1K) K K//10 10
K K//10 10
+
=
V
y
- V
DD
y = 1
- Khi x
1
= 0, x
2
= 1: Q
2
v Q
3
dn, Q
1
v Q
4
tt, ta c :
DD
DS(OF)/Q4 DS(ON)/Q3 DS(OFF)/Q2 DS(OFF)/Q1
DS(ON)/Q2 DS(OFF)/Q1
y
V
)] )//(R [(R R R
) )//(R (R
V
+ +
=
DD 7 7
7
V
K//1K) (10 1K K 10
1K K 10
+ +
+
=
V
y
V
DD
y = 1
- Khi x
1
= 1, x
2
= 0: Q
3
v Q
2
dn, Q
1
v Q
4
tt: V
y
V
DD
y = 1
- Khi x
1
= x
2
= 1: Q
2
v Q
1
dn, Q
3
v Q
4
tt, ta c:
DD
DS(OFF)/Q3 DS(OFF)/Q4 DS(ON)/Q2 DS(ON)/Q1
DS(ON)/Q2 DS(ON)/Q1
y
V
)] )//(R [(R R R
) )//(R (R
V
+ +
=
DD 7 7
V
K) K//10 (10 1K 1K
1K 1K
+ +
+
=
V
y
0V y = 0 Dy chnh l mach thuc hin cng NAND.
V
DD
y
R
DS(ON)/Q1
R
DS(OFF)/Q2
V
DD
y
R
DS(OFF)/Q1
R
DS(ON)/Q2
Hnh 3.33.So do tuong duong: a.Khi x=0 b.Khi x=1
a) b)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 47
3. Phn loi cng logic theo ng ra
a. Ng ra cot cham (Totem Pole Output)
Xt cng logic ho TTL voi so d mach nhu hnh 3.35.
- Khi x
1
=x
2
=1: Tip gip BE
1
, BE
2
cua Q
1
phn cuc nguoc nn Q
1
tt. Din th tai cuc nn cua
Q
1
lm cho tip gip BC/Q
1
mo, c dng din chay qua tip gip BC/Q
1
d vo cuc nn cua Q
2
, Q
2
duoc phn cuc thun nn dn bo ha. Do Q
2
dn bo ha dn toi Q
3
dn bo ha.
Khi Q2 dn bo ha th din th tai cuc C/Q2
V
C/Q2
= V
B/Q4
= V
ces/Q2
+ V
bes/Q3
= 0,2 + 0,8 = 1V
M diu kin cn cho Q4 dn l:
V
C/Q2
=V
B/Q4
= V
be/Q4
+ V
/D
+ V
ces/Q3
= 0,6 + 0,8 + 0,2= 1,6V
Ta thy diu kin ny khng thoa mn khi Q2 dn bo ha, do d khi Q2 dn bo ha Q4 tt
ct ngun V
CC
ra khoi mach. Lc ny ta ni rng cng s ht dng vo v dng tu ngoi qua tai
d vo ng ra cua cng di qua Q
3
, nguoi ta ni Q
3
l noi nhn dng v dng d vo Q
3
goi l dng
ng ra muc thp, k hiu I
OL
.
V mt thit k mach: ta thy rng dng tai It cung chnh l dng ng ra muc thp I
OL
v l dng
d tu ngoi vo qua Q
3
, dng ny phai nm trong gioi han chiu dung dng cua Q
3
d Q
3
khng bi
dnh thung th mach s lm vic bnh thuong.
Dng I
OL
thay di ty thuc vo cng ngh ch tao:
+ TTL : dng ng ra muc thp I
OL
lon nht 16mA.
+ TTL/LS : dng ng ra muc thp I
OL
lon nht 8mA.
Dy l nhung thng s rt quan trong cn ch trong qu trnh thit k mach s ho TTL d dam
bao d an ton v n dinh cua mach.
- Cc truong hop cn lai (x
1
=0,x
2
=1; x
1
=1,x
2
=0; x
1
=x
2
=0): Lc ny Q
2
v Q
3
tt cn Q
4
dn
y = 1. Ta ni cng cp dng ra, dng ny d tu ngun qua Q
4
v diode D xung cung cp cho tai,
nguoi ta goi l dng ng ra muc cao, k hiu I
OH
.
Din p ng ra V
Y
duoc tnh phu thuc vo dng tai I
OH
:
V
Y
= V
logic1
= V
cc
- I
OH
R
5
- V
ces/ Q4
- V
/D
Thng thuong khi c tai V
logic1 max
= (3,4V 3,6V )
I
OH
cung chnh l dng qua tai It, nu I
OH
cng tng th V
logic1
cng giam v nguoc lai. Song
V
logic1
chi duoc php giam dn mt gi tri cho php V
logic1 min
= 2,2V.
y
x2
R2
Q4
x1
Q1
R5
D
R4
Q2
Q3
.
R3
VCC
R1
Hnh 3.35. Ng ra cot cham
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 48
V mt thit k mach: ta chon V
logic1 min
= 2,4V d bao dam cng cp dng ra khi o muc logic 1
khng duoc nho hon V
logic1 min
v dam bao cng ht dng vo khi o muc logic 0 th dng tai o muc
logic 0 khng duoc lon hon dng I
OL
.
Nhuoc dim cua ng ra ct cham: Khng cho php ni chung cc ng ra li vi nhau c th
lm hong cng.
b. Ng ra cuc thu d ho (Open Collector Output)
V phuong din cu tao gn ging voi ng ra ct cham nhung khc voi ng ra ct cham l khng
c Q
4
, diode D, R
5
v lc ny cuc thu (cuc C) cua Q
3
d ho.
Do d d cng lm vic trong thuc t ta ni ng ra cua cng (cuc C cua Q
3
) ln ngun V
CC
bng phn tu thu dng R. Ngun V
CC
c th cng gi tri voi V
CC
hoc khc ty thuc vo muc dch
thit k.
Chng ta ln luot phn tch cc truong hop hoat dng cua mach:
- Khi x
1
=x
2
=1: Tip gip BE
1
, BE
2
phn cuc
nguoc, din th tai cuc nn cua Q
1
lm cho tip
gip BC/Q
1
mo nn Q
2
dn bo ha, Q
2
dn bo
ha ko theo Q
3
dn bo ha y = 0, do d
din p tai ng ra y:
V
Y
= V
logic0
=V
C/Q3
= V
ces/Q3
= 0,2V 0V
Lc ny cng s ht dng vo v Q
3
l noi nhn
dng, ta goi l dng ng ra mc thp I
OL
.
- Cc truong hop cn lai (x
1
=0,x
2
=1; x
1
=1,x
2
=0;
x
1
=x
2
=0): C t nht mt tip gip BE/Q
1
mo,
ghim din th tai cuc nn Q
1
lm cho tip gip BC/Q
1
, Q
2
, Q
3
du tt, lc ny cng cp
dng ra d tu ngun V
CC
qua din tro R cp cho tai o mach ngoi y=1, nguoi ta goi l
dng ng ra mc cao I
OH
.
Ta c:
V
Y
= V
logic1
= V

CC
- I
OH
.R
Uu dim cua ng ra c cc thu d ho:
- Cho php ni chung cc ng ra lai voi nhau.
- Trong mt vi truong hop khi ni chung cc ng ra lai voi
nhau c th tao thnh cng logic khc.
V du: Mach o hnh 3.37 su dung cc cng NOT c ng ra cuc
thu d ho, khi ni chung cc ng ra lai voi nhau c th tao thnh
cng NOR. (Hy giai thch hoat dong cua mach ny?)
c. Ng ra ba trang thi (Three States Output)
V mt cu trc v cu tao hon ton ging ng ra ct cham, tuy nhin c thm ng vo thu 3
cho php mach hoat dng k hiu l E (Enable).
- E=1: diode D
1
tt, mach lm vic hon ton ging cng NAND ng ra ct cham. Lc d
mach tn tai mt trang thi y = 0 hoc y = 1 ty thuc vo cc trang thi logic cua 2 ng vo x
1
, x
2
.
Q1
x1
R3
y
x2
.
R4
Q3
R1
VCC
VCC'
Q2
R
R2
Hnh 3.36. Ng ra cuc thu d ho
y
R
V
cc
x
1
x
2
Hnh 3.37
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 49
- E=0: diode tip gip BE
3
mo, ghim p trn cuc nn cua Q
1
lm cho tip gip BC/Q
1
tt v Q
2
,
Q
3
cung tt. Lc ny diode D
1
dn ghim din th o cuc C cua Q
2
:
V
C / Q2
= V
B/ Q4
= V/
D1
= 0,7V Q
4
tt.
Nn cng khng cp dng ra v cung khng ht
dng vo. Lc ny, ng ra y chi ni voi cng v
phuong din vt l nhung lai cch ly v phuong din
din, tuong duong voi trang thi tro khng cao. Chnh
v vy m nguoi ta goi l trang thi thu ba l trang thi
tng tro cao.
Trong truong hop ny ng vo cho php E tch cuc
muc cao (muc logic 1). Thuc t cc cng logic voi ng
ra 3 trang thi c th c ng vo diu khin E tch cuc
muc cao (muc 1) hoc tch cuc muc thp (muc 0).
Chng han mt cng NAND voi ng ra 3 trang thi c
th duoc k hiu nhu trn hnh v 3.39.
Ung dung cua ng ra 3 trang thi:
- Su dung ng ra ba trang thi d ch tao ra cng dm 2 chiu.
- Ch tao cc chp nho cua b vi xu l.
Mt ung dung cua ng ra ba trang thi trong mach xut/nhp du liu 2 chiu c th cho trn so
d 3.40. Hy thu giai thch so do ny ?
x1 D2
R5
Q1
Q2
Q4
Q3
R2
.
y
R3
x2
VCC
R4
R1
E
D1
Hnh 3.38. Ng ra 3 trang thi
x
1
y
x
2
E

= =
= =
cao
Z y E
x x y E
0
1
2 1

= =
= =
2 1
0
1
x x y E
Z y E
cao
x
1
y
x
2
E
Hnh 3.39. Cong NAND 3 trang thi voi ng vo E
a. E tch cuc muc cao - b. E tch cuc muc thap
a) b)
1
3
4
2
A
B
C
D
Hnh 3.40. Ung dung cua ng ra 3 trang thi
E
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 50
- E=1: Cng dm 1 v 3 mo, 2 v 4 treo ln tng tro cao: du liu di tu AC, BD. Vy du
liu duoc xut ra.
- E=0: Cng dm 2 v 4 mo, 1 v 3 treo ln tng tro cao: du liu di tu CA, DB. Vy du
liu duoc nhp vo.
3.2.3. Cc thng s k thut ca cng logic
1. Cng sut tiu tn P
tt
Mt phn tu logic khi lm vic phai trai qua cc giai doan sau:
- O trang thi tt.
- Chuyn tu trang thi tt sang trang thi dn.
- O trang thi dn.
- Chuyn tu trang thi dn sang tt.
O mi giai doan, phn tu logic du tiu thu o ngun mt cng sut.
Di voi cc phn tu logic ho TTL: cc phn tu TTL tiu thu cng sut cua ngun chu yu khi o
trang thi tinh (dang dn hoc dang tt).
- Nu goi P
0
l cng sut tiu thu ung voi ng ra cua phn tu logic tn tai o muc logic 0.
- Nu goi P
1
l cng sut tiu thu ung voi ng ra cua phn tu logic tn tai o muc logic 1.
- Goi P l cng sut tiu tn trung bnh th:
2
1 0
P P
P
+
=
Di voi ca vi mach (IC Integrated Circuit) nguoi ta tnh nhu sau:
- Goi I
CL
dng do ngun cung cp khi ng ra o muc logic 0.
- Goi I
CH
dng do ngun cung cp khi ng ra o muc logic 1.
- Goi I
C
l dng trung bnh th :
2
I I
I
CH CL
C
+
=
- Th cng sut tiu tn cho ca vi mach duoc tnh:
P
tt
= I
C
.V
CC
Di voi vi mach ho CMOS: chi tiu thu cng sut chu yu trong trang thi dng (trong thoi gian
chuyn mach). Cng sut tiu tn:
2
. .
DD L tt
V f C P =
Trong d: C
L
l din dung cua tai (din dung tai)
Nhu vy ta thy di voi vi mach CMOS tn s hoat dng (tn s chuyn mach) cng lon cng
sut tiu tn cng tng.
2. Fanout (H s mc mch ng ra)
Fanout l h s mc mach o ng ra hay cn goi l kha nng tai cua mt phn tu logic.
Goi N l Fanout cua mt phn tu logic, th
n duoc dinh nghia nhu sau: S ng vo logic
cuc dai duoc ni dn mt ng ra cua phn tu
logic cng ho m mach vn hoat dng bnh
thuong (hnh 3.41).
Hnh 3.41. Khi nim v Fanout
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 51
Xt v du di voi ho DTL: (Hnh 3.42)
- y=1: mach hoat dng bnh thuong.
- y=0: BJT dn bo ha, dng bo ha gm hai
thnh phn:
I
C S
= I
R3
+ N I
1
(voi N l s phn tu tai mc o ng ra)
Mt khc: I
B
=I
R1
-I
R2
= const, m I
cs
tng ln do c
dng ghp d vo diu kin dn bo ha khng thoa
mn BJT ra khoi ch d dn bo ha v di vo ch d
khuch dai, lc d V
Y
tng ln nn ng ra khng cn dam
bao o muc logic 0 nua. Vy, diu kin d mach hoat dng
bnh thuong l:
I
R3
+ N I
1
<
min
I
B

1
3 R B min
I
I I
N

< (*)
N: s lon nht thoa mn diu kin (*) duoc goi l Fanout cua phn tu logic DTL.
3. Fanin (H s mc mch ng vo)
Goi M l Fanin cua 1 phn tu logic th M duoc dinh nghia nhu sau: D chnh l s ng vo
logic cuc dai cua mt phn tu logic.
Di voi cc phn tu logic thuc hin chuc nng cng logic, th s luong M lon nht l 4 ng vo.
Di voi cc phn tu logic thuc hin chuc nng nhn logic, th s luong M lon nht l 6 ng vo.
Di voi ho logic CMOS th c M nhiu hon nhung cung khng qu 8 ng vo.
4. D chng nhiu
D n dinh nhiu l tiu chun dnh gi d nhay cua mach logic di voi tap m xung trn du
vo. D n dinh nhiu (tinh) l gi tri din p nhiu ti da trn du vo khng lm thay di trang
thi logic cua mach, cn goi l muc n dinh nhiu.
5. Tr truyn dt
Tr truyn dat l khoang thoi gian d du ra cua mach c dp ung di voi su thay di muc logic
cua du vo.
Tr truyn dat l tiu chun d dnh gi tc d lm vic cua mach. Tc d lm vic cua mach
tuong ung voi tn s m mach vn cn hoat dng dng. Nhu vy, tr truyn dat cng nho cng tt
hay tc d lm vic cng lon cng tt.
Di voi hu ht cc vi mach s hin nay, tr truyn dat l rt nho, c vi nano giy (ns). Mt vi
loai mach logic c thoi gian tr lon c vi trm nano giy.
Khi mc lin tip nhiu mach logic th tr truyn dat cua ton mach s bng tng cc tr truyn
dat cua mi tng.
R1
R3
x1
R2
Q
.
x2
D3
VCC
R3
.
D1
D2
D1 D4
Hnh 3.42
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 52
3.3. FLIP FLOP (FF)
3.3.1. Khi nim
Flip-Flop (vit tt l FF) l mach dao dng da hi hai trang thi bn, duoc xy dung trn co so
cc cng logic v hoat dng theo mt bang trang thi cho truoc.
3.3.2. Phn loi
C hai cch phn loai:
- Phn loai theo tn hiu diu khin.
- Phn loai theo chuc nng.
1. Phn loi FF theo tn hiu diu khin dng b
Gm c hai loai:
- Khng c tn hiu diu khin dng b (FF khng dng b).
- C tn hiu diu khin dng b (FF dng b).
a. FF khng dong bo
Dng 1: RSFF khng dng b dng cng NOR (so d hnh 3.43)
Dua vo bang chn tri cua cong NOR d giai thch hoat dong cua so do mach ny:
- S = 0, R = 1 Q = 0. Q=0 hi tip v cng NOR 2 nn cng NOR 2 c hai ng vo bng 0
Q = 1. Vy, Q = 0 v Q = 1.
- S = 1, R = 0 Q= 0. Q= 0 hi tip v cng NOR 1 nn cng NOR 1 c hai ng vo bng 0
Q = 1. Vy, Q = 1 v Q = 0.
- Gia su ban du: S = 0, R = 1 Q = 0 v Q = 1.
Nu tn hiu ng vo thay di thnh: S = 0, R = 0 (R chuyn tu 1 0) ta c:
+ S = 0 v Q = 0 Q = 1
+ R = 0 vQ = 1 Q = 0 RSFF giu nguyn trang thi cu truoc d.
- Gia su ban du: S = 1, R = 0 Q = 1 v Q = 0.
Nu tn hiu ng vo thay di thnh: R = 0, S = 0 (S chuyn tu 1 0) ta c:
+ R = 0 v Q = 0 Q = 1
+ S = 0 v Q = 1 Q = 0 RSFF giu nguyn trang thi cu truoc d.
Q
Q
R
S
1
2
S R Q
0 0 Q
0
0 1 0
1 0 1
1 1 X
Hnh 3.43. RSFF khng dong bo su dung cong NOR v bang trang thi
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 53
Dng 2: RSFF khng dng b dng cng NAND (so d hnh 3.44)
Dua vo bang chn tri cua cng NAND:

=
=
=
0 x 1
1 x 0
y
i
i
Ta c:
- S = 0, R = 1 Q = 1. Q = 1 hi tip v cng NAND 2 nn cng NAND 2 c hai ng vo
bng 1 vy Q = 0.
- S = 0, R = 1 Q = 1. Q = 1 hi tip v cng NAND 1 nn cng NAND 1 c hai ng vo
bng 1 vy Q = 0.
- S = R = 0 Q = Q = 1 dy l trang thi cm.
- S = R = 1: Gia su trang thi truoc d c Q = 1, Q = 0 hi tip v cng NAND 1 nn cng
NAND 1 c mt ng vo bng 0 vy Q = 1 RSFF giu nguyn trang thi cu.
Nhu vy goi l FF khng dng b boi v chi cn mt trong hai ng vo S hay R thay di th ng
ra cung thay di theo.
V mt k hiu, cc RSFF khng dng b duoc k hiu nhu sau:
R
Q S
R Q
S
Hnh 3.45. K hiu cc FF khng dong bo
a. R,S tc dong muc 1 - b. R,S tc dong muc 0
a) b)
Hnh 3.44. RSFF khng dong bo su dung cong NAND v bang trang thi
S
R
Q
1
2
Q
S R Q
0 0 X
0 1 1
1 0 0
1 1 Q
0
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 54
b. FF dong bo
Xt so d RSFF dng b voi so d mach, k hiu v bang trang thi hoat dng nhu hnh 3.46.
Trong d: Ck l tn hiu diu khin dng b hay tn hiu dng h (Clock). Khao st hoat dng cua
mach:
- Ck = 0: cng NAND 3 v 4 kha khng cho du liu dua vo. V cng NAND 3 v 4 du c t
nht mt ng vo Ck = 0 S =R =1 Q = Q
0
: RSFF giu nguyn trang thi cu.
- Ck = 1: cng NAND 3 v 4 mo. Ng ra Q s thay di ty thuc vo trang thi cua S v R.
+ S = 0, R = 0 S =1, R =1 Q = Q
0
+ S = 0, R = 1 S =1, R = 0 Q = 0
+ S = 1, R = 0 S = 0, R = 1 Q = 1
+ S = 1, R = 1 S = 0, R = 0 Q = X
Trong truong hop ny tn hiu dng b Ck tc dng muc 1. Trong
truong hop Ck tc dng muc 0 th ta mc thm cng dao nhu sau (hnh
3.47):
Ty thuc vo muc tch cuc cua tn hiu dng b Ck, chng ta c cc loai tn hiu diu khin:
- Ck diu khin theo muc 1.
- Ck diu khin theo muc 0.
- Ck diu khin theo suon ln (suon truoc).
- Ck diu khin theo suon xung (suon sau).
S R Ck Q
X X 0 Q
0
0 0 1 Q
0
0 1 1 0
1 0 1 1
1 1 1 X
S Q
Ck
R Q
S
R
Q
1
2
Q
3
4
R
S
Ck
Hnh 3.46. RSFF dong bo: So do logic v k hiu
S
R
Q
1
2
Q
3
4
R
S
Ck
S Q
Ck
R Q
Hnh 3.47
a. Muc 1 b. Muc 0 c. Suon ln d. Suon xuong
Hnh 3.48. Cc loai tn hiu diu khin Ck khc nhau
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 55
S
R
Mach
tao suon
ln
Ck
Xung sau khi qua
mach tao suon ln
Ck
t
t
0
0
Hnh 3.49. So do khoi FF tc dong theo suon ln v dang sng
Xt FF c Ck diu khin theo sun ln (sun truc):
Suon ln v muc logic 1 c mi quan h voi nhau, v vy mach tao suon ln l mach cai tin cua
mach tc dng theo muc logic 1.
Suon ln thuc cht l mt xung duong c thoi gian tn tai rt ngn. D cai tin cc FF tc dng
theo muc logic 1 thnh FF tc dng theo suon ln ta mc vo truoc FF d mt mach tao suon ln
nhu hnh 3.49.
O mach tao suon nguoi ta loi dung thoi gian tr cua tn hiu khi di qua phn tu logic. Di voi
mach tao suon nguoi ta loi dung thoi gian tr cua tn hiu khi di qua cng NOT.
Xt so d mach tao suon ln v dang sng nhu hnh 3.50 : Mach tao suon ln gm mt cng
AND 2 ng vo v mt cng NOT. Tn hiu x1 tu cng NOT duoc dua dn cng AND cng voi tn
hiu x
2
di truc tip (x
2
= Ck). Do tnh cht tr cua tn hiu Ck khi di qua cng NOT nn x
1
bi tr mt
khoang thoi gian, v vy tn hiu ng ra cua cng AND c dang mt xung duong rt hep voi thoi
gian tn tai chnh bng thoi gian tr (tr truyn dat) cua cng NOT. Xung duong hep ny duoc dua
dn ng vo dng b cua FF diu khin theo muc logic 1. Tai cc thoi dim c suon ln cua tn hiu
xung nhip Ck s xut hin mt xung duong tc dng vo ng vo dng b cua FF diu khin ng ra
Q thay di trang thi theo cc ng vo. So d mach FF c tn hiu Ck diu khin theo suon ln nhu
hnh 3.51.
S
Ck
R
y
x
1
x
2
Ck
t
y
0
t
x
1
0
t
x
2
0
Ck
t
0
Hnh 3.50
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 56
Xt FF c Ck diu khin theo sun xung (sun sau):
Mach tao suon xung l mach cai tin tc dng muc logic 0. So d mach v dang sng duoc cho o
hnh 3.52. Trn hnh 3.53 l k hiu trn so d mach v so d thuc hin Flip-Flop tc dng theo
suon xung.
(Sinh vin t giai thch hot dng cua cc mch ny).
S
R
Q
1
2
Q
3
4
R
S
y
Ck
Hnh 3.51. FF c tn hiu Ck diu khin theo suon ln
y
x
1
x
2
Ck
Ck
t
0
t
x
2
x
1
0
t
0
t
y
0
Hnh 3.52. Mach tao suon xuong
a. So do mach
b. Dang sng
a)
b)
S
R
Q
1
2
Q
3
4 R
S
y
Ck
S Q
Ck
R Q
Hnh 3.53
a. So do mach thuc hin
b. K hiu
a)
b)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 57
nghia cua tn hiu dng b Ck:
Di voi cc FF dng b, cc ng ra chi thay di trang thi theo ng vo DATA khi xung Ck tn tai
muc 1 (di voi FF tc dng muc 1), hoc xung Ck tn tai muc 0 (di voi FF tc dng muc 0), hoc
xung Ck o suon ln (di voi FF tc dng suon ln), xung Ck o suon xung (di voi FF tc dng
suon xung), cn tt ca cc truong hop khc cua Ck th ng ra khng thay di trang thi theo cc
ng vo mc d lc d cc ng vo c thay di trang thi.
Phuong php diu khin theo kiu chu t (Master - Slaver):
Di voi phuong php ny khi xung Ck tn tai muc logic 1 du liu s duoc nhp vo FF, cn khi
Ck tn tai muc logic 0 th du liu chua trong FF duoc xut ra ngoi.
V mt cu tao bn trong gm 2 FF: mt FF thuc hin chuc nng chu (Master) v mt FF thuc
hin chuc nng to (Slaver).
Hoat dng cua FF diu khin theo kiu chu/to: (hnh 3.54)
+ Ck = 1: FF2 mo, du liu duoc nhp vo FF2. Qua cng dao Ck = 0 ( FF1 kha nn giu nguyn
trang thi cu truoc d.
+ Ck = 0: FF2 kha nn giu nguyn trang thi cu truoc d. Qua cng dao Ck = 1 ( FF1 mo, du liu
duoc xut ra ngoi.
Ch : Tn hiu Ck c th duc to ra t mch dao dng da hi khng trng thi bn.
3.3.2.2. Phn loi FF theo chc nng
a. RSFF
D l FF c cc ng vo v ng ra k hiu nhu hnh v.
Trong d:
- S, R : cc ng vo du liu.
- Q, Q : cc ng ra.
- Ck : tn hiu xung dng b
Goi S
n
v R
n
l trang thi ng vo Data o xung Ck thu n.
Q
n
, Q
n+1
l trang thi cua ng ra Q o xung Ck thu n v thu (n+1).
Lc d ta c bang trang thi m ta hoat dng cua RSFF:
R
S
Ck
Q
1
2
Q
3
4
5
6
7
8
FF
1
FF
2
Hnh 3.54. Phuong php diu khin theo kiu chu to
S Q
Ck
R Q
Hnh 3.55. K hiu RSFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 58
S
n
R
n
Q
n+1
0 0 Q
n
0 1 0
1 0 1
1 1 X
Luu rng trang thi khi ca 2 ng vo S = R = 1 lc d ca 2 ng ra c cng muc logic, dy l
trang thi cm cua RSFF (thuong duoc k hiu X).
Tip theo chng ta s di xy dung bang du vo kch cua RSFF. Bang du vo kch gm 2
phn, phn bn tri lit k ra cc yu cu cn chuyn di cua FF, v phn bn phai l cc diu
kin tn hiu du vo kch cn dam bao d dat duoc cc su chuyn di y. Nu cc diu kin du
vo duoc dam bao th FF s chuyn di theo dng yu cu. Thuc cht bang du vo kch cua FF l
su khai trin bang trang thi cua FF.
Ta vit lai bang trang thi cua RSFF o dang khai trin nhu sau:
S
n
R
n
Q
n
Q
n+1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 X
1 1 1 X
Trong bang ny, tn hiu ng ra o trang thi tip theo (Q
n+1
) s phu thuc vo tn hiu cc ng
vo data (S, R) v tn hiu ng o ra trang thi hin tai (Q
n
).
Tu bang khai trin trn ta xy dung duoc bang du vo kch cho RSFF:
Q
n
Q
n+1
S
n
R
n
0 0 0 X
0 1 1 0
1 0 0 1
1 1 X 0
Cung tu bang trang thi khai trin ta c th tm duoc phuong trnh logic cua RSFF bng cch lp
so d Karnaugh nhu sau:
00 01 11 10
0 0 0 X 1
1 1 0 X 1
Tu bang Karnaugh ny ta c phuong trnh logic cua RSFF:
n
Q
n
R
n
S
1 n
Q + =
+
S
n
R
n
Q
n
Q
n+1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 59
V diu kin cua RSFF l S.R= 0 nn ta c phuong trnh logic cua RSFF duoc vit dy du nhu
sau:
n
Q
n
R
n
S
1 n
Q + =
+
SR=0
Dang sng minh hoa hoat dng cua RSFF trn hnh 3.56:
b. TFF
TFF l FF c ng vo v ng ra k hiu v bang trang thi hoat dng nhu hnh v (hnh 3.57):
Trong d:
- T: ng vo du liu
- Q,G: cc ng ra
- Ck: tn hiu xung dng b.
Goi T
n
l trang thi cua ng vo DATA T o xung Ck thu n.
Goi Q
n
, Q
n+1
l trang thi cua ng ra o xung Ck thu n v (n+1).
Lc d ta c bang trang thi hoat dng khai trin cua TFF.
Tu bang trang thi ny ta c nhn xt:
+ Khi T=0: mi khi c xung Ck tc dng ng ra Q giu nguyn trang thi cu truoc d.
+ Khi T=1: mi khi c xung Ck tc dng ng ra Q dao trang thi.
Hnh 3.56. o thi thoi gian dang sng RSFF
Ck
t
t
S
t
R
0
0
0
1
2 3 4 5
t
0
Q
T Q
Ck
Q
Q
n
Q
n
0
1
T
n
Q
n+1
Hnh 3.57. Ky hiu TFF va bang trang thai hoat
ng
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 60
Ck
t
t
T
t
Q
0
0
0
1
2 3
Hnh 3.58
T
n
Q
n
Q
n+1
0
0
1
1
0
1
0
1
0
1
1
0
Tu bang trang thi khai trin cua TFF ta tm duoc bang du vo kch cua TFF nhu sau:
Q
n
Q
n+1
T
n
0
0
1
1
0
1
0
1
0
1
1
0
Phuong trnh logic cua TFF:
Q
n+1
=
n n n n
Q . T .Q T + (dang chnh tc 1)
Hoc: ) Q T )( Q (T Q
n n n n 1 n
+ + =
+
(dang chnh tc 2).
Vit gon hon:
n n 1 n
Q T Q =
+
(SV c th lap Karnaugh v toi thiu ha d tm phuong trinh logic cua TFF).
Trn hnh 3.58 minh hoa d thi thoi gian dang sng cua TFF.
- Tn hiu ra Q du tin lun lun o muc logic 0
- Tn hiu Ck(1) diu khin theo suon xung nhn tn hiu T duoi muc logic 1. Theo bang trang
thi : T
0
= 1 v Q
0
= 0 Q
1
=
0
Q = 1.
- Tn hiu Ck(2) diu khin theo suon xung nhn tn hiu T duoi muc logic 0. Theo bang trang
thi : T
1
= 0 v Q
1
= 1 Q
2
= Q
1
= 1 (Giu nguyn trang thi truoc d).
- Tn hiu Ck(3) diu khin theo suon xung nhn tn hiu T duoi muc logic 1. Theo bang trang
thi: T
2
= 1 v Q
2
= 1 Q
3
=
2
Q = 0.
Trung hp ng vo T lun lun bng 1 (lun o mc logic 1):
Ck
t 1
2 3 4 5
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 61
Khi T=1 th dang sng ng ra Q duoc cho trn hnh v. Ta c nhn xt rng chu ky cua ng ra Q
bng 2 ln chu ky tn hiu xung Ck nn tn s cua ng ra l:
2
f
f
CK
Q
=
Vy, khi T=1 th TFF giu vai tr mach chia tn s xung vo Ck.
Tng qut: Ghp ni tip n TFF voi nhau sao cho ng ra cua TFF truoc s ni voi ng vo cua
TFF dung sau (Ck
i+1
ni voi Q
i
) v lc by gio tt ca cc ng vo DATA T o tt ca cc TFF du
giu muc logic 1, lc d tn s tn hiu ng ra s l:
n
CK
Q
2
f
f
n
=
voi Q
n
l tn hiu ng ra cua TFF thu n; f
CK
l tn s xung clock o ng vo dng b TFF du tin.
c. DFF
DFF l FF c ng vo v ng ra k hiu nhu hnh 3.60.
Trong d: D l ng vo du liu. Q, Q : cc ng ra. Ck: tn hiu xung dng b.
Goi D
n
l trang thai cua ng vo DATA D o xung Ck thu n.
Goi Q
n
, Q
n+1
l trang thi cua ng ra o xung Ck thu n v (n+1).
Khai trin bang trang thi cua DFF d tm bang du vo kch cua DFF, ta c:
D
n
Q
n
Q
n+1
0
0
1
1
0
1
0
1
0
0
1
1
0
1
0
1
D
n
Q
n+1
Bang trang thi
D Q
Ck
Q
Hnh 3.60. K hiu DFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 62
Bang du vo kch cua DFF:
Q
n
Q
n+1
D
n
0
0
1
1
0
1
0
1
0
1
0
1
Phuong trnh logic cua DFF:
Q
n+1
= D
n
Trn hnh 3.61 l d thi thoi gian dang sng cua DFF:
Giai thch dang sng cua tn hiu trn hnh 3.61:
- Tn hiu ra Q du tin lun lun o muc logic 0, Q
0
= 0
- Tn hiu Ck(1) diu khin theo suon xung nhn tn hiu D duoi muc logic 1. Theo bang trang
thi ta c: D
0
= 1 Q
1
= 1
- Tn hiu Ck(2) diu khin theo suon xung nhn tn hiu D duoi muc logic 0. Theo bang trang
thi ta c :D
1
= 0 Q
2
= 0
..v..v..
DFF dng vai tr mch chia tn s:
Trn hnh 3.62 l so d mach DFF thuc hin chuc nng chia tn
s. O mach ny ng ra Q duoc ni nguoc tro v ng vo D.
- Tn hiu ra Q
0
du tin lun o muc logic 0:
Q
0
= 0
0
Q = D
1
= 1
- Tn hiu Ck(1) diu khin theo suon xung nhn tn hiu D
1
duoi muc logic 1. D
1
= 1 Q
1
= 1
1
Q = D
2
= 0.
- Tn hiu Ck(2) diu khin theo suon xung nhn tn hiu D
2
duoi muc logic 0. D
2
= 0 Q
2
=
0
2
Q = D
3
= 1.
- Tn hiu Ck(3) diu khin theo suon xung nhn tn hiu D
3
duoi muc logic 1. D
3
= 1 Q
3
=
1
3
Q = D
4
= 0.
Ck
t
t
D
t
Q
0
0
1
2 3 4 5
Hnh 3.61. o thi thoi gian dang sng cua DFF
D Q
Ck
Q
Hnh 3.62.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 63
- Tn hiu Ck(4) diu khin theo suon xung nhn tn hiu D
4
duoi muc logic 0. Q
4
= 0
..v..v..
Nhn xt v tn s ng ra:
2
f
f
CK
Q
= DFF giu vai tr nhu mach chia tn s.
Ung dng cua DFF:
- Dng DFF d chia tn s.
- Dng DFF d luu tru du liu d ch tao cc b nho
v thanh ghi.
- Dng DFF d cht du liu.
Trn hnh 3.64 l so d mach ung dung DFF d cht du
liu. Hoat dng cua mach nhu sau:
- E=1: O
0
= D
0
, O
1
= D
1
nn tn hiu duoc dua dn
cc FF.
- E=0: O
0
= D
0
, O
1
= D
1
cht du liu tro lai.
d. JKFF
JKFF l FF c ng vo v ng ra k hiu nhu hnh v :
Trong d:
- J, K l cc ng vo du liu.
- Q, Q l cc ng ra.
- Ck l tn hiu xung dng b.
Goi J
n
, K
n
l trang thi ng vo J,K o xung Ck thu n.
Goi Q
n
, Q
n+1
l trang thi ng ra Q o xung Ck thu n v (n+1).
Lc d ta c bang trang thi m ta hoat dng cua JKFF:
J K Q
n+1
0
0
1
1
0
1
0
1
Q
n
0
1
Q
n
Ck
t
t
D
t
Q
0
0
0
1
2 3 4 5
Hnh 3.63. o thi thoi gian dang sng mach hnh 3.62
D Q
Ck
D Q
Ck
O
0
O
1
D
0
D
1
E
Hnh 3.64. Chot d liu dng DFF
J Q
Ck
K Q
Hnh 3.65. JKFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 64
Phuong trnh logic cua JKFF:
Q
n+1
= J
n n n n
.Q K Q +
Tu bang trang thi ta thy JKFF khc phuc duoc trang thi cm cua RSFF, khi J=K=1 ng ra o
trang thi k tip dao muc logic so voi ng ra o trang thi hin tai.
D tm bang du vo kch cua JKFF ta khai trin bang trang thi nhu sau:
J
n
K
n
Q
n
Q
n+1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
Tu bang khai trin trn ta xy dung duoc bang du vo kch cho JKFF nhu sau:
Q
n
Q
n+1
S
n
R
n
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
D thi thoi gian dang sng cua JKFF:
Nhn xt quan trng: JKFF l mach din c chuc nng thit lp trang thi 0, trang thi 1,
chuyn di trang thi v duy tr trang thi cn cu vo cc tn hiu du vo J, K v xung nhip dng
b Ck. Nhu vy c th ni JKFF l mt FF rt van nng.
Ck
t
t
J
t
K
0
0
0
1
2 3 4 5
t
0
Q
Hnh 3.66. o thi thoi gian dang sng JKFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 65
Hnh 3.67. Dng JKFF thuc hin chuc nng cua RSFF, TFF, DFF
J Q
Ck
K Q
S
R
T
J Q
Ck
K Q
D
J Q
Ck
K Q
FF
xut pht
Logic
chuyn di
Ck
Q
Q
Du vo
FF dch
Hnh 3.68
Trong thuc t, chng ta c th dng JKFF d thuc hin chuc nng cua cc FF khc: JKFF thay
th cho RSFF, JKFF thuc hin chuc nng cua TFF v DFF, cc so d thuc hin duoc trnh by trn
hnh 3.67:
Trn co so khao st v 4 loai FF phn chia theo chuc nng, chng ta c th xy dung mt bang
du vo kch tng hop cho ca 4 loai FF nhu sau:
Q
n
Q
n+1
S
n
R
n
J
n
K
n
T
n
D
n
0 0 0 X 0 X 0 0
0 1 1 0 1 X 1 1
1 0 0 1 X 1 1 0
1 1 X 0 X 0 0 1
3.3.3. S chuyn i ln nhau gia cc loi FF
Da s FF trn thi truong l loai JK, D trong khi k thut s yu cu tt ca cc loai FF. Nu bit
cch chuyn di giua cc loai FF voi nhau th c th pht huy tc dung cua loai FF sn c.
Trn thuc t, c th chuyn di qua lai giua cc loai FF khc nhau. C 2 phuong php d thuc
hin chuyn di giua cc loai FF:
- phuong php bin di truc tip.
- phuong php dng bang du vo kch v bang Karnaugh.
a. Phuong php bin doi truc tip:
Dy l phuong php su dung cc dinh l, tin d cua dai s Boole d tm phuong trnh logic tn
hiu kch thch di voi FF xut pht. So d khi thuc hin phuong php ny nhu sau (hnh 3.68):
TFF chuyn di thnh DFF, RSFF, JKFF:
- TFF RSFF:
RSFF c pt: Q
n+1
= S
n
+
n
R Q
n
(1)
S
n
R
n
= 0 (diu kin cua RSFF)
TFF c pt: Q
n+1
= T
n
Q
n
(2)
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 66
So snh (1) v (2) ta c:
S
n
+
n
R Q
n
= T
n
Q
n
Theo tnh cht cua php ton XOR, ta c:
T
n
= Q
n
(S
n
+
n
R Q
n
) = Q
n
)
n n n
Q R (S + +
n
Q (S
n
+
n
R Q
n
)
= Q
n n
S R
n
+ S
n n
Q = Q
n n
S R
n
+ S
n n
Q + S
n
R
n
= Q
n
R
n
+ S
n n
Q
Vy: T
n
= Q
n
R
n
+ S
n n
Q
So d mach thuc hin:
- TFF DFF:
DFF c phuong trnh logic: Q
n+1
= D
n
TFF c phuong trnh logic: Q
n+1
= T
n
Q
n
Dng nht 2 phuong trnh: D
n
= T
n
Q
n
Theo tnh cht cua php XOR ta suy ra: T
n
= D
n
Q
n
So d mach thuc hin:
- TFF DFF: Thuc hin bin di hon ton tuong tu (nhu truong hop chuyn di tu TFF
sang RSFF) ta c logic chuyn di:
T
n
= K
n
Q
n
+ J
n n
Q
So d mach chuyn di tu TFF sang JKFF
Hnh 3.69. Chuyn doi TFF thnh RSFF
T Q
Ck
Q
R
S
T Q
Ck
Q
D
Ck
Hnh 3.70. Chuyn doi TFF thnh DFF
T Q
Ck
Q
K
J
Hnh 3.71. Chuyn doi TFF thnh JKFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 67
DFF chuyn di thnh TFF, RSFF, JKFF:
- DFF TFF:
DFF c phuong trnh logic: Q
n+1
= D
n
TFF c phuong trnh logic: Q
n+1
= T
n
Q
n
Dng nht 2 phuong trnh ta c: D
n
= T
n
Q
n
So d mach thuc hin chuyn di (hnh 3.72):
- DFF RSFF:
RSFF c phuong trnh logic: Q
n+1
= S
n
+
n
R Q
n
Dng nht voi phuong trnh cua DFF ta c: D
n
= S
n
+
n
R Q
n
So d mach thuc hin chuyn di:
- DFF JKFF:
Hon ton tuong tu ta c logic chuyn di tu DFF sang JKFF:
D
n
= J
n n
Q +
n
K Q
n
So d mach chuyn di trn hnh 3.74:
RSFF chuyn di thnh TFF, DFF, JKFF:
RSFF c pt: Q
n+1
= S
n
+
n
R Q
n
S
n
R
n
= 0 (diu kin cua RSFF)
Khi thuc hin chuyn di tu RSFF sang cc FF khc cn kim tra diu kin rng buc cua RSFF
d l: R
n
S
n
= 0.
D Q
Ck
Q
T
Ck
Hnh 3.72. Chuyn doi DFF thnh TFF
Hnh 3.73. Chuyn doi tu DFF sang RSFF
D Q
Ck
Q
R
S
Hnh 3.74. Chuyn doi DFF thnh JKFF
D Q
Ck
Q
K
J
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 68
- RSFF TFF:
TFF c phuong trnh logic: Q
n+1
= T
n
Q
n
Dng nht voi phuong trnh cua RSFF ta c:
S
n
+
n
R Q
n
= T
n
Q
n
= T
n n
Q +
n
T Q
n
Tu biu thuc ny, nu ta dng nht:
S
n
= T
n n
Q
R
n
= T
n
th suy ra:
S
n
R
n
= T
n n
Q .T
n
= T
n n
Q 0
nn khng thoa mn diu kin cua RSFF.
Thuc hin bin di tip:
S
n
+
n
R Q
n
= T
n n
Q +
n
T Q
n
= T
n n
Q +
n
T Q
n
+
n
Q Q
n
S
n
+
n
R Q
n
= T
n n
Q + (
n
T +
n
Q )Q
n
= T
n n
Q +
n
Q
n
T Q
n
Dng nht 2 v ta c:
S
n
= T
n n
Q
R
n
= T
n
Q
n
thoa mn diu kin: R
n
S
n
= 0.
So d thuc hin: hnh 3.75.
- RSFF DFF: Q
n+1
= D
n
Dng nht 2 phuong trnh: S
n
+
n
R Q
n
= D
n
Thuc hin bin di:
S
n
+
n
R Q
n
= D
n
= D
n
(Q
n
+
n
Q ) = D
n
Q
n
+ D
n n
Q (a)
Mt khc biu thuc cua RSFF c th bin di nhu sau:
S
n
+
n
R Q
n
= S
n
(Q
n
+
n
Q ) +
n
R Q
n
= S
n
Q
n
+ S
n n
Q +
n
R Q
n
= S
n
Q
n
(R
n
+
n
R ) + S
n n
Q +
n
R Q
n
= S
n
Q
n n
R + S
n n
Q +
n
R Q
n
=
n
R Q
n
(1 + S
n
) + S
n n
Q
=
n
R Q
n
+ S
n n
Q (b)
Tu (a) v (b) ta c:
D
n
Q
n
+ D
n n
Q =
n
R Q
n
+ S
n n
Q
Dng nht 2 v suy ra:
S
n
= D
n
R
n
=
n
D
thoa mn diu kin R
n
S
n
= 0.
So d thuc hin: hnh 3.76.
R Q
Ck
S Q
T
Hnh 3.75. Chuyn doi RSFF sang TFF
R Q
Ck
S Q
D
Hnh 3.76. RSFF DFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 3. Cc phn tu logic co ban Trang 69
- RSFF JKFF:
Dng nht 2 phuong trnh logic cua RSFF v JKFF ta c:
Q
n+1
= S
n
+
n
R Q
n
= J
n n
Q +
n
K Q
n
= J
n n
Q +
n
K Q
n
+ Q
n n
Q = J
n n
Q + (
n
K +
n
Q )Q
n
= J
n n
Q +
n
Q
n
K Q
n
So snh ta c:
S
n
= J
n n
Q
R
n
= K
n
Q
n
thoa mn diu kin cua RSFF.
So d thuc hin: hnh 3.77.
JKFF chuyn di thnh TFF, DFF, RSFF:
Nhu d trnh by o trn, JKFF l mt FF van nng, c th dng JKFF d thay th cho RSFF hoc
dng JKFF thuc hin chuc nng DFF, TFF. So d thuc hin cc mach ny nhu o hnh 3.67. Phn
ny tp trung chung minh cc biu thuc logic chuyn di tu JKFF sang cc FF khc.
JKFF c phuong trnh logic: Q
n+1
= J
n n
Q +
n
K Q
n
- JKFF TFF:
TFF c phuong trnh logic: Q
n+1
= T
n
Q
n
= T
n n
Q +
n
T Q
n
So snh voi phuong trnh cua JKFF ta suy ra logic chuyn di:
J
n
= T
n
K
n
= T
n
- JKFF DFF:
DFF c phuong trnh logic: Q
n+1
= D
n
Vit lai biu thuc ny ta c: Q
n+1
=D
n
=D
n
(Q
n
+
n
Q ) = D
n
Q
n
+ D
n n
Q
So snh voi biu thuc cua JKFF ta c logic chuyn di:
J
n
= D
n
K
n
=
n
D
- JKFF RSFF:
Di voi RSFF c phuong trnh logic d tm duoc o cng thuc (b):
Q
n+1
= S
n
+
n
R Q
n
= S
n n
Q +
n
R Q
n
(b)
So snh voi phuong trnh logic cua JKFF ta c logic chuyn di:
J
n
= S
n
K
n
= R
n
b. Phuong php dng bang dau vo kch v bang Karnaugh:
Trong phuong php ny, cc du vo du liu (data) cua FF ban du l hm ra voi cc bin l
trang thi ng ra Qn v cc du vo data cua FF cn chuyn di. D thuc hin chuyn di ta dua vo
bang tn hiu du vo kch cua cc FF v lp bang Karnaugh, thuc hin ti gian d tm logic chuyn
di. Bang tn hiu du vo kch tng hop nhu sau:
R Q
Ck
S Q
J
K
Hnh 3.77. RSFF JKFF
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 70
SR
Q
n
J
00 01 11 10
0 0 0 X 1
1 X X X X
J = S
SR
Q
n
K
00 01 11 10
0 X X X X
1 0 1 X 0
K = R
Q
n
Q
n+1
S
n
R
n
J
n
K
n
T
n
D
n
0 0 0 X 0 X 0 0
0 1 1 0 1 X 1 1
1 0 0 1 X 1 1 0
1 1 X 0 X 0 0 1
Xt cc truong hop cu th:
- chuyn di tu JKFF TFF : J = f (T,Q
n
) v K = f (T,Q
n
)
- chuyn di tu JKFF DFF : J = f (D,Q
n
) v K = f (D,Q
n
)
- chuyn di tu JKFF RSFF : J = f (S,R,Q
n
) v K = f (S,R,Q
n
)
- chuyn di tu RSFF TFF : R = f (T,Q
n
) v S = f (T,Q
n
)
- chuyn di tu RSFF DFF : R = f (D,Q
n
) v S = f (D,Q
n
)
- chuyn di tu RSFF JKFF : R = f (J, K,Q
n
) v S = f (J,K,Q
n
)
- chuyn di tu TFF DFF : T = f (D,Q
n
)
- chuyn di tu TFF RSFF : T = f (R,S,Q
n
)
- chuyn di tu TFF JKFF : T = f (J,K,Q
n
)
- chuyn di tu DFF TFF : D = f (T,Q
n
)
- chuyn di tu DFF RSFF : D = f (R,S,Q
n
)
- chuyn di tu DFF JKFF : D = f (J,K,Q
n
)
V d 1: Chuyn di tu JKFF DFF dng phuong php bang.
Ta c cc hm cn tm:
J = f (D, Q
n
) va K = f (D, Q
n
)
Dua vo bang du vo kch tng hop ta lp bang Karnaugh:
Ti gian theo dang chnh tc 1 ta c: J = D v K =D.
V d 2: Chuyn di tu JKFF RSFF dng phuong php bang.
Ta c cc hm cn tm:
J = f (S,R,Q
n
)
K = f (S,R,Q
n
)
Dua vo bang du vo kch tng hop lp bang Karnaugh (xem bang).
Ti gian theo dang chnh tc 1 ta c: J = S v K = R.
D
Q
n
J
0 1
0 0 1
1 X X
J = D
D
Q
n
K
0 1
0 X X
1 1 0
K = D
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 71
Chuong 4
HE TO HQP
4.1.KHI NIEM CHUNG
Cc phn tu logic AND, OR, NOR, NAND l cc phn tu logic co ban cn duoc goi l h t hop
don gian. Nhu vy, h t hop l h c cc ng ra l cc hm logic theo ng vo, diu ny nghia l
khi mt trong cc ng vo thay di trang thi lp tuc lm cho ng ra thay di trang thi ngay ( nu
bo qua thoi gian tr cua cc phn tu logic) m khng chiu anh huong cua trang thi ng ra truoc d.
Xt mt h t hop c n ng vo v c m ng ra (hnh 4.1), ta c:
y
1
= f(x
1
, x
2
, ..., x
n
)
y
2
= f(x
1
, x
2
, ..., x
n
)
...................
y
m
= f(x
1
, x
2
, ..., x
n
)
Nhu vy, su thay di cua ng ra y
j
(j = 1 m) theo cc bin vo xi (i = 1 n) l tuy thuc vo
bang trang thi m ta hoat dng cua h t hop.
Dc dim co ban cua h t hop l tn hiu ra tai mi thoi dim chi phu thuc vo gi tri cc tn
hiu vo o thoi dim d m khng phu thuc vo gi tri cc tn hiu ng ra o thoi dim truoc d.
Trnh t d thit k h t hp theo cc buc sau:
1. Tu yu cu thuc t ta lp bang trang thi m ta hoat dng cua mach (h t hop).
2. Dng cc phuong php ti thiu d ti thiu ho cc hm logic.
3. Thnh lp so d logic (Dua vo phuong trnh logic d ti gian).
4. Thnh lp so d h t hop.
Cc mach t hop thng dung:
- Mach m ho - giai m
- Mach chon knh - phn duong
- Mach so snh
- Mach s hoc ....v....v....
4.2. MACH M HO & MACH GII M
4.2.1. Khi nim:
Mach m ho (ENCODER) l mach c nhim vu bin di nhung k hiu quen thuc voi con
nguoi sang nhung k hiu khng quen thuc con nguoi. Nguoc lai, mach giai m (DECODER) l
mach lm nhim vu bin di nhung k hiu khng quen thuc voi con nguoi sang nhung k hiu
quen thuc voi con nguoi.
H t
hop
x
2
x
n
y
1
y
2
y
m
Hnh 4.1
x
1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 72
4.2.2. Mach m ho (Encoder)
1. Mch m ho nh| phn
Xt mach m ha nhi phn tu 8 sang 3 (8 ng vo v 3 ng ra). So d khi cua mach duoc cho
trn hnh 4.2.
Trong d:
- x
0
, x
1
,..., x
7
l 8 duong tn hiu vo
- A, B, C l 3 ng ra.
Mach m ha nhi phn thuc hin bin di tn hiu ng vo thnh mt tu m nhi phn tuong ung
o ng ra, cu th nhu sau:
0 000 3 011 6 100
1 001 4 100 7 111
2 010 5 101
Chon muc tc dng (tch cuc) o ng vo l muc logic 1, ta c bang trang thi m ta hoat dng
cua mach :
x
0
x
1
x
2
x
3
x
4
x
5
x
6
x
7
C B A
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 0 1 1 1 1
Giai thch bang trng thi: Khi mt ng vo o trang thi tch cuc (muc logic 1) v cc ng vo
cn lai khng duoc tch cuc (muc logic 0) th ng ra xut hin tu m tuong ung. Cu th l: khi ng
vo x0=1 v cc ng vo cn lai bng 0 th tu m o ng ra l 000, khi ng vo x1=1 v cc ng vo
cn lai bng 0 th tu m nhi phn o ng ra l 001, ..v..v..
Phuong trnh logic ti gian:
A = x
1
+ x
3
+ x
5
+ x
7
B = x
2
+ x
3
+ x
6
+ x
7
C= x
4
+ x
5
+ x
6
+ x
7
8 3
x
0
x
2
x
7
C
B
A
Hnh 4.2 So do khoi mach m ha nhi phn tu 8 sang 3
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 73
So d logic thuc hin mach m ha nhi phn tu 8 sang 3 (hnh 4.3):
Biu din bng cng logic dng Diode (hnh 4.4):
Nu chon muc tc dng tch cuc o ng vo l muc logic 0, bang trang thi m ta hoat dng cua
mach lc ny nhu sau:
x
0
x
1
x
2
x
3
x
4
x
5
x
6
x
7
C B A
0 1 1 1 1 1 1 1 0 0 0
1 0 1 1 1 1 1 1 0 0 1
1 1 0 1 1 1 1 1 0 1 0
1 1 1 0 1 1 1 1 0 1 1
1 1 1 1 0 1 1 1 1 0 0
1 1 1 1 1 0 1 1 1 0 1
1 1 1 1 1 1 0 1 1 1 0
1 1 1 1 1 1 1 0 1 1 1
Phuong trnh logic ti gian :
A = x
1
+ x
3
+ x
5
+ x
7
=
7 5 3 1
x x x x
B = x
2
+ x
3
+ x
6
+ x
7
=
7 6 3 2
x x x x
C = x
4
+ x
5
+ x
6
+ x
7
=
7 6 5 4
x x x x
Hnh 4.3 Mach m ha nhi phn tu 8 sang 3
x1
C
x2 x5 x7
B
x3 x6 x4
A
x
1
x
2
x
3
x
4
x
5
x
6
x
7
B
A
C
Hnh 4.4 Mach m ha nhi phn tu 8 sang 3 su dung diode
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 74
So d mach thuc hin cho trn hnh 4.5
2. Mch m ho thp phn
Bang trang thi m ta hoat dng cua mach :
x
0
x
1
x
2
x
3
x
4
x
5
x
6
x
7
x
8
x
9
D C B A
1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 0 0 0 1 0 1
0 0 0 0 0 0 1 0 0 0 0 1 1 0
0 0 0 0 0 0 0 1 0 0 0 1 1 1
0 0 0 0 0 0 0 0 1 0 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1 0 0 1
Phuong trnh logic d ti gian:
A = x
1
+ x
3
+ x
5
+ x
7
+ x
9
B = x
2
+ x
3
+ x
6
+ x
7
C = x
4
+ x
5
+ x
6
+ x
7
D = x
8
+ x
9
Biu din bng so d logic (hnh 4.7)
Hnh 4.5 Mach m ha nhi phn 8 sang 3 ng vo tch cuc muc 0
B
x4 x2 x7
A
x6 x5 x1
C
x3
10 4
x
0
x
1
x
9
C
B
A
D
Hnh 4.6 So do khoi mach m ha tu 10 sang 4
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 75
Biu din so d ny bng cng logic su dung Diode duoc cho trn hnh 4.8
3. Mch m ho uu tin
Trong hai mach m ho d xt o trn, tn hiu du vo tn tai dc lp tuc l khng c tnh hung
c 2 tn hiu tro ln dng thoi tc dng o muc logic 1 (nu ta chon muc tch cuc o ng vo l muc
logic 1), thuc t dy l tnh hung hon ton c th xay ra, do d cn phai dt ra vn d uu tin.
Vn d uu tin: Khi c nhiu tn hiu vo dng thoi tc dng, tn hiu no c muc uu tin cao
hon o thoi dim dang xt s duoc uu tin tc dng, tuc l nu ng vo c d uu tin cao hon bng 1
x
1
B A C D
x
8
x
9
x
2
x
4
x
5
x
6
x
7
x
3
Hnh 4.8
Hnh 4.7 So do mach m ha thap phn tu 10 4
x1 x3
A
C
x5 x6 x2 x9 x8 x4
B
C
x7
D
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 76
trong khi nhung ng vo c d uu tin thp hon nu bng 1 th mach s tao ra tu m nhi phn ung
voi ng vo c d uu tin cao nht.
Xt mach m ho uu tin 4 2 (4 ng vo, 2 ng ra) (hnh 4.9).
Tu bang trang thi c th vit duoc phuong trnh logic cc ng ra A v B:
A = x
1
.
3
x
3
x .
2
x + =
3
x
2
x .
1
x +
B =
3
x
2
x
3
x
3
x .
2
x + = +
So d logic: hnh 4.10.
Mt s vi mach m ha uu tin thng dung: 74LS147, 74LS148.
4.2.3. Mach gii m (Decoder)
1. Mch giai m nh| phn
Xt mach giai m nhi phn 2 4 (2 ng vo, 4 ng ra) nhu trn hnh 4.11
Chon muc tch cuc o ng ra l muc logic 1.
x
0
1
x
x
x
x
1
0
1
x
x
x
2
0
0
1
x
x
3
0
0
0
1
B
0
0
1
1
A
0
1
0
1
Bang trang thi
x
0
x
2
x
3
x
1
B
A
4 2
Hnh 4.9
B
x1
A
x3 x2
Hnh 4.10 So do logic mach m ha uu tin 4 2
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 77
Phuong trnh logic ti gian v so d mach thuc hin
A . B y
0
= A . B y
1
=
A . B y
2
= B . A y
3
=
Biu din bng cng logic dng Diode.
Truong hop chon muc tch cuc o ng ra l muc logic 0 (muc logic thp) ta c so d khi mach
giai m duoc cho trn hnh 4.14.
Phuong trnh logic:
A . B A B y
0
= + =
.A B A B y
1
= + =
A B A B
2
y = + =
B.A A B
3
y = + =
y
0
1
0
0
0
y
1
0
1
0
0
y
2
0
0
1
0
y
3
0
0
0
1
B
0
0
1
1
A
0
1
0
1
Bang trang thai m ta hoat
ng cua mach
Hnh 4.11 Mach giai m 2 sang 4
y
0
y
2
y
3
y
1
B
A
2 4
y
0
y
1
y
2
y
3
B
B
A
A
+E
c
Hnh 4.13. Mach giai m 2 4 dng diode
A
B
y
0
y
1
y
2
y
3
2 4
y
0
0
1
1
1
y
1
1
0
1
1
y
2
1
1
0
1
y
3
1
1
1
0
B
0
0
1
1
A
0
1
0
1
Bang trang thi
Hnh 4.14. Muc tch cuc ng ra l muc thap
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 78
So d mach thuc hin:
2. Mch giai m thp phn
a. Giai m dn NIXIE
Dn NIXIE l loai dn din tu loai Katod lanh (Katod khng duoc nung nng boi tim dn), c
cu tao gm mt Anod v 10 Katod mang hnh cc s tu 0 dn 9.
So d khai trin cua dn duoc cho trn hnh 4.16:
So d khi cua mach giai m dn NIXIE
Chon muc tch cuc o ng ra l muc logic 1, lc d bang trang thi hoat dng cua mach nhu sau:
y0
y2
y1
x2 x1
y3
Hnh 4.15. Mach giai m 2 4 voi ng ra muc tch cuc thap
A B
0 1 2 3 4 5 6 7 8 9
Anod
Hnh 4.16. So do khai trin cua dn NIXIE
C
B
y
0
y
1
y
9
4 10
A
D
Hnh 4.17. So do khoi mach giai m dn NIXIE
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 79
D C B A y
0
y
1
y
2
y
3
y
4
y
5
y
6
y
7
y
8
y
9
0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 0 0 0 0 0 0 0
0 0 1 1 0 0 0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0 1 0 0 0 0 0
0 1 0 1 0 0 0 0 0 1 0 0 0 0
0 1 1 0 0 0 0 0 0 0 1 0 0 0
0 1 1 1 0 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 0 0 0 0 0 1 0
1 0 0 1 0 0 0 0 0 0 0 0 0 1
Phuong trnh logic:
A B C D y
0
= A B C D y
1
= A B C D y
2
= BA C D y
3
=
A B C D y
4
= A B C D y
5
= A CB D y
6
= CBA D y
7
=
A B C D y
8
= A B C D y
9
=
So d thuc hin mach giai m dn NIXIE duoc cho trn hnh 4.18 v 4.19:
y1
y5
y2
y3
y6
B
y8
y7
D
y0
y9
y4
C A
Hnh 4.18. So do thuc hin bng cong logic
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 80
b. Giai m dn LED 7 doan
Dn LED 7 doan c cu tao gm 7 doan, mi doan l 1 dn LED. Tuy theo cch ni cc Kathode
(Catt) hoc cc Anode (Ant) cua cc LED trong dn, m nguoi ta phn thnh hai loai:
LED 7 doan loai Anode chung:
LED 7 doan loai Kathode chung :
V
CC
D
C
B
A
D
C
B
A
y
0
y
2
y
3
y
4
y
5
y
6
y
7
y
8
y
9
Hnh 4.19. So do thuc hin dng diode
a b
c
d e f g
K
Hnh 4.21. LED 7 doan loai Kathode chung
a
c
d
e
b f
g
a b c d e f g
A
Hnh 4.20. LED 7 don loi Anode chung
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 81
Ung voi mi loai LED khc nhau ta c mt mach giai m ring. So d khi cua mach giai m
LED 7 doan nhu sau:
Giai m LED 7 don loi Anode chung:
Di voi LED bay doan loai anode chung, v cc anode cua cc doan led duoc ni chung voi nhau
v dua ln muc logic 1 (5V), nn mun doan led no tt ta ni kathode tuong ung ln muc logic 1
(5V) v nguoc lai mun doan led no sng ta ni kathode tuong ung xung mass (muc logic 0).
V du: D hin thi s 0 ta ni kathode cua dn g ln muc logic 1 d dn g tt, v ni cc kathode
cua dn a, b, c, d, e, f xung mass nn ta thy s 0.
Lc d bang trang thi m ta hoat dng cua mach giai m LED bay doan loai Anode chung nhu
sau:
D B C A a b c d e f g S hin th|
0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 1 1 0 0 1 1 1 1 1
0 0 1 0 0 0 1 0 0 1 0 2
0 0 1 1 0 0 0 0 1 1 0 3
0 1 0 0 1 0 0 1 1 0 0 4
0 1 0 1 0 1 0 0 1 0 0 5
0 1 1 0 0 1 0 0 0 0 0 6
0 1 1 1 0 0 0 1 1 1 1 7
1 0 0 0 0 0 0 0 0 0 0 8
1 0 0 1 0 0 0 0 1 0 0 9
1 0 1 0 X X X X X X X X
1 0 1 1 X X X X X X X X
1 1 0 0 X X X X X X X X
1 1 0 1 X X X X X X X X
1 1 1 0 X X X X X X X X
1 1 1 1 X X X X X X X X
Dng bang Karnaugh d ti thiu ha mach trn. Phuong trnh ti thiu ha c th vit o dang
chnh tc 1 (tng cua cc tch s) hoc dang chnh tc 2 (tch cua cc tng s):
Mch
giai m
LED
7 don
(47)
a
b
c
d
e
f
g
A
B
C
D
Hnh 4.22. So do khoi mach giai m LED 7doan
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 82
Phuong trnh logic cua ng ra a:
Dang chnh tc 2:
a = A C D B A D C B A) )(C A C .( D . B + = + +
Dang chnh tc 1:
a = A B C D A B C +
Luu : Trn bang Karnaugh chng ta d thuc hin toi thiu ha theo
dang chnh tc 2.
Phuong trnh logic cua ng ra b:
Dang chnh tc 2:
b = B) A B C(A ) B A B)( .C(A + = + +
= B) C(A
Dang chnh tc 1:
b = A CB A B C + = B) C(A
Phuong trnh logic cua ng ra c:
Dang chnh tc 2:
c = C A B
Dang chnh tc 1:
c = A B C D
Phuong trnh logic cua ng ra d:
Dang chnh tc 2:
d = C) )(A B D)(A C B )( C B A ( D + + + + + +
= D C B A D ABC D C B A + +
Dang chnh tc 1:
d = CBA A B C D A B C + +
Phuong trnh logic cua ng ra e:
Dang chnh tc 2:
e = A) A)(C B .( + +
Dang chnh tc 1:
e = A B C +
00 01 11 10
00 0 1 x 0
01 1 0 x 0
11 0 0 x x
10 0 0 x x
00 01 11 10
00 0 0 x 0
01 0 1 x 0
11 0 0 x x
10 0 1 x x
00 01 11 10
00 0 0 x 0
01 0 0 x 0
11 0 0 x x
10 1 0 x x
00 01 11 10
00 0 1 x 0
01 1 0 x 0
11 0 1 x x
10 0 0 x x
00 01 11 10
00 0 1 x 0
01 1 1 x 1
11 1 1 x x
10 0 0 x x
DC
BA
a
DC
BA
b
DC
BA
c
DC
BA
d
DC
BA
e
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 83
Phuong trnh logic cua ng ra f:
Dang chnh tc 2:
f = D ) C B )(A C B)(B (A + + + +
= D C B D C A D AB + +
Dang chnh tc 1:
f = B C D A C D BA + +
Phuong trnh logic cua ng ra g:
Dang chnh tc 2:
g = C) B B)( C )( B (A D + + +
CBA D D C B + =
Dang chnh tc 1:
g = B C D CBA D +
Xt mch giai m dn led 7 don loi Kathode chung:
Chon muc tch cuc o ng ra l muc logic 1. V Kathode cua cc doan led duoc ni chung v
duoc ni xung muc logic 0 (0V-mass) nn mun doan led no tt ta dua Anode tuong ung xung
muc logic 0 (0V-mass).
V du: D hin thi s 0 ta ni Anode cua doan led g xung muc logic 0 d doan g tt, dng thoi
cc kathode cua doan a, b, c, d, e, f duoc ni ln ngun nn cc doan ny s sng do d ta thy s 0.
Lc d bang trang thi m ta hoat dng cua mach nhu sau:
D B C A a b c d e f g
0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0
0 0 1 0 1 1 0 1 1 0 1
0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1
0 1 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 0 0 0 0
1 0 0 0 1 1 1 1 1 1 1
1 0 0 1 1 1 1 1 0 1 1
1 0 1 0 X X X X X X X
1 0 1 1 X X X X X X X
1 1 0 0 X X X X X X X
1 1 0 1 X X X X X X X
1 1 1 0 X X X X X X X
1 1 1 1 X X X X X X X
Tuong tu nhu truong hop trn, ta cung dng bang Karnaugh d ti thiu ha hm mach v di tm
phuong trnh logic ti gian cc ng ra cua cc doan led: (Luu trong nhung bang d Karnaugh sau
ta thuc hin toi thiu ha theo dang chnh tc 1)
00 01 11 10
00 0 0 x 0
01 1 0 x 0
11 1 1 x x
10 1 0 x x
00 01 11 10
00 1 0 x 0
01 1 0 x 0
11 0 1 x x
10 0 0 x x
DC
BA
f
DC
BA
g
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 84
Phuong trnh logic cua ng ra a:
Dang chnh tc 1:
a = AC C A B D + + +
Dang chnh tc 2:
a = ) C B D)(A C B A ( + + + + +
= C A AC B AD + + +
Phuong trnh logic cua ng ra b:
Dang chnh tc 1:
b = C + BA + B A B A C + =
Dang chnh tc 2:
b = ( C+B + A )( C+B+A)
= B A C B A AB C + = + +
Phuong trnh logic cua ng ra c:
Dang chnh tc 1:
c =B + A + C
Dang chnh tc 2:
c = C + B + A
Phuong trnh logic cua ng ra d:
Dang chnh tc 1:
d = D+BA +C A+BC + C B A
Dang chnh tc 2:
d = D) C B A )( C B A )( C B (A + + + + + + +
= D) C B A B)( A B A C ( + + + + +
= D) C B A B)( A (C + + + +
Phuong trnh logic cua ng ra e:
Dang chnh tc 1:
e = A.B + C A
Dang chnh tc 2:
e = A ( C + B) = A C + A.B
00 01 11 10
00 1 0 x 1
01 0 1 x 1
11 1 1 x x
10 1 1 x x
00 01 11 10
00 1 1 x 1
01 1 0 x 1
11 1 1 x x
10 1 0 x x
00 01 11 10
00 1 1 x 1
01 1 1 x 1
11 1 1 x x
10 0 1 x x
00 01 11 10
00 1 0 x 1
01 0 1 x 1
11 1 0 x x
10 1 1 x x
00 01 11 10
00 1 0 x 1
01 0 0 x 0
11 0 0 x x
10 1 1 x x
DC
BA
a
DC
BA
b
DC
BA
c
DC
BA
d
DC
BA
e
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 85
Phuong trnh logic cua ng ra f:
Dang chnh tc 1:
f = D+ CB +B A + CA
Dang chnh tc 2:
f = ( B+ A)( D+C+A)(C+B)
= D +BC +AC + A B
Phuong trnh logic cua ng ra g:
Dang chnh tc 1:
g =D+CB+BA+BC
Dang chnh tc 2:
g =( C+B+A)(B+C+D)
4.3. MACH CHN KNH - PHN DUNG
4.3.1. Di cuong
Mach chon knh cn goi l mach hop knh (ghp knh) l mach c chuc nng chon ln luot 1
trong N knh vo d dua dn ng ra duy nht (ng ra duy nht d goi l duong truyn chung). Do
d, mach chon knh cn goi l mach chuyn du liu song song o ng vo thnh du liu ni tip o
ng ra, duoc goi l Multiplex (vit tt l MUX).
Mach chon knh thuc hin chuc nng o du pht cn mach phn duong thuc hin chuc nng o
du thu. Mach phn duong cn goi l mach tch knh (phn knh, giai da hop), mach ny c nhim
vu tch N ngun du liu khc nhau o cng mt du vo d r ra N ng ra khc nhau. Do d, mach
phn duong cn goi l mach chuyn du liu ni tip o ng vo thnh du liu song song o ng ra,
duoc goi l Demultiplex (vit tt l DEMUX).
4.3.2. Mch chn knh
Xt mach chon knh don gian c 4 ng vo v 1 ng ra nhu
hnh 4.23a.
Trong d:
+ x
1
, x
2
, x
3
, x
4
: Cc knh du liu vo.
+ Ng ra y : Duong truyn chung.
+ c1, c2 : Cc ng vo diu khin
Vy mach ny ging nhu 1 chuyn mach (hnh 4.23b):
00 01 11 10
00 1 1 x 1
01 0 1 x 1
11 0 0 x x
10 0 1 x x
00 01 11 10
00 0 1 x 1
01 0 1 x 1
11 1 0 x x
10 1 1 x x
DC
BA
f
DC
BA
g
x
4
x
2
x
3
x
1
y
4 1
c
1 c
2
Hnh 4.23a. Mach chon knh
x
4
x
2
x
3
x
1
y
Hnh 4.23b
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 86
c
1
c
2
y
x
1
c
2
c
3
c
4
0 0
0
0
1
1
1 1
D thay di ln luot tu x
1
x
4
phai c diu khin do d di voi mach chon knh d chon ln
luot tu 1 trong 4 knh vo cn c cc ng vo diu khin c
1
, c
2
. Nu c N knh vo th cn c n ng
vo diu khin thoa mn quan h: N=2
n
. Ni cch khc: S t hop ng vo diu khin bng s
lung cc knh vo.
Vic chon du liu tu 1 trong 4 ng vo d dua dn duong truyn chung l ty thuc vo t hop
tn hiu diu khin tc dng dn hai ng vo diu khin c
1
, c
2
.
+ c
1
= 0, c
2
= 0 y = x
1
(x
1
duoc ni toi ng ra y).
+ c
1
= 0, c
2
= 1 y = x
2
(x
2
duoc ni toi ng ra y).
+ c
1
= 1, c
2
= 0 y = x
3
(x
3
duoc ni toi ng ra y).
+ c
1
= 1, c
2
= 1 y = x
4
(x
4
duoc ni toi ng ra y).
Vy tn hiu diu khin phai lin tuc d du liu tu cc knh duoc
lin tuc dua dn ng ra. Tu d ta lp duoc bang trang thi m ta hoat
dng cua mach chon knh.
Phuong trnh logic m ta hoat dng cua mach :
y =
1
c
2
c .x
1
+
1
c c
2
.x
2
+ c
1
2
c .x
3
+ c
1
.c
2
.x
4
So d logic cua mach:
By gio, xt mach chon knh c 4 ng vo v 1 ng ra, nhung lai c 4 ng diu khin. Lc ny,
ta khng dua vo t hop tn hiu tc dng ln ng vo diu khin, m chi xt dn muc tch cuc o
ng vo diu khin. Ta s chon mt trong hai muc logic 1 hoc muc logic 0 lm muc tch cuc, nu 1
ng vo trong s 4 ng vo diu khin tn tai muc logic tch cuc (muc 1 hoc muc 0) th knh du
liu vo c cng chi s voi ng vo diu khin d s duoc kt ni voi ng ra. Trn hnh 4.25 biu
din mach chon knh voi s luong ng vo diu khin bng s luong knh vo.
c
1
c
2
x
4
x
1
x
2
x
3
x
1
x
2
x
3
x
4
y
1
2
3
4
Hnh 4.24. So do logic mach chon knh tu 4 1
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 87
Nu chon muc tch cuc cua cc ng vo diu khin l muc logic 1, ta c bang trang thi m ta
hoat dng cua mach nhu sau:
c
1
c
2
c
3
c
4
y
1 0 0 0 x
1
0 1 0 0 x
2
0 0 1 0 x
3
0 0 0 1 x
4
Phuong trnh logic:
y = c
1
. x
1
+ c
2
. x
2
+ c
3
. x
3
+ c
4
. x
4
nghia trong thuc t cua mach:
+ c
1
, c
2
, c
3
, c
4
: C th hiu l cc dia chi (ngun v dch).
+ x
1
, x
2
, x
3
, x
4
: Thng tin cn truyn di.
4.3.3. Mch phn dung
Xt mach phn duong don gian c 1 ng vo v 4 ng ra k hiu nhu sau :
Trong d:
+ x l knh du liu vo.
+ y1, y2, y3, y4 cc ng ra du liu; c1, c2 cc ng vo diu khin.
Ta c th thy mach ny thuc hin chuc nng nhu 1 chuyn mach (hnh v 4.26).
Ty thuc vo t hop tn hiu diu khin tc dung vo mach m ln luot tn hiu tu ng vo x s
chuyn dn ng ra y1, y2, y3, y4 mt cch tuong ung.
Lc d bang trang thi m ta hoat dng cua mach :
c
1
c
2
y
1
y
2
y
3
y
4
0 0 x 0 0 0
0 1 0 x 0 0
1 0 0 0 x 0
1 1 0 0 0 x
x
4
x
2
x
3
x
1
y
4 1
c
1 c
2
c
3
c
4
Hnh 4.25. Mach chon knh voi so luong ng vo diu khin bng so knh vo
x
y
4
y
2
y
3
y
1
x
y
4
y
2
y
3
y
1
1 4
c
1 c
2
Hnh 4.26. Mach phn duong don gian tu 1 4
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 88
Phuong trnh logic cc ng ra:
y
1
=
1
c
2
c .x
y
2
=
1
c c
2
.x
y
3
= c
1
2
c .x
y
4
= c
1
c
2
.x
So d logic duoc cho trn hnh 4.27:
Nu x = 1 v hon di ng vo diu khin thnh ng vo du liu th mach phn duong chuyn
thnh mach giai m nhi phn. V vy, nh san xut d ch tao IC dam bao ca hai chuc nng: giai m
v giai da hop (Decode/Demultilex). V du: cc IC 74138, 74139, 74154: giai m v phn duong
ty thuc vo cch ni chn.
Trong trung hp tng qut, mch phn dung c 1 ng vo v 2
n
ng ra: d tch N=2
n
ngun du liu khc nhau cn c n ng vo diu khin, lc d s t hop ng vo diu khin bng s
luong ng ra.
Tuy nhin trong thuc t, ta cn gp mach phn duong c s
luong ng vo diu khin bng s ng ra (hnh 4.28). Lc d chi
xt dn muc tch cuc o ng vo diu khin, nguoi ta chon mt
trong hai muc logic 1 hoc muc logic 0 lm muc tch cuc. Gia su
chon muc logic 1 l muc tch cuc: nu 1 ng vo trong s 4 ng
vo diu khin tn tai muc logic 1 (muc tch cuc), th ng ra du
liu tuong ung c cng chi s voi ng vo diu khin d s duoc
ni voi ng vo du liu chung x.
V du:
c
1
= 1 x = y
1
c
2
= 1 x = y
2
c
3
= 1 x = y
3
c
4
= 1 x = y
4
c
1
c
2
y
4
y
1
y
2
y
3
x
1
2
3
4
Hnh 4.27. So do logic thuc hin mach phn duong
y
4
y
2
y
3
y
1
x
1 4
c
1 c
2
c
3
c
4
Hnh 4.28
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 89
Lc d bang trang thi hoat dng cua mach:
c
1
c
2
c
3
c
4
y
1
y
2
y
3
y
4
1 0 0 0 X 0 0 0
0 1 0 0 0 X 0 0
0 0 1 0 0 0 X 0
0 0 0 1 0 0 0 X
Phuong trnh logic v so d logic duoc cho trn hnh 4.29:
y
1
= c
1
x y
2
= c
2
x
y
3
= c
3
x y
4
= c
4
x
Giai thch hoat dng cua mach:
+ Khi c
1
=1, c
2
= c
3
= c
4
= 0 chi c cng AND(1) thng cho du liu tu x ni dn du ra y
1
.
+ Khi c
2
=1, c
1
= c
3
= c
4
= 0 chi c cng AND(2) thng cho du liu tu x ni dn du ra y
2
.
+ Khi c
3
=1, c
2
= c
1
= c
4
= 0 chi c cng AND(3) thng cho du liu tu x ni dn du ra y
3
.
+ Khi c
4
=1, c
2
= c
3
= c
1
= 0 chi c cng AND(4) thng cho du liu tu x ni dn du ra y
4
.
V mach chon knh duoc thuc hin o du pht v mach phn duong duoc thuc hin o du thu
nn d dam bao du liu duoc chuyn dng knh th mach chon knh v mach phn duong phai dng
b voi nhau.
4.4. MACH SO SNH
4.4.1. Di cuong
- Mach so snh dng d so snh cc s nhi phn v mt d lon.
V du: So snh a v b: a = 0, b = 1 ( a< b.
- C hai mach so snh:
+ So snh hai s nhi phn 1 bit.
+ So snh hai s nhi phn nhiu bit.
c
1
c
2
y
4
y
1
y
2
y
3
x
1
2
3
4
c
3
c
4
Hnh 4.29. Mach phn duong so luong ng vo diu khin bng so ng ra
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 90
4.4.2. Mch so snh 1 bit
L mach thuc hin chuc nng so snh hai s nhi phn 1 bit.
Xt hai s nhi phn 1 bit a v b. C cc truong hop sau dy:
+ a = 0, b = 0 a = b.
+ a = 1, b = 1 a = b.
+ a = 0, b = 1 a < b.
+ a = 1, b = 0 a > b.
V phuong din mach din, mach so snh 1 bit c 2 ng vo v 3 ng ra. Cc ng vo a, b l cc
bt cn so snh; cc ng ra th hin kt qua so snh: y1 (a < b), y2 (a=b) v y3 (a > b). So d khi
mach so snh trn hnh 4.30.
Chon muc tch cuc o ng ra l muc logic 1. Ta lp duoc bang trang thi m ta hoat dng cua
mach. Tu bang trang thi, ta c phuong trnh logic:
y
1
= a .b
y
2
= a . b + a.b = b a
y
3
= a. b
4.4.3. Mch so snh nhiu bit
Mach c 8 ng vo v 3 ng ra, thuc hin so snh 2 s nhi phn 4 bt A (a
3
a
2
a
1
a
0
) v B
(b
3
b
2
b
1
b
0
). C hai phuong php thuc hin mach so snh nhiu bt:
Bang trang thi
y
1
y
2
y
3
0
0
1
0
0 1
1
0
0
0
0 1
a b
0
1
0
1
0
1
0
1
(a < b) = y
1
(a = b) = y
2
(a > b) = y
3
23
a
b
Hnh 4.30. Mach so snh 1 bit
Hnh 4.31. So do mach so snh 1 bit
1
2
3
1
2
3
1
2
3
y
1
(a < b)
y
3
(a>b)
y
2
(a=b)
a
b
(A < B) = Y
1
(A = B) = Y
2
(A > B) = Y
3
83
b
3
b
2
b
1
b
0
a
0
a
1
a
2
a
3
Hnh 4.32. So do khoi mach so snh nhiu bit
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 91
- Thuc hin truc tip.
- Thuc hin mach so snh nhiu bt trn co so mach so snh 1 bt.
Chng ta ln luot xt tung phuong php.
1. Phuong php trc tip
Ta c bang trang thi hoat dng cua mach
INPUT OUTPUT
a
3
v b
3
a
2
v b
2
a
1
v b
1
a
0
v b A < B A = B A > B
< x x x 1 0 0
> x x x 0 0 1
= < x x 1 0 0
= > x x 0 0 1
= = < x 1 0 0
= = > x 0 0 1
= = = < 1 0 0
= = = > 0 0 1
= = = = 0 1 0
Phuong trnh logic cua mach:
Y
1
= ( A < B)
= (a
3
< b
3
) + (a
3
= b
3
)( a
2
< b
2
) + (a
3
= b
3
)(a
2
= b
2
)(a
1
< b
1
)
+ (a
3
= b
3
)(a
2
= b
2
)(a
1
= b
1
)(a
0
< b
0
)
Y
2
= ( A = B)
= (a
3
= b
3
)(a
2
= b
2
) (a
1
= b
1
)(a
0
= b
0
)
Y
3
= ( A > B)
= (a
3
> b
3
) + (a
3
= b
3
)( a
2
> b
2
) + (a
3
= b
3
)(a
2
= b
2
)(a
1
> b
1
)
+ (a
3
= b
3
)(a
2
= b
2
)(a
1
= b
1
)(a
0
> b
0
).
So d mach thuc hin trn hnh 4.33.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 92
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
1
2
3
1
2
3
1
2
3
a3<b3 a3>b3
a2>b2 a2<b2 a0>b0 a0<b0
a1>b1 a1<b1
a3=b3
a2=b2
a1=b1
a0=b0
Y
Y
Y
Hnh 4.33. Thuc hin mach so snh nhiu bt theo cch truc tip
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 93
2. Phuong php xy dng trn co so mch so snh 1 bit
D mach so snh hai s nhi phn 1 bit c th thuc hin cng vic xy dung mach so snh hai s
nhi phn nhiu bit ta cai tin lai mach so snh 1 bit nhu sau: ngoi cc ng vo v ng ra ging nhu
mach so snh 1 bit ta d khao st o trn, cn c cc ng vo diu khin a< b, a> b, a = b, voi so d
mach nhu sau :
Bang trang thi m ta hoat dng cua mach so snh nhi phn 1 bit dy du nhu sau:
Ng vo diu khin Ng vo DATA Ng ra
a<b a=b a>b a b (a<b) (a=b) (a>b)
1 0 0 x x 1 0 0
0 0 1 x x 0 0 1
0 1 0 0 0 0 1 0
0 1 0 0 1 1 0 0
0 1 0 1 0 0 0 1
0 1 0 1 1 0 1 0
Phuong trnh logic:
y
1
= (a<b) = c
1
+ c
2
( a b).
y
2
= (a=b) = c
2
( b a ).
y
3
= (a>b) = c
3
+ c
2
(ab ).
Dua vo vi mach so snh dy du ny, nguoi ta thuc hin mach so snh hai s nhi phn 4 bit bng
cch su dung cc vi mach so snh 1 bit dy du ny gua a
3
voi b
3
, a
2
voi b
2
, a
1
voi b
1
, a
0
voi b
0
voi
cch ni theo so d nhu trn hnh 4.35.
Luu doi voi mach trn hnh 4.35: mach c 3 ng vo diu khin (A>B), (A=B), (A<B) nn d
mach lm vic duoc th bt buoc cho ng vo diu khin (A=B) = 1 (tuc l xem nhu a
4
, a
4
tro v
truoc bng nhau, nu a
4
> a
4
th ng ra A>B).
( a < b ) = y
1
( a = b ) = y
2
( a > b ) = y
3
23
a
b
c
3 c
2
c
1
a>b a<b a=b
Hnh 4.34. Mach so snh 1 bt cai tin
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 94
4.5. MACH S HC
4.5.1. Di cuong
Mach s hoc l mach c chuc nng thuc hin cc php ton s hoc +, -, x, / cc s nhi phn. Dy
l co so d xy dung don vi lun l v s hoc (ALU) trong p (icro Processor) hoc CPU (Centre
Processing Unit).
4.5.2. B cng (Adder)
1. B bn tng (HA-Half Adder)
B bn tng thuc hin cng 2 s nhi phn mt bt.
Quy tc cng nhu sau:
0 + 0 = 0 nho 0
0 + 1 = 1 nho 0
1 + 0 = 1 nho 0
1 + 1 = 0 nho 1
(a) (b) (s) (c)
a
3
b
3
a
2
b
2
a
1
b
1
a
0
b
0
(A<B)
(A=B)
(A>B)
A>B
A=B
A<B
0
0
1
Hnh 4.35. Mach so snh nhiu bt
s
c
a
b
HA
Hnh 4.36. Mach cong 1 bt
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 95
Trong d a, b l s cng, s l tng, c l s nho.
Bang trang thi m ta hoat dng cua mach v phuong trnh logic:
s = a. b + a .b = ab
c = a.b
Mach cng ny chi cho php cng hai s nhi phn 1 bit m
khng thuc hin cng hai s nhi phn nhiu bit.
2.B tng (B cng ton phn - FA: Full Adder)
V phuong din mach c so d khi nhu sau:
Trong d:
+ C
n-1
: S nho cua ln cng truoc d.
+ C
n
: S nho cua ln cng hin tai.
+ S
n
: Tng hin tai.
Tu bang trang thi m ta hoat dng cua mach ta vit duoc phuong trnh logic:
S
n
= f (a
n
, b
n
, C
n-1
)
C
n
= f (a
n
, b
n
, C
n-1
)
Lp bang Karnaugh v ti thiu ha, ta c:
a b s c
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
a
n
b
n
C
n-1
S
n
C
n
0 0 0 0 0
0 1 0 1 0
1 0 0 1 0
1 1 0 0 1
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 1
00 01 11 10
0
1
0
0 1
0
0
1
1
1
a
n
b
n
C
n-1
S
n
00 01 11 10
0
1
1
0 0
1
1
1
0
0
a
n
b
n
C
n-1
C
n
1 1
1 1


+
+ + =
n n n n n n
n n n n n n n
C b a C b a
C b a C b a S
1
=
n n n n
C b a S
n n n n n n n
b a C b C a C + + =
1 1
) (
1 n n n n n n
b a C b a C + + =

1
2
3
1
2
3
S
C
a
b
Hnh 4.37. So do mach cong bn phan
S
n
C
n
a
n
b
n
FA
C
n-1
Hnh 4.38. Bo cong ton phan
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 96
C th thuc hin truc tip (so d 4.39) hoc su dung HA d thuc hin FA (so d 4.40):
4.5.3. B tr (Subtractor)
1. B bn tr (B tr bn phn - HS: Half subtractor)
B bn tru thuc hin tru 2 s nhi phn 1 bit.
Quy tc tru nhu sau:
0 - 0 = 0 muon 0
0 - 1 = 1 muon 1
1 - 0 = 1 muon 0
1 - 1 = 0 muon 0
(a) (b) (D) (B)
Trong d a l s bi tru, b l s tru, D l hiu, B l s muon.
Bang trang thi m ta hoat dng :
a b D B
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
Phuong trnh logic :
D = a. b + a .b = ab
B = a .b
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
S
n
C
n
C
n-1
b
n
a
n
Hnh 4.39. Mach cong ton phan truc tip
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
a
n
b
n
C
n-1
C
n
S
n
Hnh 4.40. Thuc hin mach cong ton phan tu bo bn tong
D
B
a
b
HS
Hnh 4.41 Mach tru bn phan
1
2
3
1
2
3
Hnh 4.42. So do logic
a
b
D
B
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 97
Mach tru ny chi cho php tru hai s nhi phn 1 bit m khng thuc hin vic tru hai s nhi phn
nhiu bit.
2. B tr ton phn (FS - Full Subtractor)
Mach c so d khi v bang trang thi m ta hoat dng nhu sau:
Trong d: Bn-1 : S muon cua ln tru truoc d.
Bn : S muon cua ln tru hin tai.
Dn : Hiu s hin tai.
a
n
b
n
B
n-1
D
n
B
n
0 0 0 0 0
0 1 0 1 1
1 0 0 1 0
1 1 0 0 0
0 0 1 1 1
0 1 1 0 1
1 0 1 0 0
1 1 1 1 1
Lp bang Karnaugh v ti thiu ha, ta c:
C 2 cch thuc hin b tru ton phn theo biu thuc logic d tm duoc: hoc thuc hin truc tip
(hnh 4.44) hoc su dung HS d thuc hin FS (hnh 4.45).
00 01 11 10
0
1
0
0 1
0
0
1
1
1
a
n
b
n
B
n-1
D
n
1 1
1 1


+
+ + =
n n n n n n
n n n n n n n
B b a B b a
B b a B b a D
1
=
n n n n
B b a D
00 01 11 10
0
1
1
0 0
0
0
1
1
1
a
n
b
n
B
n-1
B
n
n n n n n n n
b a B b B a B + + =
1 1
) (
1 n n n n n n
b a B b a B + + =

D
n
B
n
a
n
b
n
FS
B
n-1
Hnh 4.43. Mach tru ton phan
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 98
Tu b cng ton phn, ta xy dung mach cng hai s nhi phn nhiu bit bng 2 phuong php:
Ni tip v Song Song.
Phuong php ni tip:
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
a
n
b
n
B
n-1
D
n
B
n
Hnh 4.44. Thuc hin mach tru ton phan truc tip
1
2
3
1
2
3
1
2
3
1
2
3 1
2
3
a
n
b
n
B
n-1
D
n
B
n
Hnh 4.45. Thuc hin FS trn co so HS
a
3
a
2
a
1
a
0
b
3
b
2
b
1
b
0
s
3
s
2
s
1
s
0
FA
DFF
Thanh ghi A
Thanh ghi B
Thanh ghi S
C
-1
Pr
clr
C
3
Ck
Hnh 4.46. Mach cong 2 so nhi phn nhiu bit theo theo kiu noi tip
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 4. H t hp Trang 99
Thanh ghi A chua s A : a
3
, a
2
, a
1
, a
0
Thanh ghi B chua s B : b
3
, b
2
, b
1
, b
0
Thanh ghi S chua s S : s
3
, s
2
, s
1
, s
0
Nhuoc dim cua phuong php ny l thoi gian thuc hin lu.
Phuong php song song:
D khc phuc nhuoc dim d, nguoi ta dng phuong php cng song song (hnh 4.47).
Do tn hiu diu khin Ck (diu khin cng) dng thoi nn thoi gian thuc hin php cng nhanh
hon phuong php ni tip, song do s nho vn phai chuyn ni tip nn anh hung tc d xu l.
Mch cng nh nhanh - Mch cng vi s nh nhn thy truc:
Nguoi ta cai tin mach trn thnh mach cng song song voi s nho nhn thy truoc cn goi l
mach cng nho nhanh (Fast Carry, Carry Look Ahead). Bng cch dua vo su phn tch mach cng
ton phn nhu sau:
Ta c:
S
n
= ( a
n
b
n
) C
n-1
C
n
= a
n
. b
n
+ ( a
n
b
n
)C
n-1
Ta t:
P
n
= a
n
b
n
G
n
= a
n
. b
n
Suy ra:
S
n
= P
n
C
n-1
C
n
= G
n
+ P
n
.C
n-1
Khi n= 0 (LSB):
S
0
= P
0
C
-1
C
0
= G
0
+ P
0
.C
-1
Khi n=1:
S
1
= P
1
C
0
= P
1
( G
0
+ P
0
.C
-1
)
C
1
= G
1
+ P
1
.C
0
= G
1
+ P
1
.(G
0
+ P
0
.C
-1
)
Khi n=2:
S
2
= P
2
C
1
= P
2
[G
1
+ P
1
.(G
0
+ P
0
.C
-1
)]
C
2
= G
2
+ P
2
.C
1
= G
2
+ P
2
.[G
1
+ P
1
.(G
0
+ P
0
.C
-1
)]
Khi n=3:
S
3
= P
3
C
2
= P
3
{G
2
+ P
2
.[G
1
+ P
1
.(G
0
+ P
0
.C
-1
)]}
FA
3 FA
2
FA
1 FA
0
a
3
b
3
c
3
s
3
a
2
b
2
c
2
s
2
a
1
b
1
c
1 s
1
a
0
b
0
c
0
s
0
Hnh 4.47. Mach cong song song, so nho chuyn noi tip
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 100
C
3
= G
3
+ P
3
.C
2
=G
3
+ P
3
.{G
2
+ P
2
.[G
1
+ P
1
.(G
0
+ P
0
.C
-1
) ] }
Dy chnh l co so tnh ton d tao ra s nho C1, C2, C3 v S3 ty thuc vo an, bn. So d khi
mach cng song song 4 bt nho nhanh duoc cho trn hnh 4.48
Trn thuc t nguoi ta d ch tao ra cc vi mach cng nho nhanh, v du: IC 7483.
1o cc P
i
v G
i
1o cc tn hiu nh C
i
1o kt qua tng S
i
B
3
B
2
B
1
B
0
A
3
A
2
A
1
A
0
C
3
G
3
G
2
G
1
G
0
P
3
P
2
P
1
P
0
C
2
C
1
C
0
C
-1
S
3
S
2
S
1
S
0
Hnh 4.48. So do mach cong song song 4 bt nho nhanh
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 101
Chuong 5
HE TUN TU
5.1. KHI NIEM CHUNG
Mach s duoc chia thnh hai loai chnh : H t hop v h tun tu.
Di voi h t hop: tn hiu ng ra o trang thi k tip chi phu thuc vo trang thi hin tai cua
ng vo, m bt chp trang thi hin tai cua ng ra. Nhu vy, khi cc ng vo thay di trang thi (bo
qua thoi gian tr cua tn hiu di qua phn tu logic) th lp tuc ng ra thay di trang thi.
Di voi h tun tu: Cc ng ra o trang thi k tip vua phu thuc vo trang thi hin tai cua ng
vo, dng thoi cn phu thuc trang thi hin tai cua ng ra.
Do d, vn d thit k h tun tu s khc so voi h t hop v co so thit k h tun tu l dua trn
cc Flip - Flop (trong khi vic thit k h t hop dua trn cc cng logic).
Mc khc, di voi h tun tu, khi cc ng vo thay di trang thi th cc ng ra khng thay di
trang thi ngay m cho dn cho dn khi c mt xung diu khin (goi l xung dng h Ck) th lc d
cc ng ra moi thay di trang thi theo cc ng vo. Nhu vy h tun tu cn c tnh dng b v tnh
nho (c kha nng luu tru thng tin, luu tru du liu), nn h tun tu l co so d thit k cc b nho.
5.2. BQ M
5.2.1. Di cuong
B dm duoc xy dung trn co so cc Flip - Flop (FF) ghp voi nhau sao cho hoat dng theo
mt bang trang thi (qui lut) cho truoc.
S luong FF su dung l s hng cua b dm.
B dm cn duoc su dung d tao ra mt dy dia chi cua lnh diu kin, dm s chu trnh thuc
hin php tnh, hoc c th dng trong vn d thu v pht m.
C th phn loai b dm theo nhiu cch:
- Phn loi theo co so cc h dm: B dm thp phn, b dm nhi phn.
Trong d b dm nhi phn duoc chia lm hai loai:
+ B dm voi dung luong dm 2n.
+ B dm voi dung luong dm khc 2n (dm modulo M).
- Phn loi theo hung dm gm: Mach dm ln (dm tin), mach dm xung (dm li),
mach dm vng.
- Phn loi mch dm theo tn hiu chuyn: b dm ni tip, b dm song song, b dm
hn hop.
- Phn loi da vo chc nng diu khin:
+ B dm dng b: Su thay di ng ra phu thuc vo tn hiu diu kin Ck.
+ B dm khng dng b.
Mc d c rt nhiu cch phn loai nhung chi c ba loai chnh: B dm ni tip (khng dng
b), B dm song song (dng b), B dm hn hp.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 102
5.2.2. B dm ni tip
1. Khi nim
B dm ni tip l b dm trong d cc TFF hoc JKFF giu chuc nng cua TFF duoc ghp ni
tip voi nhau v hoat dng theo mt loai m duy nht l BCD 8421. Di voi loai b dm ny, cc
ng ra thay di trang thi khng dng thoi voi tn hiu diu khin Ck (tuc khng chiu su diu khin
cua tn hiu diu khin Ck) do d mach dm ni tip cn goi l mach dm khng dng b.
2. Phn loi
- Dm ln.
- Dm xung.
- Dm ln /xung.
- Dm Modulo M.
a. m ln
y l b dm c ni dung tng dn. Nguyn tc ghp ni cc TFF (hoc JKFF thuc hin chuc
nng TFF) d tao thnh b dm ni tip cn phu thuc vo tn hiu dng b Ck. C 2 truong hop
khc nhau:
- Tn hiu Ck tc dng theo suon xung: TFF hoc JKFF duoc ghp ni voi nhau theo qui
lut sau:
Ck
i+1
= Q
i
- Tn hiu Ck tc dng theo suon ln: TFF hoc JKFF duoc ghp ni voi nhau theo qui lut
sau:
Ck
i+1
=
i
Q
Trong d T lun lun giu o muc logic 1 (T = 1) v ng ra cua TFF dung truoc ni voi ng vo
Ck cua TFF dung sau.
D minh hoa chng ta xt v du v mt mach dm ni tip, dm 4, dm ln, dng TFF.
S luong TFF cn dng: 4 = 2
2
dng 2 TFF.
Truong hop Ck tc dong theo suon xuong (hnh 5.1a):
T
Ck
1
T
Ck
2
Q
2
Q
1
1 1
Ck
Clr
Hnh 5.1a
Ck
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 103
Truong hop Ck tc dong theo suon ln (hnh 5.1b):
Trong cc so d mach ny Clr (Clear) l ng vo xa cua TFF. Ng vo Clr tc dng muc thp,
khi Clr = 0 th ng ra Q cua FF bi xa v 0 (Q=0).
Gian d thoi gian cua mach o hnh 5.1a :
Bang trang thi hoat dng cua mach hnh 5.1a:
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
2
Q
1
Q
2
Q
1
1
2
3
4
0
0
1
1
0
1
0
1
0
1
1
0
1
0
1
0
T
Ck
1
T
Ck
2
Q
2
Q
1
1 1
Ck
Clr
1
Q
Q
2
H 5.1b
Ck
1
2
3 4
5
7
8
1
1 1
1 0 0 0 0
0 0
0 0
1
1
1
1
Ck
Q
1
Q
2
Hnh 5.2a. Gian do thoi gian mach hnh 5.1a
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 104
Gian d thoi gian mach hnh 5.1b :
Bang trang thi hoat dng cua mach hnh 5.1b :
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
2
Q
1
Q
2
Q
1
1
2
3
4
0
0
1
1
0
1
0
1
0
1
1
0
1
0
1
0
b. m xuong
Dy l b dm c ni dung dm giam dn. Nguyn tc ghp cc FF cung phu thuc vo tn hiu
diu khin Ck:
- Tn hiu Ck tc dng suon xung: TFF hoc JKFF duoc nghp ni voi nhau theo qui lut
sau:
Ck
i+1
=
i
Q
- Tn hiu Ck tc dng suon xung: TFF hoc JKFF duoc nghp ni voi nhau theo qui lut
sau:
Ck
i+1
= Q
i
Trong d T lun lun giu o muc logic 1 (T = 1) v ng ra cua TFF dung truoc ni voi ng vo
Ck cua TFF dung sau.
1
2
3 4
5
7
8
1
1 1
1 0 0 0 0
0 0
0 0 1 1
1
1
Ck
Q
1
Q
2
1 1
1
1
0
0 0
0
1
Q
Hnh 5.2b. Gian do thoi gian mach hnh 5.1b
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 105
V d: Xt mt mach dm 4, dm xung, dm ni tip dng TFF.
S luong TFF cn dng: 4 = 2
2
dng 2 TFF.
So d mach thuc hin khi su dung Ck tc dng suon xung v Ck tc dng suon ln ln luot
duoc cho trn hnh 5.3a v 5.3b :
T
Ck
1
T
Ck
2
Q
2
Q
1
1 1
Ck
Clr
H 5.3b
Ck
Hnh 5.3a
Ck
T
Ck
1
T
Ck
2
Q
2
Q
1
1 1
Ck
Clr
1
Q
Q
2
Hnh 5.4a. Gian do thoi gian mach H 5.3a
1
2
3 4
5
7
8
Ck
Q
1
Q
2
1 1
1
1
0
0
0
0
1
Q
0
0
0 0 1 1
1
1
0
0
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 106
Bang trang thi hoat dng cua mach hnh 5.3a:
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
2
Q
1
Q
2
Q
1
1
2
3
4
0
1
1
0
0
1
0
1
1
1
0
0
1
0
1
0
Gian d thoi gian cua mach hnh 5.3b:
Bang trang thi hoat dng cua mach hnh 5.3b :
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
2
Q
1
Q
2
Q
1
1
2
3
4
1
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
c. m ln/xuong:
Goi X l tn hiu diu khin chiu dm, ta quy uoc:
+ Nu X = 0 th mach dm ln.
+ Nu X = 1 th dm xung.
Ta xt 2 truong hop cua tn hiu Ck:
- Xt tn hiu Ck tc dng sun xung:
Lc d ta c phuong trnh logic:
i i i 1 i
Q X Q X .Q X Ck = + =
+
- Xt tn hiu Ck tc dng sun ln:
Lc d ta c phuong trnh logic:
i i i 1 i
Q X X.Q Q . X Ck = + =
+
Hnh 5.4b. Gian do thoi gian mach hnh 5.3b
1
2
3 4
5
7
8
1 1 1 1 0 0 0 0
0
0
0
1 1
1 1
Ck
Q
1
Q
2 0
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 107
d. m modulo M:
Dy l b dm ni tip, theo m BCD 8421, c dung luong dm khc 2
n
.
V d: Xt mach dm 5, dm ln, dm ni tip.
S luong TFF cn dng: V 2
2
= 4 < 5 < 8 = 2
3
dung 3 TFF.
Vy b dm ny s c 3 du ra (ch : S luong FF tuong ung voi s du ra).
Bang trang thi hoat dng cua mach:
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
3
Q
2
Q
1
Q
3
Q
2
Q
1
1
2
3
4
5
0
0
0
0
1
0
0
1
1
0
0
1
0
1
0
0
0
0
1
1/0
0
1
1
0
0
1
0
1
0
1/0
Nu dng 3 FF th mach c th dm duoc 8 trang thi phn bit (000 111 tuong ung 07).
Do d, d su dung mach ny thuc hin dm 5, dm ln, th sau xung Ck thu 5 ta tm cch dua t hop
101 v 000 c nghia l mach thuc hin vic dm lai tu t hop ban du. Nhu vy, b dm s dm tu
000 100 v quay v 000 tro lai, ni cch khc ta d dm duoc 5 trang thi phn bit.
D xa b dm v 000 ta phn tch: Do t hop 101 c 2 ng ra Q
1
, Q
3
dng thoi bng 1 (khc voi
cc t hop truoc d) ( dy chnh l du hiu nhn bit d diu khin xa b dm. V vy d xa b
dm v 000:
- Di voi FF c ng vo Clr tc dng muc 0 th ta dng cng NAND 2 ng vo.
- Di voi FF c ng vo Clr tc dng muc 1 th ta dng cng AND c 2 ng vo.
Nhu vy so d mach dm 5 l so d cai tin tu mach dm 8 bng cch mc thm phn tu cng
NAND (hoc cng AND) c hai ng vo (ty thuc vo chn Clr tc dng muc logic 0 hay muc
logic 1) duoc ni dn ng ra Q
1
v Q
3
, v ng ra cua cng NAND (hoc AND) s duoc ni dn ng
vo Clr cua b dm (cung chnh l ng vo Clr cua cc FF).
Trong truong hop Clr tc dng muc thp so d mach thuc hin dm 5 nhu trn hnh 5.5 :
T
Ck
1
T
Ck
2
Q
2
Q
1
1 1
Ck
Clr
T
Ck
3
Q
3
1
Hnh 5.5. Mach dm 5, dm ln
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 108
Y
1
C1
R1
Y
VCC
1
Hnh 5.7. Mach
Reset muc 0
Ch :
Do trang thi cua ng ra l khng bit truoc nn d mach c th dm tu trang thi ban du l 000
ta phai dng thm mach xa tu dng ban du d xa b dm v 0 (cn goi l mach RESET ban
du). Phuong php thuc hin l dng hai phn tu thu dng R v C.
Trn hnh 5.7 l mach Reset muc 0 (tc dng muc 0). Mach hoat dng nhu sau: Do tnh cht
din p trn tu C khng dt bin duoc nn ban du moi cp ngun Vcc th V
C
= 0 ( ng ra Clr = 0
v mach c tc dng Reset xa b dm, sau d tu C duoc nap din tu ngun qua din tro R voi thoi
hng nap l = RC nn din p trn tu tng dn, cho dn khi tu C nap dy th din p trn tu xp xi
bng Vcc ng ra Clr = 1, mach khng cn tc dung reset.
Ch khi thit k: Voi mt FF, ta bit duoc thoi gian xa (c trong
Datasheet do nh san xut cung cp), do d ta phai tnh ton sao cho thoi
gian tu C nap din tu gi tri ban du dn gi tri din p ngung phai lon
hon thoi gian xa cho php th moi dam bao xa duoc cc FF.
Mach cho php xa b dm tu dng (H 5.8) v bng tay (H 5.9):
Ck
Q
1
Q
2
1
1 1
1
0
0
0
0
0 0
0 0
0
1
1
1 1
1
0
0
0
1
2
3
4
5 7 8
9
10 6
0
0
0
0
0 0
0 0
1
Q
3
Hnh 5.6. Gian do thoi gian mach dm 5, dm ln
T
Ck
1
T
Ck
2
Q
2 Q
1
1
1
Ck
Clr
T
Ck
3
Q
3
1
Y
1
R1
C1
Y
VCC
1
Hnh 5.8. Mach cho php xa bo dm tu dong
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 109
T
Ck
1
T
Ck
2
Q
2 Q
1
1
1
Ck
Clr
T
Ck
3
Q
3
1
Y
1
R1
C1
Y
VCC
1
Y
1
Hnh 5.9. Mach cho php xa bo dm tu dong v bng tay
Uu dim cua b dm ni tip: Don gian, d thit k.
Nhuoc dim: Voi dung luong dm lon, s luong FF su dung cng nhiu th thoi gian tr tch luy
kh lon. Nu thoi gian tr tch luy lon hon mt chu ky tn hiu xung kch th lc by gio kt qua
dm s sai. Do d, d khc phuc nhuoc dim ny, nguoi ta su dung b dm song song.
5.2.3. B dm song song
1. Khi nim
B dm song song l b dm trong d cc FF mc song song voi nhau v cc ng ra s thay di
trang thi duoi su diu khin cua tn hiu Ck. Chnh v vy m nguoi ta cn goi b dm song song
l b dm dng b.
Mach dm song song duoc su dung voi bt ky FF loai no v c th dm theo qui lut bt ky
cho truoc. V vy, d thit k b dm dng b (song song) nguoi ta dua vo cc bang du vo kch
cua FF.
2. Mch thc hin
Di voi b dm song song d dm ln hay dm xung, hoc l dm Modulo M (dm ln/dm
xung) du c cch thit k chung v khng phu thuc vo tn hiu Ck tc dng suon ln, suon
xung, muc 0 hay muc 1.
Cc buoc thuc hin :
- Tu yu cu thuc t xy dung bang trang thi hoat dng cua b dm.
- Dua vo bang du vo kch cua FF tuong ung d xy dung cc bang hm gi tri cua cc
ng vo du liu (DATA) theo ng ra.
- Dng cc phuong php ti thiu d ti thiu ha cc hm logic trn.
- Thnh lp so d logic.
V d:
Thit k mach dm dng b, dm 5, dm ln theo m BCD 8421 dng JKFF.
Truoc ht xc dinh s JKFF cn dng: V 2
2
= 4 < 5 < 8 = 2
3
dng 3 JKFF c 3 ng ra Q
1
,
Q
2
, Q
3
.
Ta c bang trang thi m ta hoat dng cua b dm nhu sau:
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 110
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
3
Q
2
Q
1
Q
3
Q
2
Q
1
1 0 0 0 0 0 1
2 0 0 1 0 1 0
3 0 1 0 0 1 1
4 0 1 1 1 0 0
5 1 0 0 0 0 0
O chuong 3 chng ta d xy dung duoc bang du vo kch cho cc FF v d c duoc bang du
vo kch tng hop nhu sau:
Q
n
Q
n+1
S
n
R
n
J
n
K
n
T
n
D
n
0 0 0 X 0 X 0 0
0 1 1 0 1 X 1 1
1 0 0 1 X 1 1 0
1 1 X 0 X 0 0 1
Tu d ta suy ra bang hm gi tri cua cc ng vo data theo cc ng ra nhu sau :
Xung Trng thi hin ti Trng thi k tip
vo Q
3
Q
2
Q
1
Q
3
Q
2
Q
1
J
3
K
3
J
2
K
2
J
1
K
1
1 0 0 0 0 0 1 0 X 0 X 1 X
2 0 0 1 0 1 0 0 X 1 X X 1
3 0 1 0 0 1 1 0 X X 0 1 X
4 0 1 1 1 0 0 1 X X 1 X 1
5 1 0 0 0 0 0 X 1 0 X 0 X
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 111
Lp bang Karnaugh d ti thiu ha ta duoc:
Luu : Khi thit k tnh ton ta dng cc phuong php ti thiu d dua v phuong trnh logic ti
gian. Nhung trong thuc t th di lc khng phai nhu vy. V du: K
3
= 1, K
3
= Q
3
hay K
3
=
2
Q
du dng, nhung khi lp rp thuc t ta chon K3 =
2
Q d trnh dy ni di gy nhiu cho mach.
So d logic: Hnh 5.10
00 01 11
10
0
1
Q
3
Q
2
Q
1
J
1
x
0 1 1
x x x x
J
1
= Q
1
00 01 11
10
0
1
Q
3
Q
2
Q
1
K
1
x
x x x
1 1 x x
K
1
= 1 = Q
1
00 01 11
10
0
1
Q
3
Q
2
Q
1
J
2
x
0 0 x
1 x x x
J
2
= Q
1
00 01 11
10
0
1
Q
3
Q
2
Q
1
K
2
x
0 x 0
x 1 x x
K
2
= Q
1
00 01 11
10
0
1
Q
3
Q
2
Q
1
J
3
x
X 0 0
0 1 x x
J
2
= Q
1
Q
2
00 01 11
10
0
1
Q
3
Q
2
Q
1
K
3
x
0 x 0
x 1 x x
K
3
= 1 = Q
3
=
2 1
Q Q =
Ck
1
Q
1
1
Q
J
1
K
1
Ck
2
Q
2
2
Q
J
2
K
2
Ck
3
Q
3
3
Q
J
3
K
3
Q
3
Q
2
Q
1
C
k
Clr
3
Q
Hnh 5.10. So do mach dm ln dm 5, dm song song
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 112
Giai thch hot dng cua b dm:
- Ban du dng mach RC xa v 0 Q
1
= Q
2
= Q
3
= 0.
J
1
= K
1
=1 ; J
2
= K
2
= Q
2
= 0 ; J
3
= 0, K
3
= 1.
- Khi Ck
1
: Cc trang thi ng ra du thay di theo trang thi ng vo DATA truoc d.
J
1
= K
1
= 1 Q
1
=
0
1
Q = 1.
J
2
= K
2
= 1 Q
2
=
0
2
Q = 0.
J
3
= 0, K
3
= 1 Q
3
= 1 bt chp trang thi truoc d.
(Hoc J
3
= 0, K
3
= 0 Q
3
=
0
3
Q = 0) Q
3
Q
2
Q
1
= 001.
Lc d: J
1
= K
1
=
3
Q = 1; J
2
=K
2
= Q
1
= 1; J
3
=Q
2
.Q
1
= 0, K
3
= 1.
(Hoc K
3
= Q
3
= 0).
- Khi Ck
2
:
J
1
= K
1
= 1 Q
1
=
1
1
Q = 0.
J
2
= K
2
= 1 Q
2
=
1
2
Q = 1.
J
3
= 0, K
3
= 1 Q
3
= 0.
(Hoc J
3
= 0, K
3
= 0 Q
3
=
1
3
Q = 0) Q
3
Q
2
Q
1
= 010.
Lc d: J
1
= K
1
=
3
Q = 1 ; J
2
= K
2
= Q
1
= 0; J
3
= 0, K
3
= 1.
(Hoc K
3
=
2
Q = 0).
- Khi Ck
3
:
J
1
= K
1
= 1 Q
1
=
2
1
Q = 1.
J
2
= K
2
= 0 Q
2
=
0
2
Q = 1.
J
3
= 0, K
3
= 1 Q
3
=0 bt chp trang thi truoc d.
(Hoc J
3
= 0, K
3
= 0 Q
3
=
2
3
Q = 0 ) Q
3
Q
2
Q
1
= 011.
Lc d: J
1
= K
1
=
3
Q = 1; J
2
= K
2
= Q
1
= 1; J
3
= Q
2
.Q
1
= 1, K
3
= 0.
(Hoc K
3
= 1).
- Khi Ck
4
:
J
1
= K
1
= 1 Q
1
=
3
1
Q = 0.
J
2
= K
2
= 1 Q
2
=
3
2
Q = 0.
J
3
= 0, K
3
= 1 Q
3
=1 bt chp trang thi truoc d.
(Hoc J
3
= 0, K
3
= 0 Q
3
=
0
3
Q = 0 ) Q
3
Q
2
Q
1
= 100.
Lc d: J
1
= K
1
=
3
Q = 1; J
2
= K
2
= Q
1
= 0; J
3
= Q
2
.Q
1
= 0, K
3
= 1.
(Hoc K
3
= Q
3
= 0).
- Khi Ck
5
:
J
1
= K
1
= 1 Q
1
=
4
1
Q = 0.
J
2
= K
2
= 1 Q
2
=
4
2
Q = 0.
J
3
= 0, K
3
= 1 Q
3
=0 bt chp trang thi truoc d.
Q
3
Q
2
Q
1
= 000 .
Lc d: J
1
= K
1
=
3
Q = 1; J
2
= K
2
= Q
1
= 0; J
3
= Q
2
.Q
1
= 0, K
3
= 1.
Mach tro v trang thi ban du.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 113
5.2.4. Dm thun ngh|ch
D thit k mach cho php vua dm ln vua dm xung, ta thuc hin nhu sau:
- Cch 1: Lp hm J
ln
, J
xung
, K
ln
, K
xung
(gia su ta dng JKFF).
Goi X l tn hiu diu khin. Xt 2 truong hop:
+ Nu quy uoc X = 0: dm ln; X = 1: dm xung.
Lc d ta c phuong trnh logic:
J = X. J
ln
+ X. J
xung
K = X. K
ln
+ X. K
xung
+ Nu quy uoc X = 1: dm ln; X = 0: dm xung.
Lc d ta c phuong trnh logic:
J = X. J
ln
+ X. J
xung
K = X. K
ln
+ X.K
xung
- Cch 2: Lp bang trang thi tng hop cho ca dm ln v dm xung.
Xung vo X Trng thi h.ti Trng thi k J
3
K
3
J
2
K
2
J
1
K
1
1
2
Sau d thuc hin cc buoc ging nhu b dm dng b.
5.2.5. Dm hn hp
B dm hn hop l b dm m trong d bao gm ca dm ni tip v dm song song. Dy l b
dm ch tao kh nhiu trong thuc t v kha nng ung dung cua b dm hn hop kh lon so voi b
dm song song.
V d: B dm 7490 bn trong bao gm 2 b dm d l b dm 2 ni tip v b dm 5 song
song. Hai b dm ny tch roi nhau. Do d, ty thuc vo vic ghp hai b dm ny lai voi nhau m
mach c th thuc hin duoc vic dm thp phn hoc chia tn s.
Trung hp 1: 2 ni tip, 5 song song (hnh 5.11).
J
K
Ck
1
Ck
2
B dm 5
song song
B dm
2 ni
tip
Q
1
Q
2
Q
3 Q
4
1
Ck
Clr
Hnh 5.11. Bo dm 2 noi tip ghp voi bo dm 5 song song
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 114
Q
1
cua b dm 2 giu vai tr xung Ck cho b dm 5 song song.
Gian d thoi gian cua 2 ni tip 5 song song (hnh 5.12) :
Nhn xt: Cch ghp ny dng d dm thp phn, nhung khng dng d chia tn s.
Bang trang thi m ta hoat dng cua mach:
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
4
Q
3
Q
2
Q
1
Q
4
Q
3
Q
2
Q
1
1 0 0 0 0 0 0 0 1
2 0 0 0 1 0 0 1 0
3 0 0 1 0 0 0 1 1
4 0 0 1 1 0 1 0 0
5 0 1 0 0 0 1 0 1
6 0 1 0 1 0 1 1 0
7 0 1 1 0 0 1 1 1
8 0 1 1 1 1 0 0 0
9 1 0 0 0 1 0 0 1
10 1 0 0 1 0 0 0 0
Truong hop 2: 5 song song, 2 ni tip.
Q
3
cua b dm 5 song song giu vai tr xung Ck cho b dm 2.
Ck
Q
1
Q
2
1
1
1
1
0
0
0
0
0 0
0 0
0
1
1
1 1
1
0
0
0
1
2
3 4 5 7 8
9
10 6
0
1 1
0
0
0 0 0
1
Q
3
0 0 0
0 0
0
0
0
1
1
Q
4
Hnh 5.12. Gian do thoi gian 2 noi tip ghp voi 5 song song
Ck
1
B dm 5
song song
Q
1
Q
2
Q
3
Q
4
J
K
Ck
2
B dm 2
ni tip
Ck
Clr
Hnh 5.13. Bo dm 5 song song ghp voi 2 noi tip
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 115
Gian d thoi gian cua 5 song song ni tip 2.
Nhn xt: Cch ghp ny khng duoc dng d dm thp phn, nhung lai thch hop cho vic
chia tn s.
Bang trang thi m ta hoat dng cua mach :
Xung vo Trang thi hin tai Trang thi k tip
Ck Q
4
Q
3
Q
2
Q
1
Q
4
Q
3
Q
2
Q
1
1 0 0 0 0 0 0 0 1
2 0 0 0 1 0 0 1 0
3 0 0 1 0 0 0 1 1
4 0 0 1 1 0 1 0 0
5 0 1 0 0 0 1 0 1
6 1 0 0 0 1 0 0 1
7 1 0 0 1 1 0 1 0
8 1 0 1 0 1 0 1 1
9 1 0 1 1 1 1 0 0
10 1 1 0 1 0 0 0 0
5.3. THANH GHI DJCH CHUYEN V B NH
5.3.1. Khi nim
Thanh ghi dich v b nho du duoc ung dung trong luu tru du liu, trong d thanh ghi do kha
nng luu tru cua n c han nn chi duoc su dung nhu b nho tam thoi (luu kt qua cc php tnh).
Cn b nho c kha nng luu tru cc bit du liu kh lon, v mc cu tao b nho duoc xy dung trn
co so cc thanh ghi (Nhiu thanh ghi hop thnh b nho)
5.3.2. Thanh ghi d|ch chuyn
1. Khi nim
Thanh ghi duoc xy dung trn co so cc DFF (hoc cc FF khc thuc hin chuc nng cua DFF)
v trong d mi DFF s luu tru 1 bit du liu.
Ck
Q
1
Q
2
1
1
1
1
0
0
0
0
0 0
0 0
0
1
0
1 1
1
0
0
0
1
2
3
4
5 7 8
9
10 6
1 0 0
0
0
0 0 0
1
Q
3
0 0 0
0 0
1 1 1
1
0
Q
4
Hnh 5.14. Gian do thoi gian dm 5 song song ghp 2 noi tip
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 116
D tao thanh ghi nhiu bit, nguoi ta ghp nhiu DFF lai voi nhau theo qui lut nhu sau:
- Ng ra cua DFF dung truoc duoc ni voi ng vo DATA cua DFF sau (D
i+1
= Q
i
) ( thanh
ghi c kha nng dich phai.
- Hoc ng ra cua DFF dung sau duoc ni voi ng vo DATA cua DFF dung truoc (D
i
=
Q
i+1
) ( thanh ghi c kha nng dich tri.
2. Phn loi
Phn loai theo s bit du liu luu tru: 4 bit, 5 bit, 8 bit, 16 bit, 32 bit. Di voi thanh ghi lon 8 bit,
nguoi ta khng dng ho TTL m dng ho CMOS.
Phn loai theo huong dich chuyn du liu trong thanh ghi:
- Thanh ghi dich tri.
- Thanh ghi dich phai.
- Thanh ghi vua doi phai vua doi tri.
Phn loai theo ng vo du liu:
- Ng vo du liu ni tip.
- Ng vo du liu song song: Song song khng dng b, song song dng b.
Phn loai theo ng ra:
- Ng ra ni tip.
- Ng ra song song.
- Ng ra vua ni tip vua song song.
3. Nhp d liu vo FF
Nhp du liu vo FF bng chn Preset (Pr): (xem hnh 5.15)
- Khi Load = 0 : Cng NAND 3 v 2 kha ng vo Pr = Clr = 1
FF tu do du liu A khng nhp vo duoc FF.
- Khi Load = 1 : Cng NAND 2 v 3 mo, ta c: Pr = A, Clr = A.
Nu A = 0 Pr = 1, Clr = 0 Q = A = 0.
Nu A = 1 Pr = 0, Clr = 1 Q = A = 1.
Vy Q = A du liu A duoc nhp vo FF.
Tuy nhin, cch ny phai dng nhiu cng logic khng kinh t v phai
dng chn Clr l chn xa nn phai thit k xa dng b.
D khc phuc nhung nhuoc dim d dng mach nhu trn hnh 5.16 :
- Chn Clr d trng tuong duong voi muc logic 1.
- Khi Load = 0 : cng NAND kha Pr = Clr =1 FF tu do. Du
liu khng duoc nhp vo FF.
- Khi Load = 1 : cng NAND mo Pr = A.
Gia su ban du : Q = 0.
Nu A = 0 Pr = 1, Clr = 1 Q = Q
0
= 0.
Nu A = 1 Pr = 0, Clr = 1 Q = 1.
Vy Q = A Du liu A duoc nhp vo FF.
Ch : Phuong php ny di hoi truoc khi nhp phai xa FF v 0.
Pr Clr
A
Load
Hnh 5.16
Pr Clr
A
Load
1
2
3
Hnh 5.15
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 117
V d: Xt mt thanh 4 bit c kha nng doi phai (hnh 5.17).
Trong d:
- DSR (Data Shift Right): Ng vo Data ni tip (ng vo dich phai).
- Q
1
, Q
2
,Q
3
, Q
4
: cc ng ra song song.
D giai thch hoat dng cua mach, ta dua vo bang trang thi cua DFF.
Gia su ban du : Ng vo nhp Load = 1 A, B, C, D duoc nhp vo thanh ghi dich:
Q
1
= A, Q
2
= B, Q
3
= C, Q
4
= D.
Hoat dng dich phai cua thanh ghi:
- Xt FF
1
: D = DSR
1
, Q
1
= A.
Nu DSR
1
= 0 Q = 0 ; nu DSR
1
= 1 Q = 1.
Kt lun: Sau mt xung Ck tc dng suon xung th Q
1
= DSR
1
.
- Lc d FF
2
, FF
3
,FF
4
: Q
2
= A, Q
3
= B, Q
4
= C.
Tuc l sau khi Ck tc dng suon xung th ni dung trong thanh ghi duoc doi sang phai 1 bit.
Sau 4 xung, du liu trong thanh ghi duoc xut ra ngoi v ni dung DFF duoc thay th bng cc du
liu tu ng vo DATA ni tip DSR
1
, DSR
2
, DSR
3
, DSR
4
.
Ta c bang trang thi hoat dng cua mach:
Trng thi hin ti Trng thi k Xung
vo Q
1
Q
2
Q
3
Q
4
Q
1
Q
2
Q
3
Q
4
1 A B C D DSR
1
A B C
2 DSR
1
A B C DSR
2
DSR
1
A B
3 DSR
2
DSR
1
A B DSR
3
DSR
2
DSR
1
A
4 DSR
3
DSR
2
DSR
1
A DSR
4
DSR
3
DSR
2
DSR
1
Truong hop ng ra Q duoc ni voi ng vo du liu ni tip DSR (hnh 5.18).
Ck
1
Q
1
1
Q
J
1
K
1
Ck
2
Q
2
2
Q
J
2
K
2
Ck
3
Q
3
3
Q
J
3
K
3
Load
Q
2
Q
1
C
k
Clr
Ck
4
Q
4
4
Q
J
4
K
4
Q
3
Q
4
A
B C D
DSR
Hnh 5.17. Thanh ghi dich phai
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 118
Ta c bang trang thi hoat dng cua mach hnh 5.18:
Trng thi hin ti Trng thi k Xung
vo
Q
1
Q
2
Q
3
Q
4
Q
1
Q
2
Q
3
Q
4
1 0 0 0 0 1 0 0 0
2 1 0 0 0 1 1 0 0
3 1 1 0 0 1 1 1 0
4 1 1 1 0 1 1 1 1
5 1 1 1 1 0 1 1 1
6 0 1 1 1 0 0 1 1
7 0 0 1 1 0 0 0 1
8 0 0 0 1 0 0 0 0
Dy l mach duoc ung dung nhiu trong thuc t.
5.3.3. B nh
1. Cc khi nim
- T bo nh (Memory cell)
D l thit bi hay mach din tu dng d luu tru 1 bit.
V du: FF d luu tru 1 bit, tu din khi nap din th luu tru 1 bit, hoc mt dim trn bng tu.
- T nh (Memory word )
L nhm cc bit o trong mt b nho.
V du: Mt thanh ghi gm 8 DFF c th luu tru tu nho l 8 bit.
Trong thuc t, kch thuoc cua tu nho c th thay di trong cc loai my tnh tu 4 ( 64 bit.
- Byte:
Mt nhm tu nho 8 bit.
- Dung lung b nh
Chi kha nng luu tru cua b nho.
V du: 1K = 2
10
; 2K = 2
11
; 4K = 2
12
; 1M = 2
20
.
- D|a chi
Dng d xc dinh cc vng cua cc tu trong b nho.
Xt b nho gm 16 ngn nho tuong duong 16 tu, ta cn dng 4 duong dia chi (2
4
= 16 c 4
duong dia chi). Nhu vy c mi quan h giua dia chi v dung luong b nho.
Ck
1
Q
1
1
Q
J
1
K
1
Ck
2
Q
2
2
Q
J
2
K
2
Ck
3
Q
3
3
Q
J
3
K
3
Pr Pr
C
k
Clr
Ck
4
Q
4
4
Q
J
4
K
4
Pr
Pr
DSR
Hnh 5.18.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 119
V du : D quan l duoc b nho c dung luong l 8 Kbytes th cn 13 duong dia chi.
- Hot dng dc (READ)
Doc l xut du liu tu b nho ra ngoi.
D doc ni dung mt nho cn thuc hin:
+ Dua dia chi tuong ung vo cc duong dia chi A.
+ Khi tn hiu diu khin doc tc dng th lc by gio du liu chua trong cc ngn nho tuong
ung voi vng dia chi xc dinh o trn s duoc xut ra ngoi.
- Hot dng vit (WRITE)
Vit l ghi du liu tu bn ngoi vo bn trong b nho.
Mun vit phai thuc hin:
+ Dt cc dia chi tuong ung ln cc duong dia chi.
+ Dt du liu cn vit vo b nho ln cc duong du liu.
+ Tch cuc tn hiu diu khin ghi.
Khi ghi du liu tu bn ngoi vo bn trong b nho th du liu cu s mt di v duoc thay th bng
du liu moi.
- B nh khng bay hoi
Chi loai b nho m du liu khng mt di khi mt ngun din.
- B nh bay hoi
Chi loai b nho luu tru du liu khi cn ngun din v khi mt ngun din th du liu s bi mt.
- RAM(Random Access Memory)
B nho truy xut ngu nhin, doc vit ty , cn duoc goi l RWM (Read/Write Memory). Dy
l loai b nho cho php doc du liu chua bn trong ra ngoi v cho php nhp du liu tu bn
ngoi vo trong.
- ROM(Read Only Memory)
B nho chi doc. Chi cho php doc du liu trong ROM ra ngoi m khng cho php du liu ghi
du liu tu bn ngoi vo trong b nho.
- SM (Static Memory)
B nho tinh l loai b nho luu tru du liu cho dn khi mt din p cung cp m khng cn lm
tuoi du liu bn trong. V du: SRAM.
- DM (Dynamic Memory)
B nho dng l loai b nho c th mt du liu khi din p cung cp chua bi mt, v vy cn c co
ch lm tuoi du liu. Uu dim cua loai b nho ny l tc d truy xut nhanh, gi thnh ha. V du:
DRAM.
- B nh tun t
V du: Dia mm, dia cung, bng tu.
2.ROM (Read Only Memory)
- MROM (Mask ROM): Duc lp trnh boi nh san xut.
Uu v nhuoc dim: Chi c tnh kinh t khi san xut hng loat nhung lai khng phuc hi duoc khi
chuong trnh bi sai hong.
- PROM (Programmable ROM): Dy l loi ROM cho php lp trnh boi nh san xut. Nhuoc
dim: Nu hong khng phuc hi duoc.
- EPROM (Erasable PROM): D l loi PROM c th xa v lp trnh lai. C hai loai
EPROM: EPROM duoc xa bng tia cuc tm (Ultralviolet EPROM) v EPROM xa bng xung
din (Electrical EPROM). Tui tho cua EPROM phu thuc vo thoi gian xa.
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Bi giang KY THUAT S Trang 120
Ung dung cua ROM: Chua chuong trnh diu khin vo ra cua my tnh, PC, P, C, ROM BIOS
(ROM Basic Input/Output System). Dng d chua k tu: ROM k tu. Dng d chua cc bin di
hm.
3.RAM (Random Access Memory)
DRAM: RAM dng, lm vic theo hai pha. Mt pha chon dia chi hng, mt pha chon dia chi ct.
Do d, s chn dia chi thuc hin trn IC nho hon mt nua so voi RAM hoc ROM.
SRAM : RAM tinh, c tc d truy xut nhanh hon DRAM, do d gi thnh ch tao dt hon.
4.T chc b nh
Gia su CPU hay P c 16 duong dia chi v 8 duong du liu. Nu dng d quan l b nho th
quan l duoc dung luong b nho ti da l 64 KBytes (2
16
= 64K).
Gia su 64 KBytes phn thnh cc loai sau: 1 ROM 8K, v 7 RAM 8K.
D chon ln luot tung b nho d xut du liu v v cn thua 3 duong dia chi l A
13
, A
14
, A
15
nn
ta dng mach giai m tu 3 8.
Trn hnh 5.21 l so d mach giai m dia chi dng IC 74138.
D
0
D
1
D
2
D
3
D
4
D
5
D
6
D
7
A
1
A
2
A
3
A
4
CS
ROM
16 x 8
Hnh 5.19. So do khoi cua ROM 16x8 = 128 bit
cs
13 8
8
ROM
13
cs
13 8
8
RAM
1
13
cs
13 8
8
RAM
2
13
cs
13 8
8
RAM
3
13
cs
13 8
RAM
4
cs
13 8
RAM
5
cs
13 8
RAM
6
cs
13 8
RAM
7
8
16
Hnh 5.20. To chuc bo nho
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark
Chuong 5. H tun t Trang 121
Y
0
(CS / ROM )
Y
1
( CS / RAM
1
)
Y
2
( CS / RAM
2
)
Y
3
( CS / RAM
3
)
Y
4
( CS / RAM
4
)
Y
5
( CS / RAM
5
)
Y
6
( CS / RAM
6
)
Y
7
( CS / RAM
7
)
A
13
A
14
A
15
IC 74138
3 8
Hnh 5.21. Mach giai m dia chi
Ban d b nho cua h thng:
A
15
A
14
A
13
A
12
A
11
A
10
A
9
A
8
A
7
A
6
A
5
A
4
A
3
A
2
A
1
A
0
D|a chi Hex
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 H
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 F F F H
R
O
M
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 H
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 F F F H
R
A
M
1
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 H
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 5 F F F H
R
A
M
2
0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 H
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 F F F H
R
A
M
3
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 H
1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 9 F F F H
R
A
M
4
1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 A 0 0 0 H
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 B F F F H
R
A
M
5
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C 0 0 0 H
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 D F F F H
R
A
M
6
1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 E 0 0 0 H
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 F F F F H
R
A
M
7
PDF Watermark Remover DEMO : Purchase from www.PDFWatermarkRemover.com to remove the watermark