Question: Write a program in C that performs 128 bit addition. Specifically, the input is an array A of long long integers. The goal of the

Write a program in C that performs 128 bit addition. Specifically, the input is an array A of long long integers. The goal of the function is to add the 128-bit integers A[0]A[1] and A[2]A[3] and leave the result in A[4]A[5]. In addition, it should return 1 (0) if there is an overflow in the addition.

Also write a program for the same problem using Legv8 assembly language. (Treat A[0]A[1] and A[2]A[3] as 128-bit integer in 2s complement. Similarly, the sum should be stored in A[4]A[5] as a 2s complement integer.) For the assembly code, assume that the two operands are in the registers X0X1 and X2X3, and the sum should be stored in registers X5X6. Run your C program with the following input pairs and display the output. (Show the sum as well as the overflow status of the computation.)

Test case 1: A[0] = A[2] = 0x7fffffffffffffff, A[1] = A[3] = 0xffffffffffffffff

Test case 2: A[0] = 0x7fffffffffffffff, A[1 = 0, A[3] = 0xffffffffffffffff and A[4] = 1

Test case 3: A[0] = 0x7fffffffffffffff, A[1] = A[2] = 0xffffffffffffffff and A[3] = 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!