subject

Suppose we need to compute on big integers, unsigned integers of length 1024 bits, for example, in the implementation of some crypto algorithms. Apparently, we cannot store an integer of this size in a register. The big integers have to be stored in memory. Let us use word arrays to keep them. Each array for a big integer has 1024 /32 = 32 words. The following function, in C-like pseudocode, performs the addition on a and b and saves the result in c, i. e., c = a + b, where a, b, and c are big integers. The function also returns the carry for the (entire) addition. Implement the function in MIPS assembly language. Note that the function assumes little endian when storing words to memory, which means lower words go to lower address. unsigned int bigint_add(unsigned int c[], unsigned int a[], unsigned int b[]) {
// All local variables can be stored in registers
int i;
unsigned int carry, carry1, carry2, ci;
carry = 0;
for (i = 0; i < 32; i += 1) {
}
return carry;
}
// do a[i] + b[i] + carry in the loop
ci = a[i] + b[i];
if (there is overflow) // check overflow in a[i] + b[i]
carry1 = 1; else
carry1 = 0;
// You can also do carry1 = (there is overflow)
ci += carry;
if (there is overflow) // check overflow in ci + carry
carry2 = 1; else
carry2 = 0;
// You can also do carry2 = (there is overflow)
c[i] = ci;
carry = carry1 + carry2;
// note that carry1 and carry 2 cannot be 1 at the same time

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:30
My mom and i are moving and we don’t have wifi for the next week, i want to know if using a using a hotspot with unlimited data is better than using regular wifi. i’m considering cost, speed, and data sacrifices.
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Which of the following would you find on a network
Answers: 3
question
Computers and Technology, 23.06.2019 05:20
Which operating system is a version of linux?
Answers: 1
You know the right answer?
Suppose we need to compute on big integers, unsigned integers of length 1024 bits, for example, in t...
Questions
question
English, 30.10.2019 04:31
question
Mathematics, 30.10.2019 04:31
question
Geography, 30.10.2019 04:31
question
Mathematics, 30.10.2019 04:31
Questions on the website: 13722361