Professional Documents
Culture Documents
Instructor: Weidong Shi (Larry), PhD Computer Science Department University of Houston
Today
Numbers Logic gates
How to arrange 1000 apples in 10 boxes so that any number of apples can be picked in terms of boxes?
A Computer System
What are there inside a computer?
CPU
FSB (Front-Side Bus)
North Bridge
DMI (Direct Media I/F)
South Bridge
Digital
Only knows 1 and 0
CPU (Core 2 Duo): 1.325 V Chipsets: 1.45 V Peripheral devices: 3.3V, 1.5V
1.325V
1
Not determined
0V
7
0
time
Logic Levels
Define a range of voltages to represent 1 and 0 Define different ranges for outputs and inputs to allow for noise in the system
Noise is anything that degrades the signal For example, a gate (driver) could output a 5 volt signal but, because of losses in the wire and other noise, the signal could arrive at the receiver with a degraded value, for example, 4.5 volts
Noise Driver 5V
8
Receiver 4.5 V
Logic Levels
Driver Receiver
VDD
Input Characteristics Logic High Input Range Forbidden Zone VIH VIL Logic Low Input Range
Noise Margin NMH = VOH VIH NML = VIL VOL 9
NMH
NML
GND
Digital
music
10
Digital Computer
DSP OUTPUT
ADC 1010
1001
DAC
Number Systems
Analog information (video, sound etc) is converted to a digital format for processing Computer processes information in digital Since digital knows 1 and 0, we use different number systems in computer
Binary and Hexadecimal numbers
12
13
14
111
1000
Power of 2
20 21 22 23 24 25 26 27 = = = = = = = = 28 = 29 = 210 = 211 = 212 = 213 = 214 = 215 =
16
Power of 2
20 21 22 23 24 25 26 27 = = = = = = = = 1 2 4 8 16 32 64 128 28 = 256 29 = 512 210 = 1024 211 = 2048 212 = 4096 213 = 8192 214 = 16384 215 = 32768
* Handy to memorize up to 29
17
Each column of a hex number has 16x the weight of the previous column
Hexadecimal number has 16 as its base ex) 2ED16 = 2 x 162 + E (14) x 161 + D (13) x 160 = 74910
18
Number Systems
Hex Number 0 1 Decimal Equivalent 0 1 Binary Equivalent 0000 0001
2
3 4 5 6
2
3 4 5 6
0010
0011 0100 0101 0110
7
8 9 A B
7
8 9 10 11
0111
1000 1001 1010 1011
C
D E F
12
13 14 15 19
1100
1101 1110 1111
20
Number Conversions
Convert 7510 to binary number
2 2
75 37 2 18 2 9 2 4 2 2
2 1
0
byte
10010110
nibble
CEBF9AD7
most significant byte
22
KB, MB, GB
In computer, the basic unit is byte (B) And, we use KB, MB, GB many many many times
210 = 1024 = 1KB (kilobyte) 220 = 1024 x 1024 = 1MB (megabyte) 230 = 1024 x 1024 x 1024 = 1GB (gigabyte) 240 250 260 270 = = = = 1TB (terabyte) 1PB (petabyte) 1EB (exabyte) 1ZB (zettabyte)
Quick Checks
222 =?
22 220 = 4 Mega
Suppose that you have 2GB main memory in your computer. How many bits you need to address (cover) 2GB?
21 230 = 2 GB, so 31 bits
24
Addition Decimal
carries
Binary
carries
1001 + 0101
1011 + 0110
0001
1110
26
Overflow
Digital systems operate on a fixed number of bits Addition overflows when the result is too big to fit in the available number of bits Example:
add 13 and 5 using 4-bit numbers
28
Sign/Magnitude Numbers
1 sign bit, N-1 magnitude bits Sign bit is the most significant (left-most) bit
Negative number: sign bit = 1 Positive number: sign bit = 0
29
Sign/Magnitude Numbers
Signed Decimal 0 1 2 3 -0 -1 Sign/Magnitude Numbers Unsigned Decimal 0 1 2 3 4 5
-2
-3
110
111
6
7
So, hardware designers like it and uses 2s complement number system when designing CPU
32
Method:
Example
-7: 2s complement number of +7 0111 1000 + 1 1001 (+7) (flip all the bits) (add 1) (-7)
33
37
Sign-Extension
Sign bit is copied into most significant bits.
Number value remains the same
Examples
4-bit representation of 3 = 0011 8-bit sign-extended value: 00000011 4-bit representation of -5 = 1011 8-bit sign-extended value: 11111011
38
Zero-Extension
Zeros are copied into most significant bits.
Number value may change.
Examples
4-bit value = 0011 8-bit zero-extended value: 00000011 4-bit value = 1011 8-bit zero-extended value: 00001011
39
Unsigned
Sign/Magnitude Twos Complement
For example, 4-bit representation:
[0, 2N-1]
[-(2N-1-1), 2N-1-1] [-2N-1, 2N-1-1]
-8
-7
-6
-5
-4
-3
-2
-1
10 11 12 13 14 15
Unsigned
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
0000 1000
40
Online Tools
Ciscos binary teaching game
Set and reset bits to display a binary representation of specific decimal numbers
http://forums.cisco.com/CertCom/game/binary_game_page.htm
Number converter
And online number converter from binary to hex and decimal and back.
http://www.free-test-online.com/binary/signed_converter.html
Logic Gates
Logic gates perform logic functions such as NOT (inversion), AND, OR, NAND, NOR, etc.
Single-input logic gates NOT gate, buffer Two-input logic gates AND, OR, XOR, NAND, NOR, XNOR etc Multiple-input logic gates AND, OR, XOR, NAND, NOR, XNOR etc
43
F
Y
0 1 1 0 1 0 0 1
NOT
A Y=A A 0 1 Y 1 0 Y
BUF
A Y=A A 0 1 Y 0 1 Y
45
AND
A B Y = AB A 0 0 1 1 B 0 1 0 1 Y 0 0 0 1
A 0 0 1 1
OR
Y
A B Y Y=A+B B 0 1 0 1 Y 0 1 1 1
46
XOR
A B Y Y=A+B A 0 0 1 1 B 0 1 0 1 Y 0 1 1 0 A B
NAND
Y Y = AB A 0 0 1 1 B 0 1 0 1 Y 1 1 1 0 A B
NOR
Y Y=A+B A 0 0 1 1 B 0 1 0 1 Y 1 0 0 0 A B
XNOR
Y Y=A+B A 0 0 1 1 B 0 1 0 1 Y
47
BUF
Y
A B
AND
Y Y = AB B 0 1 0 1 Y 0 0 0 1
OR
A B Y Y=A+B A 0 0 1 1 B 0 1 0 1 Y 0 1 1 1
Transistors!
48
Transistor
Transistor is a three-ported voltage-controlled switch Electronic switch, a path exists when the Switch Control is closed
If (Open) OUTPUT = unknown ; Switch is open (OFF) Else OUTPUT = INPUT ; Switch is closed (ON)
Analogy water through a pipe: the gate acts like a valve, allowing/preventing a flow between the source and drain
Switch Control
INPUT
OUTPUT
Silicon
Transistors are built out of silicon. Silicon is not a conductor Silicon crystal is an insulator -- no free electrons. Doping transforms a silicon crystal from a good insulator into a viable conductor; hence, the name semiconductor. Metal oxide silicon (MOS) transistors: Adding phosphorus produces n-type transistor Adding boron produces p-type transistor
50
Silicon powder
Cross Section
An N-Channel Metal-Oxide Semiconductor Field Effect Transistor (MOSFET)
Drain Gate Source nMOS Gate 0 volts 2.9 volts Path Open Conduct
CMOS
VDD = 2.9 volts
p-type
In Out
2.9 volts 0 volts
In
Out
n-type
GND
CMOS is used to build the vast majority of all transistors fabricated today
pMOS transistors pass good 1s, so connect source to VDD nMOS transistors pass good 0s, so connect source to GND
VDD
Y
P1 Y N1 GND
P1 N1
Y
1
0
ON
OFF
OFF
ON
54
NAND Gate
NAND
A B Y = AB A 0 0 1 1 B 0 1 0 1 Y 1 1 1 0 Y
P2 A B
P1 Y N1 N2
A 0 0 1 1
B 0 1 0 1
P1 ON ON OFF OFF
P2 ON OFF ON OFF
55
N1 OFF OFF ON ON
N2 OFF ON OFF ON
Y 1 1 1 0
Analytical Engine
Charles Babbages Analytical Engine Mechanical decimal general purpose computer Steam engine, punchcards, gears CPU complete by death in 1871 The first complete Babbage Engine was completed in London in 2002, 153 years after it was designed.
Z1
1938 Konrad Zuse: the Z1 First binary programmable computer, completely mechanical Punchcard input, processing implemented with metal plates
58
Programmable Water
Paul Blikstein
59
Next Class
Combinational Logic