Transcript Week 1

CS35101
Computer Architecture
Spring 2006
Week 1
Slides adapted from:
Mary Jane Irwin (www.cse.psu.edu/~mji)
Course url: www.cs.psu.edu/~cg331
[Adapted from Dave Patterson’s UCB CS152 slides]
Course Administration

Instructor:
Paul J Durand
[email protected]
http://www.cs.kent.edu/~durand

Labs: Accounts on loki or neptune

Texts: Computer Organization and Design: The
Hardware/Software Interface,
Third Edition, Patterson and Hennessy
Course Goals and Structure

Introduction to the major components of a computer
system, how they function together in executing a
program, how they are designed.

MIPS assembler programming using the spim system
spim Assembler and Simulator

spim is a self-contained assembler and simulator for
the MIPS R2000/R3000



It provides a simple assembler, debugger and a simple set of
operating system services
It implements both a simple, terminal-style interface and a
visual windowing interface
Available as

xspim on unix
- installed on the CS unix machines loki, hermes, neptune,
poseidon

PCSpim on Windows
- can be downloaded and installed on your own PC from
www.cs.wisc.edu/~larus/SPIM/pcspim.exe

Sorry, there is no Macintosh version of spim
Head’s Up

This week’s material

Course introduction
- Reading assignment – PH 1.1 through 1.3 and A.9 through A.10
(on cd)

Reminders



Make sure your unix account is operational; change your
password to something you can remember and that is secure
(must be six to eight alphanumeric characters)
Check out the course homepage (www.cs.kent.edu/~durand)
Next week’s material

Introduction to MIPS assembler
- Reading assignment - PH 2.1 through 2.7, omit 2.6
What You Should Already Know

How to write, compile and run programs in a higher
level language (C, C++, Java, …)

How to create, organize, and edit files and run
programs on Unix

How to represent and operate on positive and negative
numbers in binary form (two’s complement, sign
magnitude, etc.)

Logic design

How to design combinational components (Boolean algebra,
logic minimization, decoders and multiplexors)
Below the Program

High-level language program (in C)
swap (int v[], int k)
(int temp;
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
)

Assembly language program (for MIPS)
swap:

sll
add
lw
lw
sw
sw
jr
C compiler
$2, $5, 2
$2, $4,$2
$15, 0($2)
$16, 4($2)
$16, 0($2)
$15, 4($2)
$31
Machine (object) code (for MIPS)
000000 00000 00101 0001000010000000
000000 00100 00010 0001000000100000
. . .
assembler
Advantages of Higher-Level Languages

Higher-level languages






Allow the programmer to think in a more natural language and
for their intended use (Fortran for scientific computation,
Cobol for business programming, Lisp for symbol
manipulation, …)
Improve programmer productivity – more understandable
code that is easier to debug and validate
Improve program maintainability
Allow programmers to be independent of the computer on
which they are developed (compilers and assemblers can
translate high-level language programs to the binary
instructions of any machine)
Emergence of optimizing compilers that produce very efficient
assembly code optimized for the target machine
As a result, very little programming is done today at
the assembler level
Machine Organization

Capabilities and performance characteristics of the
principal Functional Units (FUs)


e.g., register file, ALU, multiplexors, memories, ...
The ways those FUs are
interconnected

e.g., buses

Logic and means by which
information flow between FUs
is controlled

The machine’s Instruction Set Architecture (ISA)

Register Transfer Level (RTL) machine description
Major Components of a Computer
Processor
Control
Datapath
Devices
Memory
Input
Output
Impacts of Advancing Technology

Processor



increases about 30% per year
2x every 1.5 years
Memory




logic capacity:
performance:
DRAM capacity: 4x every 3 years
memory speed: 1.5x every 10 years
cost per bit:
decreases about 25% per year
Disk

capacity:
increases about 60% per year
Example: Growth in DRAM Chip Capacity
1000000
256,000
Kbit capacity
100000
64,000
16,000
10000
4,000
1000
1,000
256
100
64
10
1980
1982
1984
1986
1988
1990
1992
Year of introduction
1994
1996
1998
2000
Below the Program

High-level language program (in C)
swap (int v[], int k)
. . .
 Assembly language program
swap:
sll
$2, $5, 2
add
$2, $4, $2
lw
$15, 0($2)
lw
$16, 4($2)
sw
$16, 0($2)
sw
$15, 4($2)
jr
$31

one-to-many
(for MIPS)
Machine (object) code (for MIPS)
000000
000000
100011
100011
101011
101011
000000
00000
00100
00010
00010
00010
00010
11111
00101
00010
01111
10000
10000
01111
00000
0001000010000000
0001000000100000
0000000000000000
0000000000000100
0000000000000000
0000000000000100
0000000000001000
C compiler
one-to-one
assembler
Input Device Inputs Object Code
000000
000000
100011
100011
101011
101011
000000
Processor
Control
Datapath
Devices
Memory
Input
Output
00000
00100
00010
00010
00010
00010
11111
00101
00010
01111
10000
10000
01111
00000
0001000010000000
0001000000100000
0000000000000000
0000000000000100
0000000000000000
0000000000000100
0000000000001000
Object Code Stored in Memory
Memory
Processor
Control
Datapath
000000
000000
100011
100011
101011
101011
000000
00000
00100
00010
00010
00010
00010
11111
00101
00010
01111
10000
10000
01111
00000
0001000010000000
0001000000100000
0000000000000000
0000000000000100
0000000000000000
0000000000000100
0000000000001000
Devices
Input
Output
Processor Fetches an Instruction
Processor fetches an instruction from memory
Memory
Processor
Control
Datapath
000000
000000
100011
100011
101011
101011
000000
00000
00100
00010
00010
00010
00010
11111
00101
00010
01111
10000
10000
01111
00000
0001000010000000
0001000000100000
0000000000000000
0000000000000100
0000000000000000
0000000000000100
0000000000001000
Where does it fetch from?
Devices
Input
Output
Control Decodes the Instruction
Control decodes the instruction to determine
what to execute
Processor
Devices
Control
000000 00100 00010 0001000000100000
Memory
Input
Datapath
Output
Datapath Executes the Instruction
Datapath executes the instruction as directed
by control
Processor
Devices
Control
000000 00100 00010 0001000000100000
Memory
Input
Datapath
contents Reg #4 ADD contents Reg #2
results put in Reg #2
Output
Processor Organization


Control needs to have the

Ability to input instructions from memory

Logic and means to control instruction sequencing

Logic and means to issue signals that control the way
information flows between datapath components

Logic and means to control what operations the datapath’s
functional units perform
Datapath needs to have the

Components - functional units (e.g., adder) and storage
locations (e.g., register file) - needed to execute instructions

Components interconnected so that the instructions can be
accomplished

Ability to load data from and store data to memory
Where does it load and store from and to?
What Happens Next?
Memory
Processor
Control
Datapath
000000
000000
100011
100011
101011
101011
000000
00000
00100
00010
00010
00010
00010
11111
00101
00010
01111
10000
10000
01111
00000
0001000010000000
0001000000100000
0000000000000000
0000000000000100
0000000000000000
0000000000000100
0000000000001000
Fetch
Exec
Decode
Devices
Input
Output
Output Data Stored in Memory
At program completion the data to be output
resides in memory
Processor
Memory
Control
Datapath
Devices
Input
00000100010100000000000000000000
00000000010011110000000000000100
00000011111000000000000000001000
Output
Output Device Outputs Data
Processor
Control
Datapath
Devices
Memory
Input
Output
00000100010100000000000000000000
00000000010011110000000000000100
00000011111000000000000000001000
The Instruction Set Architecture
software
instruction set architecture
hardware
Stopped here 1/19
The interface description separating the
software and hardware.
MIPS R3000 Instruction Set Architecture

Instruction Categories




Registers
Load/Store
Computational
Jump and Branch
Floating Point
R0 - R31
- coprocessor



PC
HI
Memory Management
Special
LO
3 Instruction Formats: all 32 bits wide
OP
rs
rt
OP
rs
rt
OP
rd
sa
immediate
jump target
Q: How many already familiar with MIPS ISA?
funct