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
MakcuM [25]
4 years ago
13

Write a MIPS program to continuously generate the following series of integers: 1, 2, 3, 6, 9, 18, 27, 54, 81, and so on. Use st

andard MIPS programming conventions. Use the jump instruction to generate an infinite loop. Write a subroutine EVEN that returns a 1 if the argument is even, else it returns a 0. You must call this subroutine with jal and return from it with jr. The MIPS program must be converted into machine code and placed in the instruction memory. The sequence can be computed by adding the value to itself if it is odd and by adding the previous value to it if it is even. Before replacing the test program in the instruction memory, make sure that your design works for the provided Test-Program.
Computers and Technology
1 answer:
Pachacha [2.7K]4 years ago
3 0

Answer:

Explanation:

Here is a working solution in MIPS

.data

space: .asciiz ", "

.text

li $t1, 1       #Start at 1

li $t2, 1       #Store last value

li $t4, 1000    #terminate at 1000

li $t7, 2       #For division (divide by 2)

loop:

li $v0, 1

add $a0, $t1, $zero #print $t1

syscall

div $t1, $t7      #divide $t1 by 2

mfhi $t5          #get the remainder

move $t6, $t1     #hang on to what $t1 was originally

beqz $t5, even    #if the remainder is 0, it's even

add $t1,$t1,$t1    #it's odd, so add to itself

move $t2, $t6      #store what $t1 was originally to last value

bgt $t1, $t4, done #if the number is over 1000, we're done

li $v0, 4           #Print a comma and space

la $a0, space

syscall

j loop

even:

add $t1,$t1,$t2    #set $t1 = $t1 + Last value ($t2)

move $t2, $t6      #store what $t1 was originally to last value

bgt $t1, $t4, done #if the number is over 1000, we're done

li $v0, 4           #Print a comma and space

la $a0, space

syscall

j loop

done:

You might be interested in
Word documents contain how many sections by default?
Butoxors [25]

Answer:

Word documents contain one section by default

Explanation:

8 0
3 years ago
What is the code for loading image in matlab
MA_775_DIABLO [31]

Answer: Using imread command

Explanation:

For loading images in matlab we can use the imread command. Some example regarding how to use the code is as follows:

A = imread('ball.tif');

Here suppose the image file name is saved as ball and is in tif format. Here the image is stored in an array named A.

We can view the image using

imshow(A);

7 0
3 years ago
________ is interpreted. Group of answer choices A. Python B. C C. C D. Ada E. Pascal
rusak2 [61]

The interpreted are;

  • A. Java
  • B. C++
  • D. C#
<h3>What is interpreted programming language?</h3>

An interpreted language is known to be a kind of languagewhere its implementations often carry out or execute instructions directly.

Note that The interpreted are;

  • A. Java
  • B. C++
  • D. C#

Learn more about Java from

brainly.com/question/25458754

#SPJ11

7 0
2 years ago
Henry wants to create a presentation for his clients. He wants to upload the presentation file directly to the Internet. Which p
Ierofanga [76]

Answer:

styrofoam and petroleum

Explanation:

8 0
1 year ago
A collection of realated files is called a
Thepotemich [5.8K]

The answer to this question would be:

database/records

They all have in common the same files.

4 0
3 years ago
Other questions:
  • Assume that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 month
    13·1 answer
  • You are adding new wires in your building for some new offices. The building has a false ceiling that holds the lights and provi
    8·1 answer
  • Write a Python program that prompts the user for the cost of two items to be purchased. Then prompt the user for payment. If the
    11·1 answer
  • Prompts what is a row?
    7·1 answer
  • Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac
    5·1 answer
  • The most common types of effects include entrances and exits
    11·1 answer
  • Select three advantages of cloud computing.
    10·1 answer
  • Which of the following describe audio-editing software? Choose all that apply.
    5·2 answers
  • When trying to upload assignment on canvas wont let me click choose file.
    6·1 answer
  • (40 PTS) Be specific
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!