Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write and test a MIPS assembly language program that 1. Prompt the user for a machine code of a MIPS instruction, i.e. a 32-bit binary

image text in transcribed

Write and test a MIPS assembly language program that 1. Prompt the user for a machine code of a MIPS instruction, i.e. a 32-bit binary represented in hexadecimal. Obviously, the input must be a string of 8 hexadecimal digits (the prefix 'Ox' is not required.) 1.a If the input was an empty string exit the program. 2. Check for the validity of the input and print an error message if an invalid string was inputted (e.g, too long, too short, contain invalid characters, etc..). The error message should tell the user the cause of the error. 3. Check if the opcode of the instruction is one of the following: a. Arithmetic and logical (i.e. the opcode is 0) b. Data transfer (lw and sw only) c. Branching and jumping (beq/bne and only) 4. If the opcode was not one of those print out a message telling the user that the opcode was not recognized. 5. If the opcode was recognized print out the followings: a. Instruction format. b. The field name and the value of each field in the instruction in hexadecimal. For example, if the input string was '8e300008' the program should print Instruction format: Opcode: 0x23 Rs: 0x11 Rt: 0x10 Imm: 0x0008 6. Go back to step 1. Run the program and test the inputs for at least one valid instruction for each instruction category listed above, and a few invalid input strings. Refer to the syllabus for submission requirements for MIPS programming assignments. Write and test a MIPS assembly language program that 1. Prompt the user for a machine code of a MIPS instruction, i.e. a 32-bit binary represented in hexadecimal. Obviously, the input must be a string of 8 hexadecimal digits (the prefix 'Ox' is not required.) 1.a If the input was an empty string exit the program. 2. Check for the validity of the input and print an error message if an invalid string was inputted (e.g, too long, too short, contain invalid characters, etc..). The error message should tell the user the cause of the error. 3. Check if the opcode of the instruction is one of the following: a. Arithmetic and logical (i.e. the opcode is 0) b. Data transfer (lw and sw only) c. Branching and jumping (beq/bne and only) 4. If the opcode was not one of those print out a message telling the user that the opcode was not recognized. 5. If the opcode was recognized print out the followings: a. Instruction format. b. The field name and the value of each field in the instruction in hexadecimal. For example, if the input string was '8e300008' the program should print Instruction format: Opcode: 0x23 Rs: 0x11 Rt: 0x10 Imm: 0x0008 6. Go back to step 1. Run the program and test the inputs for at least one valid instruction for each instruction category listed above, and a few invalid input strings. Refer to the syllabus for submission requirements for MIPS programming assignments

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions