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:10
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
If i wanted to include a built-in calendar in a document, what option could i select? draw table insert table insert chart quick tables
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
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
History, 06.05.2020 20:07
question
History, 06.05.2020 20:07
Questions on the website: 13722359