Beruflich Dokumente
Kultur Dokumente
Chapter 4
urpose o! Chapter
Learn ho" computers represent and store in!ormation# Learn "hy computers represent in!ormation that "ay# Learn "hat the basic building de$ices in a computer are, and ho" those de$ices are used to store in!ormation# Learn ho" to build more comple% de$ices using the basic de$ices#
Computers:
Te%t, numbers, images, sounds
+ynapses Neurons
Te%t, numbers, images, sounds
Binary Numbers
4
Te%t
Characters 2letters, digits, symbols4
9ther
Graphics, +ound, :ideo, ;
Numbering +ystems
*e use the decimal numbering system
16 digits: 6, 1, 2, &, 4, 1, 3, <, =, 8 7or e%ample: 12
<
base
%166
B %16
base
>1
26 6 B %1 B 6
> 14
16
Bits
The t"o binary digits 6 and 1 are !reCuently re!erred to as bits# 0o" many bits does a computer use to store an integer/
)ntel entium C > &2 bits
1&
6 6 6 6 6 6 6 6 6 6 6 6 1 1 1 6
+ign bit#
B14 in signed magnitude representation
1 6 6 6 6 6 6 6 6 6 6 6 1 1 1 6
514 in signed magnitude representation
roblems @rithmetic logic is comple% There are t"o Heros: 6666666666666666 1666666666666666
14
6 6 6 6 6 6 6 6 6 6 6 6 1 1 1 6
B14 in 1Es complement representation
1 1 1 1 1 1 1 1 1 1 1 1 6 6 6 1
514 in 1Es complement representation
roblems @lthough arithmetic is much simpler, there are t"o Heros: 6666666666666666 1111111111111111
11
6 6 6 6 6 6 6 6 6 6 6 6 1 1 1 6
B14 in 2Es complement representation
1 1 1 1 1 1 1 1 1 1 1 1 6 6 1 6
514 in 2Es complement representation
13
Look at an e%ample:
0o" do "e store the number 1#<1/
1<
2& =
22 4
21 2
26 1
251
252
4B
6 1 6
18
B #16111 % 2B&
6 1 6 1 1 1 6 6 6 6 6 6 6 6 1 1
'%ponent 23 bits4
26
(epresenting Te%t
0o" can "e represent te%t in a binary !orm/
@ssign to each character a positi$e integer $alue 2!or e%ample, @ is 31, B is 33, ;4 Then "e can store the numbers in their binary !ormM
Binary
66166666 66166661 66166616 ; 66116666 66116661 66116616 ;
Char )nteger
@ B C ; % y H ; 31 33 3< ; 126 121 122 ;
Binary
61666661 61666616 61666611 ; 61111666 61111661 61111616 ;
22
2&
e%ample
C+c 61666611 61616611 61166611 112
C + c
Notice the di!!erence bet"een @+C)) E112E and binary representation o! 11216: 6111 6666
24
0e%adecimal
Decimal 6 1 2 & 4 1 3 < Binary 6666 6661 6616 6611 6166 6161 6116 6111 6 1 2 & 4 1 3 < Hex Decimal = 8 16 11 12 1& 14 11 Binary 1666 1661 1616 1611 1166 1161 1116 1111 = 8 @ B C A ' 7 Hex
e%: 112 > 6111 6666 > <613 123 > 6111 1116 > <'13
21
*hy is that/
'lectrical de$ices "ork best in a bistable en$ironment, that is, there are only t"o separate states 2e#g# on,o!!4# *hen using binary numbers, the computers only need to represent t"o digits: 6 and 1
23
2<
Transistor
The binary storage de$ice computers use is called a transistor:
Can be in a stable 9n,9!! state 2current !lo"ing through or not4 Can sense in "hich state it is in 2measure electrical !lo"4 Can s"itch bet"een states 2takes O 16 billionths o! a secondM4 @re e%tremely small 2can !it G 16 million,cm2 , shrinking as "e speak4
The transistor is the elementary building block o! computers, much in the same "ay as cells are the elementary building blocks o! the human bodyM
2=
9ut 2'mitter4
The control line 2base4 is used to open,close s"itch:
)! $oltage applied then s"itch closes, other"ise is open
7uture Ae$elopment/
Transistors
Technology impro$ing, allo"ing us to pack the transistors more and more densely 2:L+), DL+), ;4
Quantum Computing/
&6
&1
Boolean Logic
Boolean logic is a branch o! mathematics that deals "ith rules !or manipulating the t"o logical truth $alues true and !alse# Named a!ter George Boole 21=1151=344
@n 'nglish mathematician, "ho "as !irst to de$elop and describe a !ormal system to "ork "ith truth $alues#
&2
Boolean '%pressions
@ Boolean e%pression is any e%pression that e$aluates to either true or !alse# )s 1+3 a Boolean e%pression/
No, doesnNt e$aluate to either true or !alse#
&&
Boolean 9perators
*e use the three !ollo"ing operators to construct more comple% Boolean e%pressions
@NA 9( N9T
'%amples:
? G 166 @NA ?O216 @>>6 9( BG166
&4
'%amples
?G6 @NA ?O26 ?>16 @NA ?GR
'%amples
?G6 9( ?O26 ?>16 9( ?GR
'%amples
N9T ?G6 N9T ?GR
&8
Gates
@ gate is an electronic de$ice that operates on a collection o! binary inputs to produce a binary output# *e "ill look at three di!!erent kind o! gates, that implement the Boolean operators:
@NA 9( N9T
46
@lternati$e Notation
*hen "e are re!erring to gates, "e use a di!!erent notation !rom Boolean e%pressions:
a @NA b a 9( B N9T a aTb aBb Wa a UU b a VV b a ab ab Ma
41
Gates
Types o! gates
@NA 9( N9T ?9( N@NA N9(
42
4&
+ummary so !ar
(epresenting in!ormation
'%ternal $s# )nternal representation
44
41
43
Computer Circuits
4<
urpose
*e ha$e looked at so !ar ho" to build logic gates !rom transistors# Ne%t "e "ill look at ho" to build circuits !rom logic gates, !or e%ample:
@ circuit to check i! t"o numbers are eCual# @ circuit to add t"o numbers#
4=
Circuit
@ circuit is a collection o! interconnected logic gates:
that trans!orms a set o! binary inputs into a set o! binary outputs, and "here the $alues o! the outputs depend only on the current $alues o! the inputs
48
16
1 0
1 0
C)(CD)T
1 0 0 1
)N DT
9DT DT
11
12
'%ample
*hat are the output $alues c and d gi$en input $alues a>1, b>6/
1
1&
The diagrams "e "ere looking at are called circuit diagrams# (elationship bet"een circuit diagrams and Boolean e%pressions:
'$ery Boolean e%pression can be represented pictorially as a circuit# '$ery output in a circuit diagram can be "ritten as a Boolean e%pression#
14
(NOT b)
11
(a + b)
(a + b) b
'%ample
*hat Boolean e%pression describes the output/
a b
ab ab + ab a b ab
1<
Control Circuits
+o !ar "e ha$e seen t"o types o! circuits:
Logical 2 is a > b /4 @rithmetic 2 c > a B b4
Computers use many di!!erent logical 2G, O, G># O>, M>, ;4, and arithmetic 2B,5,L,,4 circuits# There are also di!!erent kind o! circuits that are essential !or computers control circuits
*e "ill look at t"o di!!erent kind o! control circuits, multiple%ors and decoders#
1=
Fultiple%or
@ multiple%or circuit has:
2N 1 N input lines 2numbered 6, ;, 2N514 output line selector lines
The selector lines are used to choose "hich o! the input signals becomes the output signal:
+elector lines are interpreted as an N5bit integer The signal on the input line "ith the corresponding number becomes the output signal#
18
Fultiple%or 2cont#4
6 1 6 1 6 1 2 & Fultiple%or 1 6
6 1
1 6
36
Aecoder
@ decoder circuit has:
N 2N input lines 2numbered 6, 1, ;#, N514 output line 2numbered 6, 1, ; 2N514
*orks as !ollo"s:
The N input lines are interpreted as a N5bit integer $alue# The output line corresponding to the integer $alue is set to 1, all other to 6
31
Aecoder 2cont#4
6 6 6 6 1 6 6 6
6 6 1
0 1 2
0 1 2 3 4 ! 7
Aecoder
100 " 4
32
+ummary
*e looked at ho" computers represent data:
)nternal $s '%ternal (epresentation Basic storage unit is a binary digit - bit Aata is represented internally as binary data# Dse the binary number system#
3&
+ummary 2cont#4
*e looked at the basic building blocks used in computers:
Binary +torage Ae$ice > Transistor
34