Tom Kelliher, CS 240
Jan. 22, 1998
Accounts on phoenix. Who doesn't have one? Who forgot their password? Need usernames.
Decision making.
Read Sections 3.5, 3.8. (Return to 3.4 later.)
Things to consider:
Consider your favorite HLL. What classes of instructions (operations) are required?
Now, consider a multi-user OS such as Unix? What additional classes of instructions are required?
Any general purpose architecture must support these classes.
Consider the two simplest:
add subConsider an HLL statement:
f = (g + h) - (i + j);
add a, b, c # This, BTW, is a comment. sub a, a, bDe-compile each of the following:
add a, b, c add a, a, d add a, a, eDe-compile further into a single HLL statement.
Compile each of the following:
a = b + c; d = a - e; f = (g + h) - (i + j);
Consider operands within an HLL:
#include <stdio.h>
int main()
{
int foo = 1234;
printf("%d, %p\n", foo, &foo);
return 0;
}
A variable is an abstraction which the compiler/OS binds to a memory
address.
RISC instruction sets don't ordinarily support memory operands. Why not?
Where are the operands? Registers.
Properties of registers:
Other register files: x86, SPARC and the register window (Berkeley RISC, about 128 registers, spilling).
Register renaming: ISA registers vs. physical registers.
Implications: size of address space, datapath width.
MIPS, M68000, x86.
See pg. A-23 for the full register naming convention. Note the limited number of s and t registers.
Our simple convention:
$s0, $s1, etc. for C variables.
$t0, $t1, etc. for temps.
Recall:
f = (g + h) - (i + j);Assume f through j are in
$s0 through $s4,
respectively. Compile the statement.
HLL have complex data structures such as arrays and structs. How are they handled?
Data transfer instructions: load, store. operands: memory address, register.
Actual MIPS instructions: lw, sw.
MIPS memory is byte addressable, so word addresses differ by 4:

Endianess.
Compile the following:
g = h + A[8];where g is in
$s1, h is in $s2, and the base
address of A, an array of 100 words, is in $s3.
Base, offset addressing.
Compile each of the following:
A[12] = h + A[8]; A[j] = h + A[i];
Notes: