ﺟﺎﻣﻌﺔ اﻟزﻗﺎزﯾق –
ﻛﻠﯾﺔ اﻟﮭﻧدﺳﺔ – ﻗﺳم ھﻧدﺳﺔ اﻟﺣﺎﺳﺑﺎت واﻟﻣﻧظوﻣﺎت
CSE100
1 اﻟﺣﺎﺳﺑﺎت واﻟﺑرﻣﺟﺔ
ﻣﺣﻣد ﻧورﻋﺑداﻟﺟواد/د
[email protected]
https://mnourgwad.github.io/CSE100
ﻣﻘﺪﻣﮫ ﻟﻘﻮاﻟﺐ ﺑﻨﺎء اﻟﺤﺎﺳﺐ: 4 اﻟﻤﺤﺎﺿﺮة
1
Copyright ©2016 Dr.Ing. Mohammed Nour Abdelgwad Ahmed as part of the course work and learning material. All Rights Reserved.
Where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Quiz
2
اﻟﻤﺤﺎﺿﺮة اﻟﺮاﺑﻌﮫ اﻷھﺪاف ﻟﻠﯿﻮم
ﻣﻘﺪﻣﮫ ﻟﻘﻮاﻟﺐ ﺑﻨﺎء اﻟﺤﺎﺳﺐ
اﻟﺒﻮاﺑﺎت اﻟﻤﻨﻄﻘﯿﺔ
اﻟﺠﺒﺮ اﻟﺒﻮﻟﻲ وﻗﻮاﻋﺪه
اﻟﺪواﺋﺮ اﻟﻤﻨﻄﻘﯿﺔ
3
Binary Logic
• Definition of Binary Logic
• Binary logic consists of binary variables and a set of logical operations.
• The variables are designated by letters of the alphabet, such as A, B, C, x, y,
z, etc, with each variable having two and only two distinct possible values: 1
and 0,
• Three basic logical operations: AND, OR, and NOT.
4
Switching Circuits
AND OR
5
اﻟﻘﻮاﻟﺐ اﻟﺮﺋﯿﺴﯿﮫ ﻟﺒﻨﺎء اﻟﺤﺎﺳﺐ
AND
x z (1اﻟﺑواﺑﺎت اﻟﻣﻧطﻘﯾﺔ Logic Gates
y
(2ﺟدول اﻟﺣﻘﯾﻘﮫ Truth Table
اﻟدﺧل اﻟﺧرج
x y z (3اﻟﺗﻌﺑﯾر اﻟﺑوﻟﻲ
0 0 0 Boolean Expressions
0 1 0
1 0 0
1 1 1
z=x•y=xy 6
اﻟﻘﻮاﻟﺐ اﻟﺮﺋﯿﺴﯿﮫ ﻟﺒﻨﺎء اﻟﺤﺎﺳﺐ
AND OR NOT
اﻟدﺧل اﻟﺧرج اﻟدﺧل اﻟﺧرج x z
x y z x y z 0 1
0 0 0 0 0 0 1 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
z=x•y=xy z=x+y ’z = x = x
x z x
y z x z
y
7
اﻟﻤﻨﻄﻖ اﻟﺜﻨﺎﺋﻲ )(Binary Logic
• اﻟﺑواﺑﺎت اﻟﻣﻧطﻘﯾﮫ Logic gates:
8
اﻟﻘﻮاﻟﺐ اﻟﺮﺋﯿﺴﯿﮫ ﻟﺒﻨﺎء اﻟﺤﺎﺳﺐ
NAND NOR XOR
اﻟﺪﺧﻞ اﻟﺨﺮج اﻟﺪﺧﻞ اﻟﺨﺮج اﻟﺨﺮج اﻟﺪﺧﻞ
x y z x y z x y z
0 0 1 0 0 1 0 0 0
0 1 1 0 1 0 0 1 1
1 0 1 1 0 0 1 0 1
1 1 0 1 1 0 1 1 0
𝒚 𝒁 = 𝒙 . 𝒚𝒁=𝒙+ 𝒚⨁𝒙 = 𝒁
9
Summary
10
ﺟﺒﺮ ﺑﻮل وﻗﻮاﻋﺪه
11
اﻟﺠﺒﺮ اﻟﺒﻮﻟﻲ
§ ﻗﺎم ﺑوﺿﻊ ھذا اﻟﻌﻠم ﺟورج ﺑول ﻓﻲ اﻟﻘرن اﻟﺛﺎﻣن ﻋﺷر
ﻣﻌﺗﻣد ﻋﻠﻲ اﻟﺗﻌﺎﻣل ﻣﻊ اﻟﻣﺗﻐﯾرات اﻟﺛﻧﺎﺋﯾﮫ.
§ﯾﺳﺗﺧدم ﻓﻲ ﺗﺑﺳﯾط اﻟدوال)اﻟﻣﻌﺎدﻻت( اﻟﺗﻲ ﺗﻌﺑر ﻋﻧﮭﺎ
ﺑﺎﻟﻣﺗﻐﯾرات اﻟﺛﻧﺎﺋﯾﺔ.
§اﻟﻣﺗﻐﯾرات اﻟﺛﻧﺎﺋﯾﮫ :ھﻲ اﻟﺗﻲ ﺗﻘﺑل ﻗﯾم ﺛﻧﺎﺋﯾﮫ ﻛــ
)(1/0 or true/false or yes/no or high/low
12
ﻗﻮاﻋﺪ ﺟﺒﺮ ﺑﻮل
𝐴=𝐴*1 𝐴+1=1
𝐴*0=0 𝐴=𝐴+0
𝐴=𝐴*𝐴 𝐴=𝐴𝐴+
𝐴 * 𝐴̅ = 0 𝐴 + 𝐴̅ = 1
𝐴 = )𝐴(𝐵 + 𝐵0 𝐵 𝐴 + 𝐴̅𝐵 = 𝐴 +
𝐴 = 𝐴⨁12 ﻧظرﯾﺔ دي ﻣورﺟﺎن:
𝐴 = 𝐴⨁0 1) xy=x+y
2) x+y=x y 13
أﻣﺜﻠﮫ
ﺑﺎﺳﺗﺧدام ﺟﺑر ﺑول أﺛﺒﺖ أن :
( A+B) ( A+B) =AB+AB
𝐴̅ + 𝐵0 + 𝐴 + 𝐵 = 𝐴̅𝐴 + 𝐴̅𝐵 +A𝐵0+𝐵0B
= 0 + 𝐴̅𝐵 +A𝐵0+0
= 𝐴̅𝐵 +A𝐵0
14
أﻣﺜﻠﮫ
ﺑﺎﺳﺗﺧدام ﺟﺑر ﺑول ﺑﺳط اﻟﺻﯾﻎ اﻻﺗﯾﮫ:
( )
) F= A+B ( A+C
𝐹 = 𝐴𝐴 + 𝐴𝐶 +A𝐵0+𝐵0C
= 𝐴 + 𝐴𝐶 +A𝐵0+𝐵0C
= 𝐴 1 + 𝐶+𝐵0 +𝐵0C
= 𝐴+𝐵0C
15
أﻣﺜﻠﮫ
أوﺟد ﻗﯾﻣﺔ Fﻟﺟﻣﯾﻊ اﻟﻘﯾم اﻟﻣﺣﺗﻣﻠﮫ ﻟﻠﻣﺗﻐﯾرات:
F=ABC + AB
اﻟﺣل
•ﻻﺑد ﻣن ﺗﻛﻣﻠﺔ ﻛل اﻟﺣدود ) ﺑﻣﻌﻧﻲ ان ﯾظﮭر ﻛل اﻟﻣﺗﻐﯾرات
ﻓﻲ ﻛل ﺣد(
16
أﻣﺜﻠﮫ
اﻟدﺧل اﻟﺧرج
A B C F
0 0 0 0 •وﻣن ﺛم ﺗﺻﺑﺢ اﻟﻣﻌﺎدﻟﺔ ھﻲ:
0 0 1 0
0
0
1
1
0
1
0
0
F=ABC+AB C+C ( )
1 0 0 0
=ABC+ABC+ABC
1 0 1 1 101 111 110
1 1 0 1
1 1 1 1
17
أﻣﺜﻠﮫ
طﺑق ﻧظرﯾﺔ دي ﻣورﺟﺎن
(
AB CD + AC )
( )
𝐵 AB CD + AC = 𝐴̅ +
𝐷 0 + 𝐶̅ +
̅𝐶 2 𝐴 +
𝐷𝐴 = 𝐴̅ + 𝐵0 + 𝐴𝐶̅ +𝐷 ̅𝐶 2 + 𝐶̅ +
2
𝐷𝐴 = 𝐴̅ + 𝐵0 +̅𝐶 2 +
𝐷 = 𝐴̅ + 𝐵0 +
̅𝐶 2 +
18
Conversion of Boolean Function
Truth table Logic Circuit
19
اﻟﺪواﺋﺮ اﻟﻤﻨﻄﻘﯿﮫ
20
أﻣﺜﻠﮫ
أرﺳﻢ اﻟﺪاﺋﺮة اﻟﻤﻨﻄﻘﯿﮫ اﻟﺘﻲ ﺗﺤﻘﻖ اﻟﺼﯿﻐﮫ اﻟﺘﺎﻟﯿﮫ
ﻗﺒﻞ اﻟﺘﺒﺴﯿﻂ وﺑﻌﺪه ,ﺛﻢ ﻗﺎرن ﺑﯿﻦ اﻟﺪاﺋﺮﺗﯿﻦ ﻣﻦ
ﺣﯿﺚ ﻋﺪد اﻟﺒﻮاﺑﺎت اﻟﻤﺴﺘﺨﺪﻣﮫ؟
(
F= ABC + ABC + ABC )
21
اﻟﺟﻣﻊ اﻟﺛﻧﺎﺋﻲ
:ﺣﺎﻻت اﻟﺠﻤﻊ اﻟﺜﻨﺎﺋﻲ ھﻲ
0+0=0 Sum = 0, carry out = 0
0+1=1 Sum = 1, carry out = 0
1+0=1 Sum = 1, carry out = 0
1 + 1 = 10 Sum = 0, carry out = 1
: ﺑﺳﺑب اﻟﻧﺗﯾﺟﮫ اﻟﺳﺎﺑﻘﮫ ﻓﺈن اﻟﻧﺎﺗﺞ ﯾﺻﺑﺢcarry in = 1 ﻋﻧدﻣﺎ ﯾﻛون اﻟـ
1 + 0 + 0 = 01 Sum = 1, carry out = 0
1 + 0 + 1 = 10 Sum = 0, carry out = 1
1 + 1 + 0 = 10 Sum = 0, carry out = 1
1 + 1 + 1 = 11 Sum = 1, carry out = 1
اﻟﺠﺎﻣﻊ اﻟﻨﺼﻔﻲ
Half adder
23
S=AB+AB º A Å B اﻟﺠﻤﻊ اﻟﻨﺼﻔﻲ:
C=AB
اﻟدﺧل اﻟﺧرج
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
24
اﻟﺠﺎﻣﻊ اﻟﻜﺎﻣﻞ
Full adder
25
اﻟﺧرج :اﻟﺠﺎﻣﻊ اﻟﻜﺎﻣﻞ
اﻟدﺧل
A B Cin S Cout
S=ABCin +ABCin
0 0 0 0 0
0 0 1 1 0 +ABCin +ABCin
0 1 0 1 0
0 1 1 0 1 Cout =ABCin +ABCin
1 0 0 1 0
1 0 1 0 1 +ABCin +ABCin
1 1 0 0 1
1 1 1 1 1
26
:اﻟﺠﺎﻣﻊ اﻟﻜﺎﻣﻞ
S=A Å B Å Cin
Cout = ( A Å B) Cin +AB
27
اﻟﺟﺎﻣﻊ اﻟﻛﺎﻣل
وﺿﺢ ﻛﯾف ﯾﺗم ﻋﻣﻠﯾﺔ ﺟﻣﻊ 1+0+1؟
1 1
0
0
1
1
1
0
اﻟﺟﺎﻣﻊ اﻟﻛﺎﻣل
وﺿﺢ ﻛﯾف ﯾﺗم ﻋﻣﻠﯾﺔ ﺟﻣﻊ 1+0+1؟
S 1 S Sum
1 A s A s 0
0 B Cout
0 B Cout
1
Cout
1
اﻟﺟﺎﻣﻊ اﻟﻛﺎﻣل
وﺿﺢ ﻛﯾف ﯾﺗم ﻋﻣﻠﯾﺔ ﺟﻣﻊ 1+0+1؟
1 0
1
1
0
اﻟﺟﻣﻊ اﻟﻣﺗوازي
ﯾﻣﻛن دﻣﺞ ﻋدد nﻣن دواﺋر اﻟﺟﺎﻣﻊ اﻟﻛﺎﻣل ﻟﻌﻣل ﺟﻣﻊ ﻣﺗوازي
ﻷرﻗﺎم ﺛﻧﺎﺋﯾﮫ ﻣﻛون ﻣن n bitﻋﻠﻲ ﺳﺑﯾل اﻟﻣﺛﺎل ﻛﻣﺎ ھو
ﻣوﺿﺢ : 4 bit
A4 B4 A3 B3 A2 B2 A1 B1
C0
A B Cin A B Cin A B Cin A B Cin
Cout S Cout S Cout S Cout S
C4
C3 C2 C1
S4 S3 S2 S1
اﻟﻄﺮح/ داﺋﺮة اﻟﺠﻤﻊ
Addition/Subtraction
32
داﺋﺮة اﻟﺠﻤﻊ /اﻟﻄﺮح
اﺳﺘﺨﺪام اﻟﺠﻤﻊ ﺑﺪﻻ ﻣﻦ اﻟﻄﺮح:
§ﯾﻤﻜﻦ إﺳﺘﺨﺪام اﻟﺠﻤﻊ اﻟﻤﺘﻮازي ﻹﺟﺮاء ﻋﻤﻠﯿﺔ طﺮح ﻣﻦ ﺧﻼل
ﻗﻠﺐ )ﻣﺘﻤﻢ ( اﻟﻌﺪد اﻟﻤﻄﺮوح ,ﺛﻢ إﺿﺎﻓﺔ 1إﻟﻲ Cin
§ﻛﯿﻒ ﯾﺘﻢ ﻗﻠﺐ اﻟﻌﺪد ﻣﻦ ﺧﻼل اﻟﺒﻮاﺑﺎت؟
2
𝑨
1
33
داﺋﺮة اﻟﺠﻤﻊ /اﻟﻄﺮح
34