Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assessment Problems Problem 1 (50%) Q1 Write an assembly language program using MIPS instructions that performs the same function as the following piece of C
Assessment Problems Problem 1 (50%) Q1 Write an assembly language program using MIPS instructions that performs the same function as the following piece of C code: (30 marks) int i, j, M, N, count; int a []; int b[]; ferli=0; i 0) && (b[j] > 0)) { Count = count + 1; If you wish, you may use register names that are the same as the variable names used in the code above. For example, to initialize the register that holds the i counter, you might write: add $I, $o, $o Using actual MIPS register names, you should write your code out as follows: add $t0, $0, $o # $t0 maps to variable A; we need # to initialize it to O Make sure to add appropriate comments. Assume that the starting addresses of the all and b[] arrays are in registers $81 and $82 respectively. Test the assembly code program via the MARS MIPS simulator and show test results. Q2 How many instructions within your nested loops will be executed in your solution to Q1? (20 marks) Hint 1: Hint 2: Write a parameterized expression as a function of M, N, etc. Answers will vary based on the code that you write
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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