#### LSU EE 3755 Spring 2010 MIPS Homework template.############# #### Instructions: #### #### Copy this to a file( name it s10.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 $t1, $s1, $s2 ## addi $t1, $s1,0x20 ## nop ## beq $t1, $s1, 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 0x20. ## 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 answer for the problem 1. ## ## ## ## ## ##//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 ## length of each word(print all words in increasing length;the example is given at the output format.). ## Words here means character or group of characters separated by space. ## For the simplicity of the program, assume every character in the paragraph is upper case. ## Also assume the longest word ## length is 15 and the number of total words is less than 30. ## Problem 2.1(10 pts) ## One simple way to solve this problem is scanning the whole text 15 times. ## At your first scanning the text, you will only print the words which has word length one. ## At your second scanning the text, you will only print the words which has word length two. ## At your third scanning the text, you will only print the words which has word length three and so on. ## After scanning the text 15 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) .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 " The text is " .align 4 word_msg1: .asciiz " The words separated by the length are " .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