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 10:00
According to alisa miller foreign news bureaus
Answers: 3
question
Computers and Technology, 22.06.2019 20:00
What is the term for water wave that is created by an underwater earthquake
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
question
Computers and Technology, 23.06.2019 18:50
Ais a picture icon that is a direct link to a file or folder
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
Mathematics, 01.11.2019 19:31
question
English, 01.11.2019 19:31
question
English, 01.11.2019 19:31
question
Mathematics, 01.11.2019 19:31
Questions on the website: 13722367