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]
3 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]3 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 statements about organizing messages in Outlook 2016 are true? Check all that apply. The Categories function is used for g
xenn [34]

Answer:

A. B. C. F. G.

Explanation:

5 0
3 years ago
Read 2 more answers
All of the following are examples of what rigorous coursework in high school might mean except: A) added reading assignments. B)
faust18 [17]

Answer:b

Explanation:

3 0
3 years ago
Read 2 more answers
The Olympic Games that people celebrate today are much different from the Olympics that began in ancient Greece. When the Olympi
kiruha [24]

Answer:

D

Explanation:

Option D explains the best about Olympic games. previously only few games were in Olympics but now thee are variety of games and some more games are trying to be a part of future Olympic games as well. There is no explanation about other options so we discarded those options, Which includes A) Greek mythology says that the Olympics were started by Heracles. B) Women were not allowed to watch the Olympic Games in ancient Greece. C) The ancient Olympics included sport such as running and chariot racing.

8 0
3 years ago
Read 2 more answers
when I was playing Mobile legends bang bang online Match The game logged Me out and when I was Trying To reconnect it failed and
Helen [10]

Answer:

it's most prolly a bug.The game crashes a lot tbh

5 0
3 years ago
Which of the following color palettes for the BackColor and ForeColor properties contains colors that are guaranteed to be displ
Norma-Jean [14]

Answer: 1)System Palette

Explanation: System palette is kind of palette found in the system which contain the color values that is used by the display.This palette is also  drawing of the devices and applications.But the application don't get the direct access to the system palette rather logical palette permits it.

They work on the basis of the properties carried from the Back color and Fore color.Other palettes mention in the option is incorrect because these palettes don't work for the operating system's display .Thus the correct option is option(1).

8 0
3 years ago
Other questions:
  • Which of the following best describes a proxy firewall? A. It sends traffic through another host. B. It acts as a gateway for re
    15·1 answer
  • A customer in a store is purchasing 5 items. Write a python program that asks for the price of each item and display the subtota
    14·1 answer
  • So can u please follow my new ig acc i just started it yesterday its called stunnerspamz
    5·2 answers
  • The two mathematical models of language description are generation and recognition. Describe how each can define the syntax of a
    10·1 answer
  • A web application is an example of:
    7·1 answer
  • A photographer uses which of these tools to form an argument?
    14·2 answers
  • QueSUUN TU
    15·1 answer
  • Which automated method for VPN connection deployment would work best in combination with Microsoft Intune or Microsoft Endpoint
    9·1 answer
  • Types of Computer games​
    6·1 answer
  • You are reviewing a friend’s HTML project. You notice that the only metadata is the title. Furthermore, you ask your friend abou
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!