MIPS Assembly Language Programming
MIPS Assembly Language Programming
MIPS Assembly Language Programming
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
1.1. REPRESENTING INTEGERS 5<br />
Algorithm 1.3 Addition of binary numbers (unsigned).<br />
• Let A and B be a pair of n-bit binary numbers.<br />
• Let X be a binary number which will hold the sum of A and B.<br />
• Let c and ĉ be carry bits.<br />
• Let i be a counter.<br />
• Let s be an integer.<br />
1. Let c = 0.<br />
2. Let i = 0.<br />
3. While i < n do:<br />
(a) Set s = Ai + Bi + c.<br />
(b) Set Xi and ĉ according to the following rules:<br />
• If s == 0, then Xi = 0 and ĉ = 0.<br />
• If s == 1, then Xi = 1 and ĉ = 0.<br />
• If s == 2, then Xi = 0 and ĉ = 1.<br />
• If s == 3, then Xi = 1 and ĉ = 1.<br />
(c) Set c = ĉ.<br />
(d) Set i = (i + 1).