Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LAB4 Reference Guide Objective Learn how to run and debug MIPS assembly code by QtSpim in Windows. Learn how to write MIPS assembly code to

LAB4 Reference Guide
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Objective Learn how to run and debug MIPS assembly code by QtSpim in Windows. Learn how to write MIPS assembly code to realize basic 10 functions, like printing. reading and writing. Learn how to operation addition and multiplication in MIPS assembly language Software used: QiSpim: MIPS assembly simulator Text editor: As per your preferences Instruction: 1. Write your program using any text editor. Try to avoid the errors. 2. Open Qtspim. It is your simulator another window will also pop up, it is a console window) 3. Use Reinitialize and Load file icon (second on the top left) to load the text file containing the program in assembly language. After loading Otspim will check for syntax error immediately. If any error exits error message will pop up. It is better to relaunch the simulator every time you modify your source code. Note: 1. Whenever you find it difficult to locate bugs, try to use "step by step" debugging and check register values by register window. 2. Always use registers provided in register window. You cannot use a register that does not exist. For more details, refer to MIPS specification that provided to you in D2L or you can search "MIPS" online. Step 3: Basic 10 operations. Basic MIPS assembly code structure: data .globl main .text main: Your code How to print a message? 1. Define the message in "data" segment, like data INPUT G: asciiz "Please enter a number as g globl main ...........remaining code 2. write a system call function to print the message as follows: li Sv0,4 la SaO, INPUT_G syscall #load integer 4 to register v0 (print stringmode) #load message address to register a # system call How to read a variable? li Svo, 5 # load integer 5 to register vo(read mode) #system call to read a integer number from console window. syscall How to write or print a number to console window? li $v0,1 li Sa0, number #load integer 1 to register v0 (write mode) # assign a to the desired output number # also use other instructions to assign register a, like add, shift, etc. syscall Other instructions you may use in this lab would be like addition, shifting, multiplication, etc. For detail, please refer MIPS specification. The following is a simple example. Add Rd, Rs, Rt Mult Rs, Rt #RF[RD) - RF[RS] + RF[Rt). RF-> Reg.File addition #High Low = RF[RS] * RF[Rt] multiplication ifresult is stored in High and Low registers. #Access them by mthi, mflo instructions, #RF[Rd] =RF[Rt] Reg.File addition #High Low = RF[RS] * RF[Rt] multiplication ifresult is stored in High and Low registers. #Access them by mthi, mflo instructions, #RF[Rd] =RF[Rt]

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

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

RP-7 What is natural selection?

Answered: 1 week ago

Question

5. Have you stressed the topics relevance to your audience?

Answered: 1 week ago