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
nmask: .half 0x000f # a mask for a 4-bit nibble
bmask: .half 0x00ff # a mask for an 8-bit byte
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.
(original mask value)
(adjusted mask value)
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.
(original mask value)
(adjusted mask value)
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.
Grading Criteria:
Inclusion of Register Usage List 5 points
Correct syntax/format for all instructions 10 points
Correct logic (sequencing) of instructions 15 points
Loading appropriate values from memory (correct offsets) 5 points
Appropriate comments 5 points
Correct program results
5 points
Total points for assignment 45 points
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
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.
Essays
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.
Admissions
Admission and Business Papers
Be assured that you’ll definitely get accepted to the Master’s level program at any university once you enter all the details in the order form. We won’t leave you here; we will also help you secure a good position in your aspired workplace by creating an outstanding resume or portfolio once you place an order.
Editing
Editing and Proofreading
Our skilled editing and writing team will help you restructure you paper, paraphrase, correct grammar and replace plagiarized sections on your paper just on time. The service is geared toward eliminating any mistakes and rather enhancing better quality.
Coursework
Technical papers
We have writers in almost all fields including the most technical fields. You don’t have to worry about the complexity of your paper. Simply enter as much details as possible in the place order section.