1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Norma-Jean [14]
3 years ago
12

(Assignment 1, individual) Create proc3.s Study the proc3.c and re-write the same program in MIPS with the following requirement

s: 1. Local variables mapping: a. main(): x -> $s0, y -> $s1 b. sum(): p -> $s0, q -> $s1 2. Input arguments mappings: a. sum(): m -> $a0, n-> $a1 b. sub(): a -> $a0, b-> $a1 3. All return values from a function must be stored in V registers in ascending order (i.e. $v0, $v1). 4. Use of stack memory according to register conven
Computers and Technology
1 answer:
Vedmedyk [2.9K]3 years ago
8 0

Answer:

text

.globl main

main:

li $s0,5 #load 5 to x

li $s1,10 #load 10 to y

move $a0,$s0

move $a1,$s1 #passing argument to sum function

jal sum

add $s1,$s1,$v0 #get y + sum(x,y)

add $s1,$s1,$s0 #get x+ y + sum(x,y)

li $v0,1

move $a0,$s1

syscall #print value of y

li $v0,10 #terminate call

syscall

sum:

addi $sp, $sp, 4

subu $sp,$sp,4 # point to the place for the new item,

sw $ra,($sp) # store the contents of $ra as the new top.

move $t1, $a0 #store parameters m

move $t2, $a1 #store parameters n

add $a0,$t2,1 #get n+1

add $a1,$t1,1 #get m+1

jal sub

move $t3,$v0 #store result to t3

sub $a0,$t1,1 #get m-1

sub $a1,$t2,1 #get n-1

jal sub

move $t4,$v0 #store result to t3

add $v0,$t3,$t4 #return p+q

lw $ra,($sp) # store the contents of $ra as the new top.

addu $sp,$sp,4 # point to the place for the new item,

addi $sp, $sp, 4

jr $ra

sub:

sub $v0,$a1,$a0 #return b-a

jr $ra

Explanation:

text

.globl main

main:

li $s0,5 #load 5 to x

li $s1,10 #load 10 to y

move $a0,$s0

move $a1,$s1 #passing argument to sum function

jal sum

add $s1,$s1,$v0 #get y + sum(x,y)

add $s1,$s1,$s0 #get x+ y + sum(x,y)

li $v0,1

move $a0,$s1

syscall #print value of y

li $v0,10 #terminate call

syscall

sum:

addi $sp, $sp, 4

subu $sp,$sp,4 # point to the place for the new item,

sw $ra,($sp) # store the contents of $ra as the new top.

move $t1, $a0 #store parameters m

move $t2, $a1 #store parameters n

add $a0,$t2,1 #get n+1

add $a1,$t1,1 #get m+1

jal sub

move $t3,$v0 #store result to t3

sub $a0,$t1,1 #get m-1

sub $a1,$t2,1 #get n-1

jal sub

move $t4,$v0 #store result to t3

add $v0,$t3,$t4 #return p+q

lw $ra,($sp) # store the contents of $ra as the new top.

addu $sp,$sp,4 # point to the place for the new item,

addi $sp, $sp, 4

jr $ra

sub:

sub $v0,$a1,$a0 #return b-a

jr $ra

The above program takes in Local variables mapping: main(): x -> $s0, y -> $s1 b. sum(): p -> $s0, q -> $s1 Then Input arguments mappings: sum(): m -> $a0, n-> $a1 b. sub(): a -> $a0, b-> $a1

And return all values from a function which must be stored in V registers in ascending order.

You might be interested in
hi, I want to ask how do I change the Brainly to another country?, because I pressed the wrong Brainly button to my country​
Setler [38]

Answer:

I don't know maybe you should Uninstall

3 0
3 years ago
Read 2 more answers
How would you define the rule of thirds?
mixer [17]

A pronciple of composition used fir centuries by artists and photographers or it is a method when used to frame a composition properly

8 0
3 years ago
Help please if you know answer like these I’ll provide my discord.
Natasha_Volkova [10]

ins can insert a time and date.

5 0
3 years ago
For this question <br> Translate to assembly language!!!!!!!
svetoff [14.1K]

Answer:

Javascript, because of the use of commas at the end of each line and the while operator using commas to hold params.

6 0
3 years ago
What benefits did evolution realize by using the crm software?
Elza [17]
Hello there!
Answer:
Have included productivity improvements (doubling the number of deliveries for a speci²c time period), enhanced inventory management, automation of picklists, better resource planning, and more e±ective reporting to key stakeholders. Evolution’s CRM system can determine deliveries planned for any future month and the amount of product in stock, helping Evolution reduce stock holding by 40%. When a new patient is keyed onto system, tasks can be generated for Evolution’s team to organize delivery ahead of time. The system automatically generates a pick list for that patient from Evolution’s pharmacy. Managers can see tasks 2 weeks ahead and can allocate resources accordingly. Hoping this helps you! :D
4 0
3 years ago
Other questions:
  • Read three integers from user input. Then, print the product of those integers. Ex: If input is 2 3 5, output is 30. Note: Our s
    6·1 answer
  • Write a loop to print 10 to 90 inclusive (this means it should include both the 10 and 90), 10 per line.​
    6·1 answer
  • Outsourcing is an alternative systems building approach that may involve subscribing to an application service provider or hirin
    8·1 answer
  • You want to create a set of instructions to teach your dog to walk, to bark on command, and to heel. Such software would similar
    6·1 answer
  • Files and e-mail messages sent over the Internet are broken down into smaller pieces called _____.
    13·1 answer
  • A network technician is tasked with designing a firewall to improve security for an existing FTP server that is on the company n
    9·1 answer
  • An expression which combines variables numbers and at least one operation
    8·1 answer
  • Two routers connect with a serial link, each using its S0/0/0 interface. The link is currently working using PPP. The network en
    6·1 answer
  • 2.36 LAB: Warm up: Variables, input, and casting (1) Prompt the user to input an integer, a double, a character, and a string, s
    12·1 answer
  • What is being done to reduce the python population in florida?.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!