Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Objective Handling strings of integers using MIPS instructions. Problem Statement In this lab you need to write a MIPS program to count the number of
Objective Handling strings of integers using MIPS instructions. Problem Statement In this lab you need to write a MIPS program to count the number of occurrences of an integer X in a string of integers S. The integer X and all the integers in S are positive and greater than zero except the "last" integer in the string S, which is zero. That zero acts as a delimiter that marks the end of the string S. Therefore, the number of integers in S is not given as input to your program The instructions in your program should trace the content of S counting how many integers in the string equal to X. The counting result should be stored in a variable C. Procedure Using your text editor, write a MIPS program to solve the above problem and save it in Lab2_Prog.asm. Assume the following The address of X is stored in $s1 The address of C is stored in $s2 The address of the first integer in S is stored in $s3 Start PCSpim Make sure the settings have the "Load exception file" option turned off Open your program. You may have to edit and reload if there are errors. Initialize the program counter to 0x00400000. Initialize the registers and string entries to the values in Table 1: Register/Memory Address Value Meanin 0x10000000 Address of X 0x10000004 Address of C 0x10000008 Address of S 0x5 0x3 0x5 0x7 0x5 0x0 s1 s2 s3 0x10000000 0x10000008 0x1000000C 0x10000010 0x10000014 0x10000018 S01-3 S[41 :0 Table 1: Data initialization After running your program, check the value of C (address 0x10000004). Check off Objective Handling strings of integers using MIPS instructions. Problem Statement In this lab you need to write a MIPS program to count the number of occurrences of an integer X in a string of integers S. The integer X and all the integers in S are positive and greater than zero except the "last" integer in the string S, which is zero. That zero acts as a delimiter that marks the end of the string S. Therefore, the number of integers in S is not given as input to your program The instructions in your program should trace the content of S counting how many integers in the string equal to X. The counting result should be stored in a variable C. Procedure Using your text editor, write a MIPS program to solve the above problem and save it in Lab2_Prog.asm. Assume the following The address of X is stored in $s1 The address of C is stored in $s2 The address of the first integer in S is stored in $s3 Start PCSpim Make sure the settings have the "Load exception file" option turned off Open your program. You may have to edit and reload if there are errors. Initialize the program counter to 0x00400000. Initialize the registers and string entries to the values in Table 1: Register/Memory Address Value Meanin 0x10000000 Address of X 0x10000004 Address of C 0x10000008 Address of S 0x5 0x3 0x5 0x7 0x5 0x0 s1 s2 s3 0x10000000 0x10000008 0x1000000C 0x10000010 0x10000014 0x10000018 S01-3 S[41 :0 Table 1: Data initialization After running your program, check the value of C (address 0x10000004). Check off
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started