Professional Documents
Culture Documents
Chapter 1 <1>
Chapter 1 :: Topics
Background
The Game Plan
The Art of Managing Complexity
The Digital Abstraction
Number Systems
Logic Gates
Logic Levels
CMOS Transistors
Power Consumption
Chapter 1 <2>
Background
Microprocessors have revolutionized our world
Cell phones, Internet, rapid advances in medicine, etc.
Chapter 1 <3>
Abstraction
Hiding details when
they arent important
programs
device drivers
instructions
registers
datapaths
controllers
adders
memories
AND gates
NOT gates
amplifiers
filters
transistors
diodes
electrons
Chapter 1 <4>
Chapter 1 <5>
Chapter 1 <6>
Number Systems
Decimal numbers
1's column
10's column
100's column
1000's column
5374 10 =
Binary numbers
1's column
2's column
4's column
8's column
11012 =
Chapter 1 <7>
Number Systems
Decimal numbers
1's column
10's column
100's column
1000's column
three
hundreds
seven
tens
four
ones
Binary numbers
1's column
2's column
4's column
8's column
11012 = 1 23 + 1 22 + 0 21 + 1 20 = 1310
one
eight
one
four
no
two
Chapter 1 <8>
one
one
Powers of Two
20 =
21 =
22 =
23 =
24 =
25 =
26 =
27 =
28 =
29 =
210 =
211 =
212 =
213 =
214 =
215 =
Chapter 1 <9>
Powers of Two
28 = 256
20 = 1
29 = 512
21 = 2
210 = 1024
22 = 4
211 = 2048
23 = 8
212 = 4096
24 = 16
213 = 8192
25 = 32
214 = 16384
26 = 64
215 = 32768
27 = 128
Handy to memorize up to 210
Chapter 1 <10>
Chapter 1 <11>
Chapter 1 <12>
Number Conversion
Decimal to binary conversion:
Convert 100112 to decimal
Chapter 1 <13>
Number Conversion
Decimal to binary conversion:
Convert 100112 to decimal
161 + 80 + 40 + 21 + 11 = 1910
Chapter 1 <14>
Chapter 1 <15>
Chapter 1 <16>
Hexadecimal Numbers
Hex Digit
Decimal Equivalent
10
11
12
13
14
15
Binary Equivalent
Chapter 1 <17>
Hexadecimal Numbers
Hex Digit
Decimal Equivalent
Binary Equivalent
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
10
1010
11
1011
12
1100
13
1101
14
1110
15
1111
Chapter 1 <18>
10010110
most
significant
bit
least
significant
bit
byte
10010110
nibble
Bytes
CEBF9AD7
most
significant
byte
least
significant
byte
Chapter 1 <19>
Addition
Decimal
Binary
11
3734
+ 5168
8902
carries
11
1011
+ 0011
1110
carries
Chapter 1 <20>
1001
+ 0101
1011
+ 0110
Chapter 1 <21>
1
1001
+ 0101
1110
111
1011
+ 0110
10001
Chapter 1 <22>
Substraction
Substract the
following 4-bit
binary numbers
1
1001
+ 0101
1110
Substract the
following 4-bit
binary numbers
111
1011
+ 0110
10001
Chapter 1 <23>
Chapter 1 <24>
Sign/Magnitude Numbers
1 sign bit, N-1 magnitude bits
Sign bit is the most significant (left-most) bit
Positive number: sign bit = 0 A : {a N 1 , a N 2 ,L a2 , a1 , a0 }
n 2
Negative number: sign bit = 1
a
i
A = ( 1)
n 1
a 2
i
i =0
Chapter 1 <25>
Sign/Magnitude Numbers
1 sign bit, N-1 magnitude bits
Sign bit is the most significant (left-most) bit
Positive number: sign bit = 0 A : {a N 1 , a N 2 ,L a2 , a1 , a0 }
n 2
Negative number: sign bit = 1
a
i
A = ( 1)
n 1
a 2
i
i =0
Chapter 1 <26>
Sign/Magnitude Numbers
Problems:
Addition doesnt work, for example -6 + 6:
1110
+ 0110
10100 (wrong!)
Two representations of 0 ( 0):
1000
0000
Chapter 1 <27>
Chapter 1 <28>
A = an 1 ( 2n 1 ) + ai 2i
i =0
A = an 1 ( 2n 1 ) + ai 2i
i =0
Chapter 1 <31>
Chapter 1 <32>
Chapter 1 <33>
1110
+ 0011
Chapter 1 <35>
111
1110
+ 0011
10001
Chapter 1 <36>
Chapter 1 <37>
Sign-Extension
Example 1:
Example 2:
4-bit representation of -5 = 1011
8-bit sign-extended value: 11111011
Chapter 1 <38>
Zero-Extension
Example 1:
4-bit value =
00112 = 310
8-bit zero-extended value: 00000011 = 310
Example 2:
4-bit value =
1011 = -510
8-bit zero-extended value: 00001011 = 1110
Chapter 1 <39>
Range
Unsigned
[0, 2N-1]
Sign/Magnitude
[-(2N-1-1), 2N-1-1]
Twos Complement
[-2N-1, 2N-1-1]
-7
-6
-5
-4
-3
-2
-1
Unsigned
11
12
13
14
15
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
1000 1001 1010 1011 1100 1101 1110 1111 0000 0001 0010 0011 0100 0101 0110 0111
10
0000
1000
Chapter 1 <40>
Two's Complement
Sign/Magnitude
Comparisons of Sign-and-Magnitude
and Complements
Example: 4-bit signed number (positive values)
Value
Sign-andMagnitude
1s
Comp.
2s
Comp.
+7
+6
+5
+4
+3
+2
+1
+0
0111
0110
0101
0100
0011
0010
0001
0000
0111
0110
0101
0100
0011
0010
0001
0000
0111
0110
0101
0100
0011
0010
0001
0000
Comparisons of Sign-and-Magnitude
and Complements
Example: 4-bit signed number (negative values)
Value
Sign-andMagnitude
1s
Comp.
2s
Comp.
-0
-1
-2
-3
-4
-5
-6
-7
-8
1000
1001
1010
1011
1100
1101
1110
1111
-
1111
1110
1101
1100
1011
1010
1001
1000
-
1111
1110
1101
1100
1011
1010
1001
1000
Exercise:
2m
b. -8 to +7
c. -8 to +8
d. -15 to +15
e. -16 to +15
b. 36
c. -36
d. -27
e. -28