Input Read three input values from the keyboard: the first number in the sequence, • the second number in the sequence, and the number of elements of the sequence. Each element of the sequence (beyond the first two) is equal to the sum of the previous two. For example, if the user inputs 3, 1, and 10, then your program should generate the sequence 3, 1, 4, 5, 9, 14, 23, 37, 60, 97. Output: For each element of the sequence that you generate, display the following: the number in decimal notation (using syscall 1). the number in hexadecimal. the number of 1-bits in the binary representation of the number.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

Hi, can someone help write this MIPS assembly language program? It is based on the Fibonacci sequence. I am supposed to take in 3 inputs. 1st input is the first number in the sequence, the 2nd input is the 2nd number in the Fibonacci sequence. These are supposed to add up to start the sequence. The 3rd input from the user is supposed to tell the program how many numbers you need to generate. I then have to display the number is HEX and also the number of 1s in the binary sequence of the number displayed. Thanks!

Input
Read three input values from the keyboard:
the first number in the sequence,
the second number in the sequence, and
the number of elements of the sequence.
Each element of the sequence (beyond the first two) is equal to the sum of the previous two. For example, if the user inputs 3, 1, and 10, then
your program should generate the sequence 3, 1, 4, 5, 9, 14, 23, 37, 60, 97.
Output:
For each element of the sequence that you generate, display the following:
the number in decimal notation (using syscall 1).
the number in hexadecimal.
the number of 1-bits in the binary representation of the number.
For the example above, you would display
3
Ox00000003
2
1
0x00000001
1
4
0x00000004
1
Transcribed Image Text:Input Read three input values from the keyboard: the first number in the sequence, the second number in the sequence, and the number of elements of the sequence. Each element of the sequence (beyond the first two) is equal to the sum of the previous two. For example, if the user inputs 3, 1, and 10, then your program should generate the sequence 3, 1, 4, 5, 9, 14, 23, 37, 60, 97. Output: For each element of the sequence that you generate, display the following: the number in decimal notation (using syscall 1). the number in hexadecimal. the number of 1-bits in the binary representation of the number. For the example above, you would display 3 Ox00000003 2 1 0x00000001 1 4 0x00000004 1
Ox00000003
2
0x00000001
4
0x00000004
5
0x00000005
2
9
Ox00000009
2
14
O×0000000E
23
0x00000017
4
37
Ox00000025
3
60
Ox0000003C
4
97
Ox00000061
The hex version can be displayed using system call 34.
You will not need to use either arrays or recursion for this problem. You are required to write a function which counts the number of ones in a
number. (Hint: Think about using bit operations to isolate each bit in the number, and add them together.)
Make sure to document your programs thoroughly. (This is especially important in assembly language programs, since the code itself is less
easily read than high-level language code.) This should include:
A block of comment lines at the beginning of the source file, giving the name and author of the program and a black-box description of
what it does.
A few comment lines between major sections of the program, describing the contents of each section.
A comment at the end of most source lines, describing what the instruction on that line does.
Transcribed Image Text:Ox00000003 2 0x00000001 4 0x00000004 5 0x00000005 2 9 Ox00000009 2 14 O×0000000E 23 0x00000017 4 37 Ox00000025 3 60 Ox0000003C 4 97 Ox00000061 The hex version can be displayed using system call 34. You will not need to use either arrays or recursion for this problem. You are required to write a function which counts the number of ones in a number. (Hint: Think about using bit operations to isolate each bit in the number, and add them together.) Make sure to document your programs thoroughly. (This is especially important in assembly language programs, since the code itself is less easily read than high-level language code.) This should include: A block of comment lines at the beginning of the source file, giving the name and author of the program and a black-box description of what it does. A few comment lines between major sections of the program, describing the contents of each section. A comment at the end of most source lines, describing what the instruction on that line does.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 7 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education