Programming a 64-bit processor, Computer Engineering

Assignment Help:

You are to write a C program called big_mult.c that multiplies two unsigned 64-bit integers, x and y, read from the command line. The output is a pair of unsigned 64-bit integers representing the most significant and least significant 64 bits of the full 128-bit product x * y. The inputs and outputs are to be given in hexadecimal format. Your C program will take care of reading the inputs and printing the output, but it will call a function mulq.s to do the actual multiplication. Your C program should use only unsigned long long int variables and should not do any arithmetic. To reduce the length of our type declarations, I put the following lines into hw3.h.
typedef unsigned long long int ulli;
typedef long long int lli;

This allows us to abbreviate unsigned long long int with the shorter name ulli and long long int with lli.

The function defined by mulq.s should have the following declaration in C before the function main.
void mulq(ulli x, ulli y, ulli *high, ulli *low);

The least significant 64 bits of the product are to be assigned to low, and the most significant 64 bits of the product are to be assigned to high. Remember to put an appropriate header comment into your assembly file (the ordinary C comment /* ... */ will work for assembly too). You will also need to read carefully the description of the mulq instruction in the Intel 64/IA32 instruction set reference manual, Intel 64/IA32 instruction set reference manual, or equivalent documentation. Learning to read this two-volume 800+ page document is part of your learning experience on this assignment.

One way to approach writing this assembly program is to write a similar program in C, compile it to assembly code using the -S option, and modify the resulting assembly code to do what you need. Your final assembly code should be very short and should contain only one multiplication instruction mulq.
The compile command to test your programs will look like this:
gcc64 -Wall -std=gnu99 -o big_mult big_mult.c mulq.s .

Here are 32- and 64-bit sample outputs to use in testing your programs.
C:>big_mult 2f432f43 629b03cb
2f432f43 x 629b03cb = 12345678 87654321

C:>big_mult 99d0c486a0fad481 76a185cea6f497c7
99d0c486a0fad481 x 76a185cea6f497c7 = 4747474747474747 4747474747474747
.
Remember that arguments are passed differently in the 64-bit architecture than in the 32-bit architecture. The registers used for parameter passing in Windows are different from those described in the textbook for Unix. Windows passes only the first four parameters in registers. The registers used by Unix are %rdi, %rsi, %rdx, %rcx, %r8, %r9 in that order. The registers used by Windows are %rcx, %rdx, %r8, %r9 . See Class10.pdf for details on register usage.


Related Discussions:- Programming a 64-bit processor

Find the de broglie wavelength of electron, Q. Find the de Broglie waveleng...

Q. Find the de Broglie wavelength of electron in the fourth orbit of hydrogen atom. We know that,            λ = 2πr / n λ4 = 2πr 4 / 4  = 2π (4 2 r1) / 4  = 2 X

Explain error detection and correction codes, Q. Explain Error Detection an...

Q. Explain Error Detection and Correction Codes? Before we wind up data representation in reference of today's computers one should determine about code that helps in correctio

What is electronic data interchange, What is Electronic Data Interchange? ...

What is Electronic Data Interchange? Electronic Data Interchange (EDI): It is used by organizations for transactions which arise on regular basis to a pre-found format.

Features of mpi-1, Features of MPI-1 Binding for FORTRAN and C ...

Features of MPI-1 Binding for FORTRAN and C Collective communication Communication domains and Process groups Point-to-point communication Virtual process

Desirable characteristics of an electronic market place, What are the desir...

What are the desirable characteristics of an Electronic Market Place?  Characteristics of an Electronic Market Place:  a. Its electronic, the business center is not a phys

Perform multiplication with showing content of accumulator, Perform multipl...

Perform multiplication with showing the contents of accumulator, B register and Y register during each step. (Accumulator, B, Y are 4-bit registers) B=06 Y=02

Explain congestion, Explain CONGESTION. CONGESTION: This is uneconomi...

Explain CONGESTION. CONGESTION: This is uneconomic to provide sufficient equipment to carry entire traffic that could possibly be given to a telecommunication system. Inside

What is modem?, A device, usually linked to a serial port of a computer, th...

A device, usually linked to a serial port of a computer, that transfer data over regular phone lines. Modem stands modulator demodulator; it changes a digital stream of data into s

Define external layer, Define external layer? The external layer is the...

Define external layer? The external layer is the plane at which the user sees and interacts with the data, that is, the data format in the user interface.  This data format is

What are the disadvantages of public key cryptography, What are the disadva...

What are the disadvantages of Public Key Cryptography? Disadvantages of Public Key Cryptography are as given below: a) It is used to encrypt a secret key that is used to e

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd