#### LSU EE 3755 Fall 2010 MIPS Homework template.############# #### Instructions: #### #### Copy this to a file( name it f10.asm) and save on your class account. #### Use this file for your solution. #### Your entire solution should be on this file. ## ## Problem 0 : Write down your name and your account. ## Your Name : ####### ## Your Account: ####### ## Problem 1(20pts): ## LOOP: ## 0x400000 add $t2, $s3, $s4 ## addi $t1, $s2,0x10 ## nop ## beq $t2, $s3, LOOP ## ## (For the problem 1) ## Write Machine code for the above 4 instructions without looking the Book or Notes. ## (Hexadecimal format) ## Hint: ## opcode for add is 0 and func field is 0x10. ## opcode for addi is 8 and think about rt and rs fields. ## opcode for beq is 4 ## register number for $s0 is 16 ## register number for $t0 is 8 ## Your solution goes here ## ## ## ## ## ##//Problem 2(80pts) ##Use “ main” at the beginning instead of “__start ” and ##assume delayed branch when you are using xspim or pcspim . ##Write a MIPS program to print the words just like the output format (which is given) after you read the ##text(textdata) ##After scanning textdata, you are required to write a program to print a) whole text b)each word one at a ##time based on the number of vowels on the word(print all words in increasing order based on the number ##of vowels; the example is given at the output format.). ##Word here means character or group of characters separated by space. ##Vowel means a,e,i,o and u. ## ##For the simplicity of the program, assume every character in the paragraph is upper case. Assume the ##longest word length is 15 and the number of total words is less than 30. ##Also assume the maximum number of vowels on a word is 5. ##Problem 2.1(10 pts) ## One simple way to solve this problem is scanning the whole text 5 times. ## At your first scanning the text, you will only print the words which contain one vowel on them. ## At your second scanning the text, you will only print the words which contain two vowels on them. ## At your third scanning the text, you will only print the words which contain three vowels on them and so ## on. ## After scanning the text 5 times and printing, you stop. ## What will be cons of this approach?(10 pts). ##( your answer comes here) ## ## ## ## ## Problem 2.2(10pts) ## Problem 2.2.1 Suggest a new method to overcome the cons of the above approach.(5pts) ## ( your answer comes here) ## ## ## ## ## ## Problem 2.2.2 Briefly explain your method to solve this problem.(5pts) ## ( your answer comes here) ## ## ## ## ## ## ## ## ## ## ## Problem 2.3 Complete the code and produce proper output by using xspim (60pts) ################################################################ (Look at the problem 4 of Spring 2007 MIPS Homework. The code will help you a little bit) .data textdata: .asciiz "IN A DISTANT GALAXY EONS BEFORE THE CREATION OF THE MYTHICAL PLANET KNOWN AS EARTH \n" return: .asciiz "\n" word_msg .asciiz " #words contain " .align 4 word_msg1: .asciiz " vowel(s) on them" .align 4 .text .globl main main: ##hint: use .space to save the words at .data ##for example: saved_words: .space 300 //to save the words ## //at this memory location