Instructions: a simple example
- A C statement
- f, g, h, i, j are assigned to $s0, $s1, $s2, $s3, $s4
Instructions: a simple example A C statement f = (g +h) - (i + j) - - PowerPoint PPT Presentation
Instructions: a simple example A C statement f = (g +h) - (i + j) f, g, h, i, j are assigned to $s0, $s1, $s2, $s3, $s4 add $t0, $s1, $s2 add $t1, $s3, $s4 sub $s0, $t0, $t1 Load and store instructions Load and store instructions
11
g : $s1 h : $s2 base address of A : $s3 $tn : destination register $S_base : register with base address c_off : offset from base
13
15
6-bits opcode that specifies the operation rs 5-bits register file address of the first source operand rt 5-bits register file address of the second source operand rd 5-bits register file address of the result’s destination shamt 5-bits shift amount (for shift instructions) funct 6-bits function code augmenting the opcode
17
18
memory for data, programs, compilers, editors, etc.
add
sub
addi
lw
sw
$t1 holds base of array A $s2 holds h
rs rt rd address/ shamt funct
100011 1001 1000 0000 0100 1011 0000 10010 0 100 0 100 100000 101011 1001 0 100 0000 0100 1011 0000