Program the code using MARS simulator;
Loops
Write a program to calculate m n (m to the power of n).
Sample of input/output
Enter a value for m! 2
Enter a value for n! 3
2 to the power of 3 = 8
Given below is the code for the question. Please do rate the answer if it helped. Thank you.
.data
msg1: .asciiz "Enter a value for m: "
msg2: .asciiz "Enter a value for n: "
outMsg: .asciiz " to the power of "
equalto: .asciiz " = "
.text
#print string
li $v0, 4
la $a0, msg1
syscall
#read int
li $v0, 5
syscall
move $t0, $v0
#print string
li $v0, 4
la $a0, msg2
syscall
#read int
li $v0, 5
syscall
move $t1, $v0
#perform repeated multiplication
li $t2, 1 #result
li $t3, 1 #counter
loop:
bgt $t3, $t1, endloop
mul $t2, $t2, $t0 #mulitply first number into current
result
add $t3, $t3, 1
b loop
endloop:
#display first number
move $a0, $t0
li $v0, 1
syscall
#print string
li $v0, 4
la $a0, outMsg
syscall
#display second number
move $a0, $t1
li $v0, 1
syscall
#print equal to symbol
li $v0, 4
la $a0, equalto
syscall
#display result
move $a0, $t2
li $v0, 1
syscall
#exit
li $v0, 10
syscall
output
-----
Enter a value for m: 2
Enter a value for n: 3
2 to the power of 3 = 8
-- program is finished running --
Enter a value for m: 3
Enter a value for n: 2
3 to the power of 2 = 9
-- program is finished running --
Program the code using MARS simulator; Loops Write a program to calculate m n (m to...
using Mips assembly to work on Mars simulator write a program that outputs the maximum and minimum values of an entered array
MIPS 1(a): Using MARS (MIPS assembly simulator), write and debug a program with comments that will store words in a RAM array using the instruction sw and indirect addressing as specified in the data table below. Although the addresses and data are in given hexadecimal, your code will contain corresponding values in decimal. Use (268501056)_10 = (10010040)_16 as the base address of the array. Since the instruction sw and indirect addressing (using offsets) are needed to store the data in...
Using MARS simulator, write MIPS programs according to the following scenarios: Receive a positive integer number from the user and print out “prime”/“not prime” result if the entered number is prime or not. Remarks: • Write your name and Id inside the program file.(my name is Nabil Mohsen Alzeqri)and (my ID: 61330237) • All programs must be commented. • A description of the method used in the program should be provided. • The program should have been already tested using...
IN MIPS MACHINE LANGUAGE FOR MARS SIMULATOR Write your own short program that presents a RAW data dependence condition (2-5 instructions in MIPS that exhibits a data hazard). Document the hazard condition in your code comments.
Create a cache memory using mips in mars. The input of the simulator will be a file (or an array) with integers that represent a sequence of accesses to memory blocks. Each number represents a block of memory. The output of the simulator will be the number of hits for each cache configuration as well as the number of instructions executed. The results must be presented with the sequence of memory blocks delivered. While you are implementing your cache, you...
Please help me write this in Marie Simulator code: Problem: Sum= 1+2+3+.....+N Input: N Output: Summation of 1 to N Sum=0; A=1; While (A<=N){ Sum=sum+A; A=A+1; } Print Sum;
C++ Write code using 2 nested loops, that produces the following
output.
Write code using 2 nested loops, that produces the following output. 1 5 4 3 2 1 4 3 2 1 3 2 1 code.cpp New #include <iostream> 2 using namespace std; 3 4 int main() { 5 6 // TODO: your code go 7 8 9 2 1 1 }
LABORATORY EXERCISES: Using nested for loops, write a java program to print the pattern as shown in the sample output. The program does the following: It prompts the user to enter an integer between 1 and 10. It outputs the pattern shown in the sample output based on the user input. Sample output: Enter an integer from 1 to 10: 8 The pattern is: x x x x x x x x x x x x x x x x...
Write a section of Java code using while, do-while and for loops Write a section of Java code that will print out random integers between 1 and 100 while N is less than or equal to 5. Sample output > random # 1 is: 73 random # 2 is: 68 random # 3 is: 76 random # 4 is: 64
use c++ language, keep it simple i am using code block
Exercise#2: Arrays with Random Numbers Write a program that generates n random numbers as follows: Asks the user to input a positive integer n Asks the user to input the maximum value (say m) for the integers to be generated. Write a program that generates the n numbers in the range 0 to m. The program stores the generated numbers in an array A[ Asks the user to enter...