ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 9.00

the program computes the square of the argument

Plsss I need help in Computer Architecture.

1.) Run what.s (downloadable from "Assignment 2" on eLearning) in SPIM, examine some of the registers etc in the SPIM windows, and look in the code of what.s, and try to work out what it does. Check whether the program works if the argument is changed to 6, 1, 0, 10, 20, etc? Answer what the program does in one sentence. 

So the program computes the square of the argument.?? and yes it works for arguments 6,1,0,10,20?

2.) Modify what.s so that it takes two arguments. If the arguments are both the same then the answer should be the same as that of what.s that takes only one argument. If they are different then you should figure out what your program should do based on the above. Try to make as few changes as possible. Give your new program a sensible name.

my guess would be to add another line of argument? like arg1: .word 10 ???    

3.) Enhance the program to allow it to receive the two arguments from the keyboard and display the result in the console window of SPIM. If any of the input arguments is a negative number (less than zero), your enhanced program should display a zero in the console.

I dont know

4.) You should store your enhanced program (only a SINGLE program for Parts 2 & 3) in one SINGLE file called "Ass2.s". At the top of the program, use comments (starting with "#") to write your name and also use comments to answer Part 1.

its due in 3 hours but I can still submit it tomorrow for point deduction..

#what.s program:

.data
arg:.word5

.text
.globl main
main:
la$t3, arg
lw$t2, 0($t3) 
lw$t3, 0($t3)

addi$t1, $zero, 0
beqz$t2, fin
fori:
add$t1, $t1, $t2
addi$t3, $t3, -1
bnez$t3, fori
fin:
li$v0, 10
syscall

 

 

arg: main: fori: fin: .data
.word 5
.text
.globl main
la
lw
lw $t3, arg
$t2, 0($t3)
$t3, 0($t3) addi
beqz $t1, $zero, 0
$t2, fin add
addi
bnez $t1, $t1, $t2
$t3, $t3, -1
$t3, fori li
$v0, 10
syscall

Answers

(11)
Status NEW Posted 02 May 2017 08:05 AM My Price 9.00

-----------

Not Rated(0)