














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Computer architecture is the study of building computer systems. ▫ CSE378 is roughly split into three parts. — The first third discusses instruction set ...
Typology: Lecture notes
1 / 22
This page cannot be seen from the preview
Don't miss anything!















Winter 2011 – The Final Performance!
Slides adapted from: UIUC, Luis Ceze, Larry Snyder, Hal Perkins
Computer architecture is the study of building computer systems. ^
CSE378 is roughly split into three parts. — The first third discusses instruction set architectures—the bridge
between hardware and software. — Next, we introduce more advanced processor implementations. The
focus is on pipelining, which is one of the most important ways toimprove performance. — Finally, we talk about memory systems, I/O, and how to connect it all
together.
This class expands upon the computer architecture material from the lastfew weeks of CSE370, and we rely on many other ideas from CS370. — Understanding binary, hexadecimal and two’s-complement numbers is
still important. — Devices like multiplexers, registers and ALUs appear frequently. You
should know what they do, but not necessarily how they work. — Finite state machines and sequential circuits will appear again.
^
We do
not
spend time with logic design topics like Karnaugh maps,
Boolean algebra, latches and flip-flops.
Y
0
0
1
1
0
0
1
1
X
W
0
1
0
0
0
1
0
0
Z
370/378 is “bottom-up” – from gates to logic units to registers, datapath,control to make up a processor ^
351/352 is “middle-down” – start with registers, instructions, what thecompiled code does (351), then down to implementation – registers, logicunits, datapath, control (352) ^
MIPS (378) vs x86 (351) — Important thing is to learn a first machine at the instruction set level— You will pick up many others during your career but the basic ideas are
the same — If we have time at the end of the quarter we’ll take a quick look at x
32 students as of last night ^
Who has written programs in assembly before? ^
Anyone designed HW before? ^
Written a threaded program before?
Computer Organization and Design
, Patterson and Hennessy, 4th
Edition
Interface between hardware and software — abstraction: hide HW complexity from the software through a set of
simple operations and devices add, mul, and, lw, ...
SoftwareHardware
In this class, we’ll use the MIPS instruction set architecture (ISA) toillustrate concepts in assembly language and machine organization^ —
Of course, the concepts are not MIPS-specific —
MIPS is just convenient because it is real, yet simple (unlike x86)
The MIPS ISA is still used in many places today. Primarily in embeddedsystems, like:^ —
Various routers from Cisco —
Game machines like the Nintendo 64 and Sony Playstation 2
You must become “fluent” in MIPS assembly: — Translate from C to MIPS and MIPS to C
^
Example problem:
Write a recursive function
Here is a function pow that takes two arguments (n and m, both 32-bit
numbers) and returns n
m (i.e., n raised to the m
th
power).
intpow(int n, int m) {
if (m == 1)
return n; return n * pow(n, m-1); } Translate this into a MIPS assembly language function.
Computers are instruction execution engines that endlessly run thefetch/execute cycle This course explains in detail this logical process and how it isimplemented in hardware
MIPS processors have 32 registers, each of which holds a 32-bit value.^ —
Register addresses are 5 bits long. —
The data inputs and outputs are 32-bits wide.
More registers might seem better, but there is a limit to the goodness.^ —
It’s more expensive, because of both the registers themselves as wellas the decoders and muxes needed to select individual registers. —
Instruction lengths may be affected, as we’ll see in the future.
D data
WriteD address A address
B address
A data
B data
32
×
32 Register File
5
5 5
32
32
32
MIPS register names begin with a $. There are two naming conventions:^ —
By number:
By (mostly) two-character names, such as:
$a0-$a
$s0-$s
$t0-$t
$sp
$ra
Not all of the registers are equivalent:^ —
E.g., register $0 or $zero always contains the value 0
(go ahead, try to change it)
Other registers have special uses, by convention:^ —
E.g., register $sp is used to hold the “stack pointer”
You have to be a little careful in picking registers for your programs.— More about this later
More complex arithmetic expressions may require multiple operations atthe instruction set level.
t0 = (t1 + t2)
(t3 - t4)
add
$t0,
$t1,
$t
# $t
contains
$t
+ $t
sub
$s0,
$t3,
$t
# Temporary
value
$s
=^
$t
-^
$t
mul
$t0,
$t0,
$s
# $t
contains
the
final
product
Temporary registers may be necessary, since each MIPS instructions canaccess only two source registers and one destination.^ —
In this example, we could re-use $t3 instead of introducing $s0. —
But be careful not to modify registers that are needed again later.
The ALU instructions we’ve seen so far expect register operands. How doyou get data into registers in the first place?^ —
Some MIPS instructions allow you to specify a signed constant, or“immediate” value, for the second source instead of a register. Forexample, here is the immediate add instruction, addi:
addi
$t0, $t1, 4
# $t0 = $t1 + 4
Immediate operands can be used in conjunction with the $zero registerto write constants into registers:
addi
$t0, $0, 4
# $t0 = 4
MIPS is still considered a load/store architecture, because arithmeticoperands cannot be from arbitrary memory locations. They must either beregisters or constants that are embedded in the instruction.