AST10201 Computer Organization
Group Project (20%)
MIPS汇编语言代写 My solution: write a procedure “str2int” to check each digit and convert the input string into integer, then another 4 procedures
A. Objective MIPS汇编语言代写
- Solve real life problem using MIPS assembly language
- Evaluate the performance of a program in QtSpim
- Understand how computer organization affects the execution time of computer programs.
B. Requirements of the MIPS assembly program
Write an MIPS assembly program named “numberConverter_[groupNumber].s”. The programme is to convert a number from any base (between 2 and 16) to binary, octal, decimal and hexadecimal number. The requirements for this program are listed below:
Step 1: Get base (integer) from console and number (input string).
Hints:
1. You may create an enough buffer for the input string. For example: You define a buffer with 32 bytes in .date. buffer: .space 32 Later on, in .text you can save the input number into buffer you define, using following instructions:
la $a0, buffer
li $a1, 32
li $v0, 8 # read String
syscall
- You may also want to know the length of string user input. Using the following instructions, assume $a1=$a0 is the address of the first digit:
length: lb $s0, 0($a1)
beq $s0, 10, endString # 10 is the ascii code of new line
addi $a1, $a1, 1
j length
endString:
sub $a1, $a1, $a0
Step 2: Convert the string entered by user to decimal number (integer). If any digit is not less than the base, then print the following string “Each digit should
be between 0 and base-1” on the console window and user will enter a new number again.
Step 3: Convert the number to 4 different number systems: binary, octal, decimal and hexadecimal.
Step 4: In console window, the program will ask user “Do you wanna continue (y/n)?”. If enter “y”, Step 1 to Step 3 are repeated. If enter “n”, it responses “End” to indicate the end of the program.
Your program result should be the same as the following figure. The underlined number or characters in the following figure are inputted by user.
My solution: write a procedure “str2int” to check each digit and convert the input string into integer, then another 4 procedures to print the integer in binary, octal, decimal or hexadecimal. Please refer to my start code “numberConverter_template.s”. You can choose the start code I provide or write the whole program by yourself.
C. Report MIPS汇编语言代写
Write a report named “projectReport_[groupNumber].docx”. The requirements for this report are listed below:
• The cover page should contain course code and course name, group number, each group member’s name, student ID, contribution.
• In the first section of report, answer following questions:
1) Assume now user enter base 2 and string 101110. Explain how many instructions will be executed in “str2int” procedure.
2) Check the memory addresses of the first instruction and the last instruction of your program. How many locations does your program occupy in RAM?
3) Explain which part of your code can be optimized to reduce the execution time of the program. Can you try to make the size of file,
numberConverter_[groupNumber].s, not greater than 5 KB?
• In the second section of report, share your experience on this project, such as: the most difficult part of project, how you find solution to do the project, how much time you spend on this project, what you have learnt through this project, any sense of accomplishment you feel after completing the project.
• In the third section of report, copy and paste source code of your MIPS program for this project.
D. Submission (due date: 12 December 11:55 pm) MIPS汇编语言代写
• Report: projectReport_[groupNumber]. docx
• Source code: numberConverter_[groupNumber].s,
更多代写: HomeWork cs作业 金融代考 postgreSQL代写 IT assignment代写 统计代写 圣约翰学院代写
发表回复
要发表评论,您必须先登录。