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

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

image1.png

image2.png

Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more