This preview shows page 1. Sign up to view the full content.
Unformatted text preview: CS231: Computer Architecture I
Summer 2003 June 16, 2003 ©20002003 Howard Huang 1 What is computer architecture about?
Computer architecture is the study of building entire computer systems.
Processor Memory Input/Output There are numerous factors to consider, many of which are conflicting.
— Performance, price and reliability are obviously vital concerns.
— Systems should be expandable to accommodate future developments,
but must also be compatible with existing technology.
— Power consumption is especially important in the growing market of
portable devices such as cell phones, PDAs, and MP3 players. June 16, 2003 Introduction to CS231 2 An example of architects hard at work Processor!
Input!
Output!
Storage!
Compatibility!
Networking!
Power consumption! June 16, 2003 Introduction to CS231 3 Why should you care? 1Year AlienCare TollFree 24/7 Phone Support with Onsite
Service
Alienware FullTower Case (420Watt PS)  Conspiracy Blue
AlienIce™ Video Cooling System  Astral Blue
Alienware Cable Management System
Intel® Pentium® 4 Processor 3.0GHz 800MHz FSB w/ 512KB
Cache & HyperThreading
Intel® Desktop Board D875PBZ  Intel 875P Motherboard
512MB DDR SDRAM PC3200  2 x 256MB Module
80GB Seagate Barracuda 7200.7 ATA100 2MB Cache Quantity 1
16 DVDROM  Black w/Software MPEG2 Decoder
NVIDIA GeForce™ FX 5900 Ultra 256MB 8x AGP w/DVI & SVideo
Sound Blaster® Audigy 2  6.1
Integrated Intel Pro/1000 CT Gigabit Ethernet Adapter w/CSA
Microsoft Internet Keyboard  Space Black
Microsoft IntelliMouse Explorer 3.0  USB  Standard Color
Microsoft® Windows® XP Home Edition
Free Alienware® TShirt  Black
Bonus 12Month Subscription to Computer Games Magazine!
AlienAutopsy: Automated Technical Support Request System Price: $2,099.00 Computer science majors are often expected to know something about
hardware and computer architecture.
— What are caches, DDR SDRAMs, and AGPs?
— Is a 3.0GHz processor or a 7200RPM hard disk worth it?
June 16, 2003 Introduction to CS231 4 Architecture and programming
Understanding architecture helps to explain why programming languages
are designed the way they are.
— What happens when we compile our source code?
— Why is computer arithmetic sometimes wrong?
— What is a bus error or segmentation fault?
You can also learn how to make your code run faster.
— Where and how you store your data makes a big difference.
— Just rearranging the order of statements can sometimes help!
A lot of software development requires knowledge of architecture.
— Compilers generate optimized code for specific processors.
— Operating systems manage hardware resources for applications.
— Good I/O systems are important for databases and networking. June 16, 2003 Introduction to CS231 5 What is CS231 about?
There’s a lot of stuff to cover, and it takes more than one semester!
In CS231 and CS232, we learn architecture bottomup, from the simplest
bits and binary operations all the way up to complete systems.
CS231 is divided into roughly three parts.
— We start with combinational circuits, which can compute relatively
simple functions. Boolean algebra is the mathematical foundation
upon which we build and analyze circuits.
— Sequential circuits are more complex because they have memory.
We’ll see additional analysis and design techniques, based on state
machines.
— Finally, we will use both combinational and sequential circuits to
build a simple, but complete, processor. June 16, 2003 Introduction to CS231 6 Important themes in CS231 Choosing a good data representation can increase system performance,
lower resource utilization and improve accuracy.
We rely on mathematical techniques to describe and analyze circuits.
Abstraction and hierarchical designs are critical to control complexity.
There are often many design tradeoffs to consider.
— Simplicity and low cost usually lead to low performance.
— Higher performance comes with higher cost and greater complexity.
These themes also pervade software development, and every other area
of engineering.
June 16, 2003 Introduction to CS231 7 Helpful hints for CS231
Remember the big picture.
What are we trying to accomplish, and why?
Read the textbook.
Not everybody likes it, but it covers everything we talk about in class and
has additional examples. Try it out if you have difficulty with any of the
course material.
Talk to each other.
You can learn a lot from other students, both by asking and answering
questions. Find some good partners for the assignments, and make sure
you all understand what’s going on.
Help us help you.
Come to lectures, sections and office hours. Send email or post on the
newsgroup. Ask lots of questions! Check out the smashing web page:
http://wwwcourses.cs.uiuc.edu/~cs231 June 16, 2003 Introduction to CS231 8 Representing information
For the rest of the day, we’ll discuss how computers use
voltages to represent information.
— In modern desktop processors the voltage is limited
to around 1.5V to reduce power consumption.
— However, it’s hard to measure voltages precisely.
It’s more convenient for hardware designers to interpret
analog voltages as just two discrete, or digital, values.
How can two lousy values be useful for anything?
— We can represent arbitrary numbers with sequences
of just 0s and 1s.
— We can also interpret voltages as “false” and “true”
instead, and work with logical operations. June 16, 2003 Introduction to CS231 1
0 1.5V 0V 9 Decimal review
Decimal numbers consist of digits from 0 to 9, each with a weight.
1
100 6
10 2
1 . 3
1/10 7
5
1/100 1/1000 digits
weights Notice that the weights are all powers of the base, which is 10.
1
102 6
101 2
100 . 3
101 7
102 5
103 digits
weights To find the decimal value of a number, you can multiply each digit by its
weight and sum the products:
(1 × 102) + (6 × 101) + (2 × 100) + (3 × 101) + (7 × 102) + (5 × 103) = 162.375 June 16, 2003 Introduction to CS231 10 Binary numbers
Binary, or base 2, numbers consist of only the digits 0 and 1. The weights
are now powers of 2.
For example, consider the binary number 1101.01:
1
23 1
22 0
21 1
20 . 0
21 1
22 binary digits, or bits
weights in decimal The decimal value of 1101.01 is computed just like before: (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20) + (0 × 21) + (1 × 22) =
8
+
4
+
0
+
1
+
0
+ 0.25 = 13.25
Some powers of 2
20
21
22
23
June 16, 2003 =
=
=
= 1
2
4
8 24
25
26
27 =
=
=
= 16
32
64
128 28 = 256
29 = 512
210 = 1024 Introduction to CS231 11 Converting decimal to binary
To convert a decimal integer into binary, keep dividing by two until the
quotient is 0. Then collect the remainders in reverse order.
To convert a decimal fraction into binary, keep multiplying the fractional
part by two until it becomes 0. Collect the integers in forward order.
An example will make it all clear. Let’s convert 162.375 to binary.
162
81
40
20
10
5
2
1 ⁄2
⁄2
⁄2
⁄2
⁄2
⁄2
⁄2
⁄2 =
=
=
=
=
=
=
= 81
40
20
10
5
2
1
0 rem 0
rem 1
rem 0
rem 0
rem 0
rem 1
rem 0
rem 1 0.375 × 2 = 0.750
0.750 × 2 = 1.500
0.500 × 2 = 1.000 So 162.37510 = 10100010.0112 June 16, 2003 Introduction to CS231 12 Why does this work?
This same idea works for converting from decimal to any other base.
Think about “converting” 162 from decimal to decimal:
162 ⁄ 10 = 16 rem 2
16 ⁄ 10 = 1 rem 6
1 ⁄ 10 = 0 rem 1
After each division, the remainder contains the rightmost digit of the
dividend, while the quotient holds the remaining digits.
Similarly when converting fractions, each multiplication strips off the
leftmost digit as the integer result, leaving the remaining digits in the
fractional part.
0.375 × 10 = 3.750
0.750 × 10 = 7.500
0.500 × 10 = 5.000 June 16, 2003 Introduction to CS231 13 Base 16 is useful too
The hexadecimal system uses 16 digits:
0123456789ABCDEF
Hexadecimal is useful as a shorthand for binary
numbers.
— Since 16 = 24, one hex digit is equivalent to
four bits (including leading 0s).
— It’s often easier to work with numbers like
“B4” instead of “10110100”.
Hex shows up in many different contexts.
— IP addresses, such as “80.AE.05.27”.
— RGB color triplets, like “C0C0FF”.
You can convert between base 10 and base 16
using the same method as for converting from
decimal to binary. June 16, 2003 Introduction to CS231 Decimal Binary Hex 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 0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F 14 Binary and hexadecimal conversions
Converting from hexadecimal to binary is easy: replace
each hex digit with its equivalent fourbit binary value.
261.A516 =
2
6
1
.
A
= 0010 0110 0001 . 1010 516
01012 To convert from binary to hexadecimal, partition the
binary number into groups of four bits, starting from
the point. (Add 0s to the ends if needed.) Then replace
each fourbit group by the corresponding hex digit.
10110100.0010112 = 1011 0100 . 0010 11002
B
4
.2
C16 June 16, 2003 Introduction to CS231 Binary Hex 0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111 0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F 15 Boolean values
It’s also possible to think of voltages as representing
the discrete logical values true and false.
For various reasons that we’ll see later, people often
keep using digits instead.
— 0 is false
— 1 is true
Many of you may have seen Boolean logic before, but
we’ll focus on its connection to computer hardware.
Today we discuss functions on logical values, and show
how those functions can be implemented in hardware. June 16, 2003 Introduction to CS231 true
false 1.5V 0V 16 How can we describe functions?
Computers take inputs and produce outputs—just like functions.
We can express mathematical functions in two ways.
An expression is
finite, but not unique.
f(x,y) =
=
=
= 2x + 4x + 4y/2
6x + (4/2)y
6x + 2y
… A function table is
unique, but infinite.
x y f(x,y) 0
...
2
...
23
... 0
...
2
...
45
... 0
...
16
...
228
... We can represent logical functions in two analogous ways.
— A Boolean expression is finite but not unique.
— A truth table turns out to be unique and finite.
June 16, 2003 Introduction to CS231 17 Basic Boolean operations
Boolean expressions are created from three basic operations.
Operation: AND (product)
of two inputs OR (sum) of
two inputs Expression: xy or x•y x+y x’ or x Truth table: NOT (complement)
of one input y xy x y x+y x x’ 0
0
1
1 June 16, 2003 x 0
1
0
1 0
0
0
1 0
0
1
1 0
1
0
1 0
1
1
1 0
1 1
0 Introduction to CS231 18 Boolean operations are special
The AND and OR operations are similar to multiplication and addition.
— AND yields the same results as multiplication for the values 0 and 1.
— OR is almost the same as addition, except for the case 1 + 1.
x y xy x y x+y 0
0
1
1 0
1
0
1 0
0
0
1 0
0
1
1 0
1
0
1 0
1
1
1 This explains why we borrow the arithmetic symbols •, +, 0 and 1 for
Boolean operations.
But there are important differences too.
— There are a finite number of Boolean values—just 0 and 1.
— OR is not quite the same as addition, and NOT is a new operation. June 16, 2003 Introduction to CS231 19 Boolean expressions
Using the basic operations, we can form more complex expressions.
f(x, y, z) = (x + y’)z + x’
Some terminology and notation:
— f is the name of the function.
— x, y and z are input variables, which range over 0 and 1.
— A literal is any occurrence of an input variable or its complement.
The function above has four literals: x, y’, z and x’.
Precedences are important, but not too difficult.
— NOT has the highest precedence, followed by AND, and then OR.
— Fully parenthesized, the expression above would be written:
f(x, y, z) = (((x + (y’))z) + x’) June 16, 2003 Introduction to CS231 20 Truth tables
A truth table shows all possible inputs and
outputs of a Boolean function.
Remember that each input variable ranges
over just 0 and 1.
— A function with n variables has 2n possible
combinations of inputs.
— Since there are a finite number of values,
truth tables themselves are finite.
Inputs are listed in binary order—here in this
example, from xyz=000 (010) to xyz=111 (710).
You can find the output values by plugging the
various input combinations into an expression. June 16, 2003 Introduction to CS231 x y z f(x,y,z) 0
0
0
0
1
1
1
1 0
0
1
1
0
0
1
1 0
1
0
1
0
1
0
1 1
1
1
1
0
1
0
1 f(x,y,z) = (x + y’)z + x’ 21 Primitive logic gates
Each basic operation can be implemented in hardware with a logic gate.
Operation: AND (product)
of two inputs OR (sum) of
two inputs Expression: xy or x•y x+y x’ or x Truth table: NOT (complement)
of one input x y xy x y x+y x x’ 0
0
1
1 0
1
0
1 0
0
0
1 0
0
1
1 0
1
0
1 0
1
1
1 0
1 1
0 Logic gate
symbol: June 16, 2003 Introduction to CS231 22 Expressions and circuits
We can build a circuit for any Boolean expression by connecting primitive
logic gates in the correct order.
The example circuit below accepts input values x, y and z, and produces
the output (x + y’)z + x’. Notice that the order of operations is explicit in the circuit. June 16, 2003 Introduction to CS231 23 Summary
One of the fundamental concepts of digital circuit design is that deep
down inside, computers work with just 0s and 1s.
— The discrete values 0 and 1 are abstractions for analog voltages.
— They can represent either arbitrary numbers or Boolean values.
Boolean logic is especially important in computer architecture.
— We can build functions from the Boolean values true and false, and
the basic operations AND, OR and NOT.
— Any Boolean function can be implemented by a circuit, built using
primitive logic gates to compute products, sums and complements.
Tomorrow we’ll introduce Boolean algebra, which will help us simplify
our circuits! June 16, 2003 Introduction to CS231 24 ...
View
Full
Document
This note was uploaded on 01/14/2012 for the course CS 251 taught by Professor Howardhuang during the Fall '09 term at Waterloo.
 Fall '09
 howardhuang
 Computer Architecture

Click to edit the document details