26.06.2015 Views

Chapter 4: The Instruction Set Architecture - 10/31/2013 02:13:31 ...

Chapter 4: The Instruction Set Architecture - 10/31/2013 02:13:31 ...

Chapter 4: The Instruction Set Architecture - 10/31/2013 02:13:31 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4-17<br />

<strong>Chapter</strong> 4: <strong>The</strong> <strong>Instruction</strong> <strong>Set</strong> <strong>Architecture</strong><br />

ARC Example Program<br />

• An ARC assembly language program adds two integers:<br />

! This programs adds two numbers<br />

.begin<br />

.org 2048<br />

prog1: ld [x], %r1 ! Load x into %r1<br />

ld [y], %r2 ! Load y into %r2<br />

addcc %r1, %r2, %r3 ! %r3 ← %r1 + %r2<br />

st %r3, [z] ! Store %r3 into z<br />

jmpl %r15 + 4, %r0 ! Return<br />

x: 15<br />

y: 9<br />

z: 0<br />

.end<br />

Principles of Computer <strong>Architecture</strong> by M. Murdocca and V. Heuring<br />

© 1999 M. Murdocca and V. Heuring

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

Saved successfully!

Ooh no, something went wrong!