Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is an Assembly Language MIPS program I am having trouble with, please help. Read an integer A from a user, and place it in

This is an Assembly Language MIPS program I am having trouble with, please help.

image text in transcribed

Read an integer A from a user, and place it in register $a0. Recall that the 32 bits in a word are counted from bit 0, which is the right-most or least significant bit (LSB), to bit 31, which is the left- most or most significant bit (MSB). Now, set register $t1 to contain only bits 8, 9, 10 and 11 of A. That is, the LSB of $t1 should contain bit 8 from A, the second least significant bit of $t1 should contain bit 9 from A, etc. Then return the resulting number as output to the user. For example, say your input integer is 985980. This corresponds to 0 times 000f0b7c in hexadecimal, which is 0000 0000 0000 1111 0000 1011 0111 1100 in binary. If you isolate bits 8, 9, 10 and 11 (which are under-lined above) and move them to the least significant bits of $t1, you will get 0 times 0000000b. Here are some sample executions for your program: Please enter your integer: 985980 Here is the output: 11 Please make sure your output lines contain the string "Here is the output: "as shown in the sample output You should be able to accomplish the bit manipulation using at most one shift instruction (e.g., sll, srl, sra) and one logical instruction (e.g., andi, ori, xori, etc.) There are other ways of accomplishing the same manipulation that may use more instructions, or others altogether, but you should make your program as minimal as you can. Read an integer A from a user, and place it in register $a0. Recall that the 32 bits in a word are counted from bit 0, which is the right-most or least significant bit (LSB), to bit 31, which is the left- most or most significant bit (MSB). Now, set register $t1 to contain only bits 8, 9, 10 and 11 of A. That is, the LSB of $t1 should contain bit 8 from A, the second least significant bit of $t1 should contain bit 9 from A, etc. Then return the resulting number as output to the user. For example, say your input integer is 985980. This corresponds to 0 times 000f0b7c in hexadecimal, which is 0000 0000 0000 1111 0000 1011 0111 1100 in binary. If you isolate bits 8, 9, 10 and 11 (which are under-lined above) and move them to the least significant bits of $t1, you will get 0 times 0000000b. Here are some sample executions for your program: Please enter your integer: 985980 Here is the output: 11 Please make sure your output lines contain the string "Here is the output: "as shown in the sample output You should be able to accomplish the bit manipulation using at most one shift instruction (e.g., sll, srl, sra) and one logical instruction (e.g., andi, ori, xori, etc.) There are other ways of accomplishing the same manipulation that may use more instructions, or others altogether, but you should make your program as minimal as you can

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

What are the four elements of a firms marketing mix?

Answered: 1 week ago

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago