09.07.2015 Views

CPSC 121: Models of Computation Module 10: A ... - Ugrad.cs.ubc.ca

CPSC 121: Models of Computation Module 10: A ... - Ugrad.cs.ubc.ca

CPSC 121: Models of Computation Module 10: A ... - Ugrad.cs.ubc.ca

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Module</strong> <strong>10</strong>: A Working ComputerSample program:irmovl $3,%eaxirmovl $35, %ebxirmovl $fa<strong>ca</strong>de, %ecxsubl %eax, %ebxrmmovl %ecx, $8(%ebx)halt<strong>CPSC</strong> <strong>121</strong> – 2012W T2 27<strong>Module</strong> <strong>10</strong>: A Working ComputerExample 1: subl %eax, %ebxFetch: current instruction ← 6<strong>10</strong>3next PC value ← current PC value + 2Decode: valA ← value <strong>of</strong> %eaxvalB ← value <strong>of</strong> %ebxExecute: valE ← valB - valAMemory: nothing needs to be done.Write-back: %ebx ← valEPC update: PC ← next PC value<strong>CPSC</strong> <strong>121</strong> – 2012W T2 28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!