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
Which of the below statements describes the nature of HTML elements - check as many as apply
slava [35]

Answer:

The answer to this question is option 1,2 and 4.

Explanation:

Some html elements does not contain anything or having no content are called empty html elements.for ex:- <br>,<hr> etc.

HTML elements are of two types block and inline.block elements starts with new line for ex:-div,body etc.Inline elements does not starts with new line.for ex:-<style>,<meta>,<head>etc.

Html elements also contains attributes that modify the element for ex:-

<body style="background-color:blue;">

where style is an attribute.

5 0
3 years ago
What is a Database, Flat file and Relational Database?
Marta_Voda [28]

Answer:

A flat file database stores data in a single table structure. A relational database uses multiple table structures, cross-referencing records between tables. Tables in both organize records in rows, with each column containing a single piece of data in the record.

8 0
2 years ago
10 to the 8th power divided by 10 to the -4th power
sammy [17]
The answer is 10 to the twelfth power.

8 0
3 years ago
Hello my name is fvgrbhcdnxjm
san4es73 [151]
I’m guessing free points?
3 0
3 years ago
Which of the following statements are true about file naming conventions? Check all of the boxes that apply.
Korolek [52]

Answer:

last one check it and the second one

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • After saving her presentation initially, Leah realizes she needs to add another content slide. She adds the slide and is ready t
    7·1 answer
  • What is Moore’s law
    11·1 answer
  • Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite
    6·1 answer
  • Rachel is a junior system administrator for a network with a single Active Directory domain. The network has just expanded to in
    6·1 answer
  • Susan uploads her newly created files on the web server using FTP. What should she ensure while uploading to prevent other users
    9·2 answers
  • Join me to play mm2<br><br><br>in r0bl0x​
    6·2 answers
  • What is the purpose of indexing?
    15·2 answers
  • Plz help me to learn python and thx
    7·1 answer
  • Write a for loop to print all the even numbers from 200 to 300.
    14·1 answer
  • Which approach to bandwidth usage consumes all of the available frequencies on a medium to transmit data
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!