#### LSU EE 3755 Fall 2011 MIPS Homework template.############# #### Instructions: #### #### Copy this to a file( name it f11.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 $s2, $s3, $s4 ## addi $t1, $t2,0x20 ## nop ## beq $t2, $t3, 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 order of each word ##(print all words in ascending order; 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 8 and the number of total words is less than 16. ############################################################# ## Do all of your work on the template file. ##Problem 2.1(10 pts) ## One way to solve this problem is saving each words on memory locations and sorting each words. ## 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 or modified method to solve this problem.(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(10pts) Look at the problem 4 of Spring 2007 MIPS Homework. (The code will help you a little bit doing problem 2.4) ##Briefly Explain the code ##( your answer comes here) ## ## ## ## ##Problem 2.4 Complete the code and produce proper output by using xspim (50pts) ################################################################ .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 order 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