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
If 209g of ethanol are used up in a combustion process, calculator the volume of oxygen used for the combustion at stp​
SOVA2 [1]

Answer:

a) The volume of oxygen used for combustion at STP is approximately 305 dm³

b) The volume of gas released during combustion at STP is approximately 508 dm³

Explanation:

The given chemical reaction equation for the burning of ethanol in air, is presented as follows;

2CH₃CH₂OH (l) + 6O₂ (g) → 4CO₂ (g) + 6H₂O

The mass of ethanol used up in the combustion process, m = 209 g

The molar mass of ethanol, MM = 46.06844 g/mol∴

The number of moles of ethanol in the reaction, n = m/MM

∴ n = 209 g/(46.06844 g/mol) ≈ 4.537 moles

a) Given that 2 moles of ethanol, CH₃CH₂OH reacts with 6 moles of oxygen gas molecules, O₂, 4.54 moles of ethanol will react with (6/2) × 4.537 = 13.611  moles of oxygen

The volume occupied by one mole os gas at STP = 22.4 dm³

The volume occupied by the 13.611 moles of oxygen gas at STP, 'V', is given as follows;

V = 13.611 mol × 22.4 dm³/mole = 304.8864 dm³ ≈ 305 dm³

The volume occupied by the 13.611 moles of oxygen gas at STP, V = The volume of oxygen used for the combustion ≈ 305 dm³

b) The total number of moles of gases released in the reaction, is given as follows;

The total number of moles = (4.537/2) × (4 + 6) = 22.685 moles of gas

The total volume of gas released, V_T = The volume of gas released during the combustion at STP = 22.685 moles × 22.4 dm³/mole = 508.144 dm³ ≈ 508 dm³

7 0
3 years ago
Why do computers need to periodically check the dns for websites you have already visited? enter your answer here?
den301095 [7]

The reason why computers has the need to periodically check for the DNS of websites that an individual has already visited because certain websites can change its IP address and that the individual using it can be directed to a different website that he or she does not know of.

6 0
3 years ago
When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
faltersainse [42]

Answer:

Parameter

Explanation:

q: When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.

a: Parameter

3 0
3 years ago
It skills which move well between industries are considered?
Butoxors [25]

Answer:

They are termed as ethics. But remember different industries have a different set of ethics or rules that they expect their employees to follow. However, some that go well with all are common to all. And they are the standard ethics that are followed by all the industries. Failing to these is never expected.

Explanation:

Please check the answer section.

6 0
3 years ago
Which method of deleting files can be used in windows xp and vista?
Makovka662 [10]
The correct answer is C.

4 0
2 years ago
Other questions:
  • Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w
    8·1 answer
  • Special programs that facilitate communication between a device and the os are called
    12·1 answer
  • which one of these steps describe saving a newly created file. click on the save icon. minimize the file. name the file. select
    12·2 answers
  • A benefit of flashcards is that they are
    7·2 answers
  • Write a program to create a customer bill for a company. The company sells only five products: TV, DVD player, Remote Controller
    12·1 answer
  • PLZ ANSWER THESE QUESTIONS FOR 30 POINTS AND BRAINLIEST!
    9·1 answer
  • Alexi is writing a program which prompts users to enter their age. Which function should she use?
    6·2 answers
  • Example of Not a computer characteristics example
    12·1 answer
  • Which wireless standard uses the 2.4 GHz frequency band only?
    5·1 answer
  • How do you get lugia in pokemon alpha saphire
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!