Computer organization and design | computer Organization and Design | Hood College

CS 508

Computer Organization and Design

Fall 2023

Assignment #5

Memory Access, Integer Arithmetic and Logic Operations

Due Date: Friday, September 29, 2023 @ 11:59 PM

This assignment will expand on assembly language programming by having you create a
sequential program that applies arithmetic and logic operations on numeric data.

Part 1: Data Definitions

For this assignment, there are only three data items to define as follows:

num1: .half 0xabcd # a 16-bit halfword for logic operations to be applied

No additional values are to be defined in the data segment. You will need to know the offset values for these items to be loaded into registers, but you are not required to state them in the comments.

Part 2: Arithmetic and Logic Operations (nibble values)

The program will utilize a number of registers so you will want to have a register usage plan defined so that your use of registers is organized and logical. The first instructions in the text segment should be to load the three data values into registers.

The next sequence of instructions should apply the appropriate mask to extract each 4-bit nibble from num1. The following image shows the application of this masking and bit extraction technique.

Note in the image that the mask value is shifted to align with the bits of the nibble being extracted from num1. This shifting must be done in code using the appropriate logic instruction for the extraction of each nibble a – c. Each extracted nibble must be in a separate register. The mask value can remain in the same register that it was loaded (shift in place).

To complete the first sequence of operations, the four extracted nibbles are to be added to produce a sum. So effectively, you are performing the operation a + b + c + d. However, prior to adding the values, they must be shifted into the low order bits of their respective registers so that the place values align. The sum will be placed in its own register, thus preserving the extracted nibble values.

Part 3: Arithmetic and Logic Operations (byte values)

The last part of the program will have you perform an extraction of the two bytes from num1. The following image shows the basic concept.

Note the shifting of the mask as was done in the previous part which must be done in code. Each byte should be extracted to different registers. Once again, the mask can be shifted in place using the same register.

After extracting each byte, perform a right shift on the second value to align it in the lower order byte position. After the alignment shift, subtract the second extracted byte from the first and place the value in a separate register, retaining the extracted bytes in their original registers.

Finally, add the result of the sum of the nibbles in part 1 with the result of subtracting the two bytes, placing the result in another available register. Verify that the correct value has been produced.

Your program should be well documented with comments including the required register usage section preceding the data segment of the program and after the header comment section. Submit your final source code program on Blackboard.

Inclusion of Register Usage List 5 points

Correct syntax/format for all instructions 10 points

Correct logic (sequencing) of instructions 15 points

Correct program results
5 points

Total points for assignment 45 points

image2.png

Get 20% Discount on This Paper
Pages (550 words)
Approximate price: -

Try it now!

Get 20% Discount on This Paper

We'll send you the first draft for approval by at
Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Our Services

Quality Essay Help has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.

Essay Writing Services

At Quality Essay Help, we prioritize on all aspects that bring about a good grade such as impeccable grammar, proper structure, zero-plagiarism and conformance to guidelines. Our experienced team of writers will help you completed your essays and other assignments.