Chapter 9 Project - Jedi Name CS120 Spring 2021 Due Date 11:59pm, Thursday, April 29th IMPORTANT!: All programs will be tested in the MARS MIPS IDE environment. If your code does not run in the MARS...

1 answer below »
Follow the instructions provided in the attached file (you dont need to worry about setting up the repository)


Chapter 9 Project - Jedi Name CS120 Spring 2021 Due Date 11:59pm, Thursday, April 29th IMPORTANT!: All programs will be tested in the MARS MIPS IDE environment. If your code does not run in the MARS IDE, it is considered non-functioning EVEN IF IT RUNS ON YOUR PERSONAL COMPUTER or in another IDE like SPIM. Always check that your code runs in MARS before submitting. Driver Code and Test Files · README.md Grading Rubric TOTAL: 30 points · Part A (15 points): · In the jediname subroutine · Reads in First name (2 points) · Reads in Last name (2 points) · Error checks length of names (5 points) · Returns correct jedi name (3 points) · Uses the stack to preserve required registers (3 points) · Part B (13 points): · In the jedipower subroutine: · Uses the stack to preserve required registers (3 points) · Gives the correct value for jedi power (5 points) · Works with all test input cases (5 points) · Part C (2 points): · Follows requested project structure and submission format (1 point) · README is complete (1 point) Guidelines and Policies Getting Help Please follow the debugging guidelines outlined here. We will try to answer questions and provide help within 24 hours of your request. If you do not receive a response in 24 hours, please send the request again. Although we will answer questions, provide clarification, and give general help where possible up until the deadline, we will not help you debug specific code within 24 hours of the deadline. We will not provide any help after the deadline. Guidelines This is an individual assignment. You must do the vast majority of the work on your own. It is permissible to consult with classmates to ask general questions about the assignment, to help discover and fix specific bugs, and to talk about high level approaches in general terms. It is not permissible to give or receive answers or solution details from fellow students. You may research online for additional resources; however, you may not use code that was written specifically to solve the problem you have been given, and you may not have anyone else help you write the code or solve the problem. You may use code snippets found online, providing that they are appropriately and clearly cited, within your submitted code. By submitting this assignment, you agree that you have followed the above guidelines regarding collaboration and research. Pair Programming For the projects, you may choose to work with one other person to complete the lab. If you prefer to work alone, you may. In that case, you can complete the project as normal. However, you will still need to choose a team name. If you would like to work with a partner, please complete the following: 1. One member on your team must click on the repository link and create the team. 2. The second team member must then click on the repository link, and find the correct team. 3. You should now both be able to push and pull from the same repository. 4. Upon submission, both team members must submit the commit hash on Blackboard. a. If you do not submit the commit hash, you will not get credit, even if your partner submits. In this project, you will learn to: · Use all the MIPS you have learned this semester Part A Jedi Name What is your Jedi name? To find out, follow these steps: · Take the first 3 letters of your last name · Add the first 2 letters of your first name · For example, my Jedi name is: Moost (not super proud of that) I have written a python subroutine that asks the user for their first and last name, and then generates and returns their Jedi name (remember, it only returns a reference). Please review this code and ask any questions you may have. def jediName(): first = input("Please enter first name: ") last = input("Please enter last name: ") jediNameStr = last[:3]+first[:2] return jediNameStr def jediPower(jediNameStr): power = 0 for c in jediNameStr: power += ord(c) print(jediNameStr, power) def main(): jname = jediName() jediPower(jname) main() Your job now is to write equivalent code in MIPS Assembly that does the same operations as the above python code. To generate the jedi name, you will need to make a memory buffer to store the data. · You will need to use a subroutine · You will need 3 memory blocks for storing the strings, · first name · last name · jedi name · You should use the .space directive to allocate space. You will need to also store the length of each input buffer (first, last, jedi). · How much space should you allocate for each? You have no idea what the first and last name are, so it is better to allocate more than you think you’ll need. · Since you are generating the jedi name itself, you should know exactly how many bytes you need for that. · Don’t forget the null byte · In your driver code you will need to ensure that the appropriate values are put into registers $a0 and $v0 before making your syscalls · You MUST use the stack to preserve the following registers used by your subroutine: · $s, $t, $ra, $sp Part B: Your Anger Gives You Focus How powerful a Jedi are you? You can determine how powerful a Jedi you are by adding up the total of the ascii values in your Jedi name (note: this may be the geekiest sentence ever written). Write a loop that adds up the values in the Jedi name, and prints the total to the console along with the jedi name. Testing You should write resilient code, so you must verify the input, and output a message if the input is invalid. In other words, if the input for the first or last name is too short, output a message noting that, and end the program. Here’s some sample input we will test with: · Hello World · Hubert Wolfeschlegelsteinhausenbergerdorff · First · · a b · x last Part C Submission Required code organization: · main.s · README.md Below is just a reminder of the commands you should use to submit your code. If you cannot remember the exact process, please review Lab 0. These commands all presume that your present working directory is within the directory tracked by git. You will need to do the following when your submission is ready for grading. git commit -a -m "final commit" git push To complete your submission, you must copy and paste the commit hash into MyCourses. Go to MyCourses, select CS110, and then assignments. Select this lab, and where it says text submission, paste your commit hash. DO NOT PASTE ANYTHING OTHER THAN YOUR COMMIT HASH. Incorrect: “commit hash: 690fa67ed8”. Correct: 690fa67ed8 You can get your latest commit hash with the following command: git rev-parse HEAD Remember, you MUST make a submission on MyCourses before the deadline to be considered on time. Chapter 9 Project - Jedi Name CS120 Spring 2021 Due Date 11:59pm, Thursday, April 29th IMPORTANT!: All programs will be tested in the MARS MIPS IDE environment. If your code does not run in the MARS IDE, it is considered non-functioning EVEN IF IT RUNS ON YOUR PERSONAL COMPUTER or in another IDE like SPIM. Always check that your code runs in MARS before submitting. Driver Code and Test Files · README.md Grading Rubric TOTAL: 30 points · Part A (15 points): · In the jediname subroutine · Reads in First name (2 points) · Reads in Last name (2 points) · Error checks length of names (5 points) · Returns correct jedi name (3 points) · Uses the stack to preserve required registers (3 points) · Part B (13 points): · In the jedipower subroutine: · Uses the stack to preserve required registers (3 points) · Gives the correct value for jedi power (5 points) · Works with all test input cases (5 points) · Part C (2 points): · Follows requested project structure and submission format (1 point) · README is complete (1 point) Guidelines and Policies Getting Help Please follow the debugging guidelines outlined here. We will try to answer questions and provide help within 24 hours of your request. If you do not receive a response in 24 hours, please send the request again. Although we will answer questions, provide clarification, and give general help where possible up until the deadline, we will not help you debug specific code within 24 hours of the deadline. We will not provide any help after the deadline. Guidelines This is an individual assignment. You must do the vast majority of the work on your own. It is permissible to consult with classmates to ask general questions about the assignment, to help discover and fix specific bugs, and to talk about high level approaches in general terms. It is not permissible to give or receive answers or solution details from fellow students. You may research online for additional resources; however, you may not use code that was written specifically to solve the problem you have been given, and you may not have anyone else help you write the code or solve the problem. You may use code snippets found online, providing that they are appropriately and clearly cited, within your submitted code. By submitting this assignment, you agree that you have followed the above guidelines regarding collaboration and research. Pair Programming For the projects, you may choose to work with one other person to complete the lab. If you prefer to work alone, you may. In that case, you can complete the project as normal. However, you will still need to choose a team name. If you would like to work with a partner, please complete the following: 1. One member on your team must click on the repository link and create the team. 2. The second team member must then click on the repository link, and find the correct team. 3. You should now both be able to push and pull from the same repository. 4. Upon submission, both team members must submit the commit hash on Blackboard. a. If you do not submit the commit hash, you will not get credit, even if your partner submits. In this project, you will learn to: · Use all the MIPS you have learned this semester Part A Jedi Name What is your Jedi name? To find out, follow these steps: · Take the first 3 letters of your last name · Add the first 2 letters of your first name · For example, my Jedi
Answered 8 days AfterApr 16, 2021

Answer To: Chapter 9 Project - Jedi Name CS120 Spring 2021 Due Date 11:59pm, Thursday, April 29th IMPORTANT!:...

Sandeep Kumar answered on Apr 25 2021
159 Votes
.data # tells the machine we're in the data field
fspace: .space 81
# creates space in memory for first name
lspace: .space 81 # creates space in memory for second name
nspace: .space 24 # creates space in memory for jedi name
first: .asciiz "Enter your first name:\n" # prompt to ask for first name
last: .asciiz "Enter your last name:\n" # prompt to ask for last name
.text # tells the machine we're in the text field
main: la $a0, first # loads first into $a0
addi $v0, $0, 4 # prints first
syscall # syscall
la $a0, fspace # loads address of space for first...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here