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
Write a piece of codes that asks the user to enter a month (an integer), a day (another integer), and a two-digit year. The prog
Sliva [168]

Answer:

Follows are the code to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

int day,month,year;//defining integer variable

cout<<"please enter last two digit of the year: "; //print message

cin>>year;//input year value

cout<<"enter day: "; //print message

cin>>day;//input day value

cout<<"enter month: ";//print message

cin>>month;//print month message

if(month*day==year)//check magic date condition  

{

cout<<"its magic programology year";//print message

}

else

{

cout<<"its not magic year";//print message

}

return 0;

}

Output:

please enter last two digit of the year: 98

enter day: 14

enter month: 7

its magic programology year

Explanation:

In the given code, three integer variable "day, month, and year" is declared, that uses the input method "cin" to input the value from the user-end.

In the next step, an if block statement is used that check month and day value multiple is equal to year value, if the condition is true it will print "magic programology year" otherwise it will print "not the magic year".

6 0
3 years ago
In microsoft word, when you highlight existing text you want to replace, you’re in
Sergio039 [100]
 Hello <span>Christinamauffp2olwu</span><span>

Answer: In Microsoft Word, when you highlight existing text you want to replace, you're in insert mode.

Hope This Helps :-)
-Chris</span>
6 0
3 years ago
When you take action independent of direct instruction, you are showing _____.
ozzi

Answer:

Option A, initiative

Explanation:

Initiation is an art of performing an act or task by self motivation rather on command or instruction from anyone.

Insubordination is incorrect as here there is no mentioning of disobeying seniors or authority

Also, courage and power means having strength to perform any task. Here action is performed without any instruction and it in no sense signifies a brave deed.

Hence, option A is correct

8 0
3 years ago
What do you consider to be audit evaluation areas?
skelet666 [1.2K]

Answer:

<em>communications</em><em>,</em><em>risk</em><em>,</em><em>systems</em><em>,</em><em>test</em><em>ins</em><em>,</em><em>procedures</em><em>,</em><em>interviews</em><em>,</em><em>documents</em><em>.</em>

Explanation:

The auditor considers many factors in determining the nature, timing, and extent of auditing procedures to be performed in an audit of an entity's financial statements. One of the factors is the existence of an internal audit function. fn 1 This section provides the auditor with guidance on considering the work of internal auditors and on using internal auditors to provide direct assistance to the auditor in an audit performed in accordance with generally accepted auditing standards.Note: When performing an integrated audit of financial statements and internal control over financial reporting, refer to paragraphs 16-19 of PCAOB Auditing Standard No. 5, An Audit of Internal Control Over Financial Reporting That Is Integrated with An Audit of Financial Statements, for discussion on using the work of others to alter the nature, timing, and extent of the work that otherwise would have been performed to test controls.

Roles of the Auditor and the Internal Auditors

<em>02 </em>

<h2><em>I</em><em> </em><em>HOPE</em><em> </em><em>THIS</em><em> </em><em>HELPS</em><em> </em><em>ALOT</em><em>!</em><em> </em><em>:</em><em>3</em></h2>

3 0
3 years ago
write query for all products reutrn product name with its amounts due, paid, canceled, and refunded, order the result by product
spayn [35]

Answer:

SELECT product_name, amount_due, amount_paid,

              cancelled, amount_refunded

   FROM products

ORDER BY product_name ASC;

Explanation:

SQL (Structured Query Language ) was used above.

The SELECT command is used to list all the variables we want in our output.

The FROM command signifies the location.

ORDER BY command ensures that your result is ordered

ASC means Ascending Order.

; signifies the end of the query.

NOTE: Underscores were used because variables cannot be written with spaces between them

8 0
3 years ago
Other questions:
  • Your friends know that you understand a lot about computers, both the technical details of how they operate as well as informati
    12·1 answer
  • What is used for World Wide Web?
    7·1 answer
  • Respecting culture in the workplace means understanding that
    5·2 answers
  • describe a real-world scenario where data is collected and needs to be both accurate and precise for the safety of the community
    9·1 answer
  • What was the ENIAC computer and how was it used/what for?
    9·1 answer
  • What is the fastest way to locate a record for updating?
    6·1 answer
  • You have added a table to your web page consisting of two columns and five rows, including the header row. in the first header c
    13·1 answer
  • The Daily Trumpet newspaper accepts classified advertisements in 15 categories such as Apartments for Rent and Pets for Sale. De
    9·1 answer
  • How do Computer Scientists use Binary Code?
    14·1 answer
  • 1. Create an optimized function "print s(n,s)" that prints the given argument s (representing a string) k times. k represents th
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!