






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
These are the Lecture Slides of Computer Systems which includes Writing to Cache, Memory Access, Simple Direct-Mapped Cache, Inconsistent Memory, Write-Through Caches, Write-Back Caches, Finishing Write Back, Write Misses etc.Key important points are: Control Flow, Decisions
Typology: Slides
1 / 11
This page cannot be seen from the preview
Don't miss anything!







l^ h^ l^ l fl but it’s often necessary to alter the normal control flow.• Conditional statements execute only if some test expression istrue.^ // Find the absolute value of a0v0 = a0;if (v0 < 0)v0 = -v0;^
// This might not be executed v1 = v0 + v0;^0 0; • Loops cause some statements to be executed many times. //^ Sum the elements of^
a five-element array^ a //^
y v0 = 0;t0 = 0;while (t0 < 5) {v0 = v0 + a0[t0];^
// These statements willt0++; // be executed five times }
-^ Usage:j there^
L1^ //^ Branch^
if^ $t0^ <^ $t ble^ $t0,^ $t1,^ L
//^ Branch^ if^
$t0^ <=^ $t bgt^ $t0,^ $t1,^ L
//^ Branch^ if^
$t0^ >^ $t b^ $^0 $^1
//^ h^ if^
$^0 $^1 bge^ $t0,^ $t1,^ L
//^ Branch^ if^
$t0^ >=^ $t
move^ $v0^ $a if^ (^0 0)^
b^ $ 0^ $0^ L^ b^ l if^ (v0^ <^ 0)^
bge^ $v0,^ $0,^ Label v0^ =^ -v0;^
sub^ $v0,^ 0,^ $v v1^ =^ v0^ +^ v0;^
Label:^ add^ $v1,^ $v0,
$v
-^ Sometimes it’s easier to
bge^ $v0, $0, E v0^ ;^
sub^ $v0^ $v0^1 v0 --;^
sub^ $v0, $v0, 1j^ L elsev0 ++;^
E:^ add^ $v0, $v0, 1 v1^ = v0;^
L:^ move $v1, $v v1^ v0;^
L:^ move $v1,^ $v
0 #^ length
loop:lb^ $t0^ 0($a0)
#^ load^ char lb^ $t0,^ 0($a0)
#^ load^ char beq^ $t0,^ $zero,
done #^ done^ if^
==^ 0x addi^ $v0,^ $v0,
1 #^ length++ addi^ $a0,^ $a0,
1 #^ next^ char j^ loop^
#^ repeat done:^ #^ $v0^ =^
string^ length^ here$ g^ g