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
Types of libraries in operating system​
katrin2010 [14]

Answer:

Academic, Public, National & Special Library

Explanation:

8 0
3 years ago
What is the function of series-parallel circuit
wel

Answer:

components are connected end-to-end in a line to form a single path for electron s to flow

Explanation:

If you put morw lamps into serious circuit, the lamps will be dimmer than they were before.

6 0
4 years ago
What is the difference between keywords and identifiers in c++ ?
prohojiy [21]
Keywords are the reserved words of a language.Identifiers are the user defined names of variable, function and labels. Hope that this helped
3 0
3 years ago
How much time does a computer take to big calculations ?​
Alex17521 [72]

Answer:

one billion (9 zeros) is being reached fast – 15 seconds. but to get to one trillion (12 zeros) – the difference is amazing – 4 hours and 10 minutes. Basically 1000 times more.

Explanation:

6 0
3 years ago
You work as the IT security administrator for a small corporate network. You have designed the physical security of the offices
ladessa [460]

The security IT administrator he or she is planning to install smart card communications over the network which is can be access through TCP IP address.

Smart card key reader to be placed or installed where is required  such as an opening door  or entrance of office or organization extra.

Key card readers should be contactless and record more volume of data and it should synchized with the system at regular intervals.

By Installing smart card and it readers unauthorized  person entry to lab or network server can be avoided. Since smart card reader connected to the network, IT SECURITY administrator can generate log reports.

5 0
3 years ago
Other questions:
  • How do all apple phones work?
    7·1 answer
  • How can investors receive compounding returns
    13·1 answer
  • Paragraph: Read the following two e-mail messages. In a paragraph of no less than 125 words, explain why e-mail B is the more ap
    11·1 answer
  • Give two separate print statements: one will print your name, the other will print your major. Ensure that both will print on th
    15·1 answer
  • Which process best describes how you might prepare to apply for a job?
    10·2 answers
  • What are html documents also called?
    12·1 answer
  • Identify the error and write correct HTML program 5 Cyber Bullying Tips<\head>Don't Respond Talk to a trusted adult <|h
    14·1 answer
  • If you were an architect planning on building a large scale Municipal complex what type of engineer would you identify as essent
    10·1 answer
  • Anyone help me please​
    6·2 answers
  • How does abstraction make programming languages easier to use
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!