Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions