Can someone help me solve this MIPS question, it must
be able to run on qtspim.
.data
prompt: .asciiz "\nPlease enter value of x : "
prompt1: .asciiz "\nResult is : "
.text
main:
li $v0,4
la $a0,prompt #it will print prompt
syscall
li $v0,5
syscall #ask user input
move $s0,$v0 #load value of x
jal poly
li $v0,4
la $a0,prompt1 #it will print prompt
syscall
move $a0,$s1
li $v0,1
syscall
li $v0,10
syscall
poly: #it will return result in $s1
move $t7,$ra
li $s1,0 #load s1 with zero
move $t0,$s0 #load x
li $t2,5 #load power 5
jal pow
mul $t3,$t3,3 #get 3x^5
add $s1,$s1,$t3
li $t2,4 #load power 4
jal pow
mul $t3,$t3,2 #get 2x^4
add $s1,$s1,$t3
li $t2,3 #load power 3
jal pow
mul $t3,$t3,5 #get 5x^3
sub $s1,$s1,$t3
li $t2,2 #load power 2
jal pow
sub $s1,$s1,$t3
mul $t3,$t0,7 #get 7x
add $s1,$s1,$t3
sub $s1,$s1,6
move $ra,$t7
jr $ra
#it will get parameter x in t0 power in t2 return result in
t3
pow:
li $t1,1 #load 1 to t1
li $t3,1 #load one as result
loop:
bgt $t1,$t2,exit
mul $t3,$t3,$t0
add $t1,$t1,1 #increase t1 by one
j loop
exit:
jr $ra
output:
Can someone help me solve this MIPS question, it must be able to run on qtspim....
Please write MIPS program that runs in QtSpim (ex: MipsFile.s) Write a MIPS program that will read in a base (as an integer) and a value (nonnegative integer but as an ASCII string) in that base and print out the decimal value; you must implement a function (which accepts a base and an address for a string as parameters, and returns the value) and call the function from the main program. The base will be given in decimal and will...
please can you help me to solve it in Mips Assembly that works on Mars 4.5: The function isEven, tests whether a number num is even or not. Write the main function of a program that reads a nuber num, calls the function isEven and then prints a message to indicate whether num is even or not. And then, ask the user if she wants to continue or not (Y/N). please answer it
can someone please help me with this. I need to use
java.
Recursion Write and run a program that reads in a set of numbers and stores them in a sequential array. It then calls a recursive function to sort the elements of the array in ascending order. When the sorting is done, the main function prints out the elements of the newly sorted array Hint: How do you sort an array recursively? Place the smallest element of the array...
can someone help me with this C++ problem write your game() function and 3+ functions that simulate the game of Jeopardy Dice according to the following game mechanics and specifications. Game Mechanics There are two players: the user and the computer, who alternate turns until one of them reaches 80 points or higher. The user is always the first player and starts the game. If any player reaches 80 points or more at the end of their turn, the game...
*Please try to use C++ specific coding for my understanding
because I never learned C.
A polynomial P is a function defined by an array of coefficients CI. Example : C-(4, 2, 1), then In the general case, given the array CI of size N, we can define Write a program - with the function main0 that gets N, the coefficients C] and a value x from the user. - with a function poly( that calculates and returns the value...
Can someone help me with this coding question. I cannot get this to run properly. Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of π. The program should use PI and the functions listed in Table 6-1 to accomplish the following: Output the value of √π . Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs...
MUST BE WRITTEN IN C++
All user input values will be entered by the user from prompts in the main program. YOU MAY NOT USE GLOBAL VARIABLES in place of sending and returning data to and from the functions. Create a main program to call these 3 functions (5) first function will be a void function it will called from main and will display your name and the assignment, declare constants and use them inside the function; no variables will...
This is a matlab HW that I need the code for, if someone could
help me figure this out it would be appreciated.
The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...
Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines (also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer. MIPS has special registers to send information to and from a subroutine. The registers $a0,...
can someone help me fix my jeopardy dice game I am having a hard time figuring out what i am doing wrong #include #include using namespace std; //this function makes a number between 1 and 6 come out just like a dice int rollDie() { return (rand() % 6+1); } //this function asks the user with a printed statement if they want to roll the dice and gives instructions for yes and no (y/n) void askYoNs(){ cout<<"Do you want to...