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 08:40
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
What is the original authority for copyright laws
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
In the microsoft® access® and microsoft excel® programs, the ribbon contains tabs that are divided into with like tools in them. parts groups containers bunches
Answers: 1
question
Computers and Technology, 25.06.2019 08:10
In contrast to data in a database data in a data warehouse is described as subject oriented
Answers: 2
You know the right answer?
Suppose we need to compute on big integers, unsigned integers of length 1024 bits, for example, in t...
Questions