Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment #3 igPay atinLay Objectives: To learn how to program in the RISC-V assembly language, including: assembly language instructions string manipulation traps basic I/O Your

Assignment #3 igPay atinLay

Objectives:

To learn how to program in the RISC-V assembly language, including:

  • assembly language instructions
  • string manipulation
  • traps
  • basic I/O

Your program will translate words from English to Pig Latin. To translate to Pig Latin, remove the starting letter of the word and put it at the end. Then add "ay" to the word. Some sample translations:

Doggy translates to oggDay

couch translates to ouchcay

binary translates to inarybay

Extra Credit (2 points):

A proper Pig Latin translator would check to see if the word starts with a vowel and simply append "way" to the end without removing anything from the front. You may earn 2 points extra credit if you implement this. You only have to handle lowercase letters. Sample translation:

otay translates to otayway

You can do this any way that you want, but its MUCH cooler if you can do it in a loop, rather than by checking each vowel one by one with separate code.

Description:

Input:

Your program should prompt the user for the word to be translated. Please read the following requirements and hints carefully.

  • The user is to input a word of no more than 19 characters, followed by the key. Assume the user will not enter a message longer than 19 characters. Checking for too many characters is NOT necessary.
  • Store the word one character per location in memory. You must store the word.
  • Your program must allocate room to store 20 characters. Do not allot space for more than 20 characters in memory. Look at the assembler directive for how to set aside space.
  • The only traps you may use are
  • PrintString (ecall 4)
  • Exit (ecall 10)
  • PrintChar (ecall 11)
  • ReadChar (ecall 12),
  • YOU MAY NOT USE READSTRING!
  • Hint #2: The key is ASCII x0A or ASCII x0D. (It is different on the Windows and Linux machines. Check to see which one your machine uses.)
  • Hint #3: For reasons that will become clear to you later, only use t0-t6 to hold anything for this assignment.

Translation Algorithm:

1. Remove (do not print) the first letter of the word and put (print) it at the end of the word.

2. Add "ay" to the word.

Output:

  • You must print prompts for the English word and Pig-Latin word (see below).
  • The translated word should be output to the screen and does not need to be stored.
  • After outputting the translated word to the screen, the program should prompt the user again, creating an endless loop.
  • Your program should then output the translated word to the screen. Following is a sample run of the program (input shown in bold for clarity only)
  • ur input/output format must match the above example.
  • A single character merely appends ay, or way at the end as appropriate.
  • An empty string prints nothing, and just prompts for another English Word
  • Code Format:

    Your code should be a single text file of RISC-V assembly code.

  • Comment your code. There must be a header block at the top with your name and a description of the program. Include a description of what you use each register for. Then comment blocks of code underneath. You do not need to comment every line.
  • Other Information:

  • Name your assembly file pigLatin.asm. Assemble it using the 'asm' button in the RARS Editor
  • Your program must loop and run correctly multiple times in a row.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions