Successor Instruction
int equal(int a1, int a2) {
int tsame;
tsame = 0;
if (a1 == a2)
tsame = 1; // only if a1 == a2
return(tsame);
}
main()
{
int x,y,same; // r0 == 0 always
x = 43; // addi $1, $0, 43
y = 2; // addi $2, $0, 2
same = equal(x,y); // need to call function
// other computation
}
Instruction
Fetch
Instruction
Decode
Operand
Fetch
Execute
Result
Store
Next
Instruction
Previous slide
Next slide
Back to first slide
View graphic version