Tom Kelliher, CS 240
Jan. 25, 1999
Phoenix accounts.
Instruction set design considerations, classes, arithmetic instructions.
Decision making, other addressing modes.
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:
(Section 3.4)
Instruction formats for instructions we've seen so far:

Field meanings?
$at.