Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 03:30, live4dramaoy0yf9
Explain the importance of html in web page designing in 20 sentences..
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, qveenvslayin
How can smart devices benefit businesses, organizations, and social communities in the global marketplace?
Answers: 1
image
Computers and Technology, 24.06.2019 12:30, hilario4785
Why does the pc send out a broadcast arp prior to sending the first ping request
Answers: 1
image
Computers and Technology, 24.06.2019 21:30, asimms8504
Suppose a router has built up the routing table shown in the table. subnet number 128.96.39.00 28.96.39.128 128.96.40.00 192.4.153.0 default) subnet mask 255.255.255.128 255.255.255.128 255.255.255.128 255.255.255.192 nexthop interface 0 interface 1 r2 r3 r4. the router can deliver packets directly over interfaces 0 and 1, or it can forward packets to routers r2, r3, or r4. describe what the router does with a packet addressed to each of the following destinations: (a) 128.96.39.10 (b) 128.96.40.12 (c) 128.96.40.151 (d) 192.4.153.17 (e) 192.4.153.90
Answers: 3
Do you know the correct answer?
Suppose we need to compute on big integers, unsigned integers of length 1024 bits, for example, in t...

Questions in other subjects: