Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MIPS PROGRAM (catz.asm) Develop a MIPS the following MIPS program. B. (catz.asm) Develop MIPS program to writes out text strings to produce the output as
MIPS PROGRAM (catz.asm) Develop a MIPS the following MIPS program. B. (catz.asm) Develop MIPS program to writes out text strings to produce the output as shown below. FAT CAT RAN FAST Requirements: 0. Name the file catz.asm 1. Name the strings Fat, Cat, Ran and Fast. 2. The output must be aligned exactly as shown. 3. Run Qtspim (PCSPIM) on catz.asm. 4. Save the log file as catz.log. 5. Submit catz.asm and catz.log. Hint: 1. rename the DEMO program demo.asm file to catz.asm. 2. Mark up the source listing to delete unneeded data and instructions. 3. Create/rename strings to meet requirements of this assignment.
DEMO PROGRAM demo.asm file # Solution Description (pseudo-code): # # int X = 14; # int Y; # # Y = X + 5 + X; # # write "X = ", X; # write "Y = ", Y; # # ================================================================== # ================================================================== # # REGISTER USAGE # ---------------------------------- # Reg Variable/Expression # ---- ------------------- # $s0 X # $s1 Y # $t2 temp (X + 5) # # ================================================================== # # *********************** # ****** DATA SECTION -- FULL WORD data FIRST, then half-word, then bytes. # *********************** # .data X: .word 14 Y: .word 0 endline: .asciiz " " X_outlabel: .asciiz " X = " Y_outlabel: .asciiz " Y = " copyright: .asciiz " (c) 2013, unixlogin Firstname Lastname " # # *********************** # ****** CODE SECTION # *********************** # .text #--| START main: #-------------------------------------------- #--| Perform the calculation Y = X + 5 + X. #-------------------------------------------- lw $s0, X #-|$s0 <== X addi $t2, $s0, 5 #-|$t2 <= X + 5 add $s1, $s0, $t2 #-|$s1 <= X + (X + 5) sw $s1, Y #-|$s1 ==> Y #-------------------------------------------- #--| Print labeled output for X, then Y . #--| a) write "X = ", X; #--| b) write "Y = ", Y; #-------------------------------------------- #-| cout << " X = " li $v0, 4 la $a0, X_outlabel syscall #-| cout << X li $v0, 1 move $a0, $s0 syscall #-| cout << endl; li $v0, 4 la $a0, endline syscall #-| cout << " Y = " li $v0, 4 la $a0, Y_outlabel syscall #-| cout << Y li $v0, 1 move $a0, $s1 syscall #-| cout << endl; li $v0, 4 la $a0, endline syscall #-------------------------------------------- #--| Print copyright and terminate program. #-------------------------------------------- li $v0, 4 la $a0, copyright syscall #-| Terminate program [e.g., return 0;]. li $v0, 10 syscall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started