Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Part A:  Bitwise Logical and Shift Operations

Create a SPARC assembly language program that extracts a bit-field from the contents of register %l0. The position of the rightmost bit of the field is indicated in register %l1, and the number of bits in the field is indicated in register %l2. The extracted field should be put into register %l3, right-shifted so that field starts at bit 0; any bits outside of the extracted field should be set to 0. Structure your program so that it operates on 3 separate inputs, each with different input data, field positions, and field widths. Your TA will provide the inputs to work with. Do not hard code any bit masks; your program should create them using the appropriate bitwise operations. Optimize your program, eliminating nop instructions where possible. Do not use m4.

Use printf() to display in hexadecimal the contents of registers %l0, %l1, %l2 before each extraction, and %l3 afterwards. Also run your program in gdb, displaying the contents of registers %l0, %l1, %l2 before each extraction, and %l3 afterwards. Capture the gdb session using script. On a separate piece of paper, show the bit pattern for each hexadecimal number for the registers %l0 and %l3, circling the extracted field.

Part B:  Integer Multiplication using Add and Shift Operations

prepare a SPARC assembly language program that implements the following integer multiplication algorithm:

negative = multiplier >= 0 ? 0 : 1;
product = 0;
for (i = 0; i < 32; i++) {
    if (multiplier & 1)
        product += multiplicand;
    (product and multiplier registers combined as a unit) >> 1;
}
if (negative)
    product -= multiplicand;


Structure your program so that it shows 3 different multiplications: the first should multiply two positive numbers together, the second should multiply a positive number by a negative number, and the third should multiply two negative numbers together. Your TA will provide the input data to work with. Since we don’t yet know how to create subroutines, you can simply cut and paste the multiplication code to do each multiplication.

Use printf() to display in hexadecimal the contents of the product, multiplier and multiplicand registers before and after each multiplication. Optimize your program, eliminating nop instructions where possible. Do not use m4. Also run the program in gdb, displaying the contents of key registers as the program executes; you should show that the algorithm is working as expected. Capture the gdb session using script. On a separate piece of paper, show the bit pattern (binary number) for each hexadecimal number, and its decimal equivalent (in other words, show the binary and decimal values of the multiplier, multiplicand, and product).

Other Requirements
:

Make sure your code is properly formatted into columns, is readable and fully documented, and includes identifying information at the top of each file. You must comment each line of assembly code. Your code should also be well designed: make sure it is well organized, clear, and concise. Your TA will specify the inputs to use for the above two programs.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91804

Have any Question?


Related Questions in Computer Engineering

Program in cit is often times advantageous to be able to

*Program in C* It is often times advantageous to be able to transfer data between two arrays. Need a help with program (transfer.c) that add a range (by start index and end index) of numbers from array #1 to array #2 at ...

Systems analysis projectpersonal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

Can someone help me identify how intrustion detection

Can someone help me identify how Intrustion detection system and intrusion prevent system can help protect confidentiality, integrity and availability

A chemistry student needsnbsp700 ml of dimethyl sulfoxide

A chemistry student needs 70.0 mL of dimethyl sulfoxide for an experiment. By consulting the  CRC Handbook of Chemistry and Physics , the student discovers that the density of dimethyl sulfoxide is 1.10 g.cm^-3. Calculat ...

Question suppose that we have a set of activities to

Question : Suppose that we have a set of activities to schedule among a large number of lecture halls, where any activity can take place in any lecture hall. We wish to schedule all the activities using as few lecture ha ...

In the course of producing its output this firm causes

In the course of producing its output, this firm causes pollution. The government passes a law that requires the firm to stop polluting, and the firm discovers that it can prevent the pollution by hiring 0.2 workers for ...

Suppose you are given a connected graph g with edge costs

Suppose you are given a connected graph G, with edge costs that are all distinct. Prove that G has a unique minimum spanning tree.

Describe how to discover cookies on web browsers what is a

Describe how to discover cookies on web browsers. what is a reverse DNS lookup and can it be used when attacking the network.

The equation of regression line for sons heighty in inches

The equation of regression line for son's height(y) in inches versus father's height in inches is y = 35 + 0.5x. For a 72 inch tall father, what would we predict for the son's height?

Alpine company stock is selling for 3240 a share one 30

Alpine Company stock is selling for $32.40 a share. One $30 call is valued at $2.76 and one $29 put is valued at $.65. What is the value of three call option contracts (remember that one contract includes 100 options)?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As