Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Objective To assess student on CO2 - Develop programs using assembly languages for simple problems, including procedure. Problem Statement A recursive formula is given as

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Objective To assess student on CO2 - Develop programs using assembly languages for simple problems, including procedure. Problem Statement A recursive formula is given as follows: a = x an=2an-1 + 5 Develop a MIPS program to compute and print out the result of an, recursively until an >z, where z is the stopping value defined in the data segment. Repeat this process for all values x stored in the array x. Your MIPS program must demonstrate the followings: 1. Main program that will obtain the x and z values, and passes to the procedure func. 2. Procedure named func to compute an = 2am-1 +5 recursively until a > z. 3. Make use of the stack to handle the procedure calls i.e. push and pop for returning address 4. Make use of the stack to preserve all the registers used in the procedure i.e. push the content of the registers before they are used in the procedure, and pop to restore the registers' origina 5. Print out all the answers a, for the corresponding x and z values defined. 6. Make sure your program is able to execute and show the expected output. 7. Make sure to include comment in your program to explain your codes clearly. upon retur Example 1: data x: .word 0, 3, 10, 55, 330, 498 word 1000 Expected output: The calculated an for initial value 0 5 15 35 775 155 315 635 secure ewble-Sl.utar.edu.my Example 1: .data X: .word 0, 3, 10, 55, 330, 498 z: .word 1000 Expected output: The calculated an for initial value 0 0 5 15 35 75 155 315 635 The calculated an for initial value 3 3 11 27 59 123 251 507 The calculated an for initial value 10 10 25 55 115 235 475 955 The calculated an for Initial value 55 55 115 Example 2: . data X: .word 5, 1, 500, 225 Z: .word 2555 Expected output: The calculated an for initial value 5 5 15 35 75 155 315 635 1275 2555 The calculated an for initial value 1 1 7 19 43 91 187 379 763 1531 The calculated an for initial value 500 500 1005 2015 The calculated an for initial value 225 225 455 915 1835 The calculated an for initial value 10 10 25 55 115 235 475 955 The calculated an for initial value 55 55 115 235 475 955 The calculated an for initial value 330 330 665 The calculated an for initial value 498 498 Example 2: data x word 5, 1, 500, 225 Z: word 2555 Expected output: The calculated an for initial value 5 15 35 75 155 315 635 1275 2555 The calculated an for initial value 1 19 43 91 187 379 763 1532 The calculated for initial value 500 Objective To assess student on CO2 - Develop programs using assembly languages for simple problems, including procedure. Problem Statement A recursive formula is given as follows: a = x an=2an-1 + 5 Develop a MIPS program to compute and print out the result of an, recursively until an >z, where z is the stopping value defined in the data segment. Repeat this process for all values x stored in the array x. Your MIPS program must demonstrate the followings: 1. Main program that will obtain the x and z values, and passes to the procedure func. 2. Procedure named func to compute an = 2am-1 +5 recursively until a > z. 3. Make use of the stack to handle the procedure calls i.e. push and pop for returning address 4. Make use of the stack to preserve all the registers used in the procedure i.e. push the content of the registers before they are used in the procedure, and pop to restore the registers' origina 5. Print out all the answers a, for the corresponding x and z values defined. 6. Make sure your program is able to execute and show the expected output. 7. Make sure to include comment in your program to explain your codes clearly. upon retur Example 1: data x: .word 0, 3, 10, 55, 330, 498 word 1000 Expected output: The calculated an for initial value 0 5 15 35 775 155 315 635 secure ewble-Sl.utar.edu.my Example 1: .data X: .word 0, 3, 10, 55, 330, 498 z: .word 1000 Expected output: The calculated an for initial value 0 0 5 15 35 75 155 315 635 The calculated an for initial value 3 3 11 27 59 123 251 507 The calculated an for initial value 10 10 25 55 115 235 475 955 The calculated an for Initial value 55 55 115 Example 2: . data X: .word 5, 1, 500, 225 Z: .word 2555 Expected output: The calculated an for initial value 5 5 15 35 75 155 315 635 1275 2555 The calculated an for initial value 1 1 7 19 43 91 187 379 763 1531 The calculated an for initial value 500 500 1005 2015 The calculated an for initial value 225 225 455 915 1835 The calculated an for initial value 10 10 25 55 115 235 475 955 The calculated an for initial value 55 55 115 235 475 955 The calculated an for initial value 330 330 665 The calculated an for initial value 498 498 Example 2: data x word 5, 1, 500, 225 Z: word 2555 Expected output: The calculated an for initial value 5 15 35 75 155 315 635 1275 2555 The calculated an for initial value 1 19 43 91 187 379 763 1532 The calculated for initial value 500

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Accounting questions