code-trace-simulated-quiz-solution - andi $t6, $t1, 0x0F...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 341 Fall 2011 Code Trace Exercise Solution Consider the following program. A breakpoint is set at bkpt . Trace the program as it is executed. Indicate the values of registers t1, t4, t6, and v0 each time a breakpoint is hit and at the end of the program. In addition, complete the memory map, reflecting the contents of memory after the program has finished execution. Note that your answers should be the same as if you ran this program in XSPIM on the CSE Unix/Linux timeshare machines in bare mode and set a breakpoint at next . Any unknown (uninitialized) values should be indicated by a dash (-). You may not need all the lines provided. The initial value of register a0 is 0x0000000A. main: add $v0, $0, $0 sll $s2, $a0, 4 lui $s1, 0x1000 bkpt: lbu $t1, ($s1) andi $t4, $t1, 0xF0 beq $t1, $0, report sll $t5, $t4, 4 bne $t4, $s2, lower
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: andi $t6, $t1, 0x0F addi $v0, $v0, 1 lower: bne $a0, $t6, bkpt addi $s1, $s1, 1 addi $v0, $v0, 1 j bkpt or $t0, $0, $0 report: lui $s1, 0x1000 sb $v0, ($s1) At Breakpoint t1: 0x00000000 t4: 0x00000000 t6: 0x00000000 v0: 0x00000000 At Breakpoint t1: 0x00000005 t4: 0x00000000 t6: 0x00000005 v0: 0x00000000 At Breakpoint t1: 0x000000AE t4: 0x00000000 t6: 0x0000000E v0: 0x00000000 At Breakpoint t1: 0x0000004A t4: 0x000000A0 t6: 0x0000000A v0: 0x00000002 At End t1: 0x00000000 t4: 0x00000040 t6: 0x0000000A v0: 0x00000002 Contents Address 0x10000000 0x10000008 0x10000002 0x1000000A 0x10000004 0x1000000C 0x10000006 0x1000000E 0x1000000F 0x1000000E 0x00 0x00 0x5E 0xAC 0x00 0x08 0xAE 0xFA 0x90 0xFE 0x80 0x04 0x4A 0x8A 0x02 0x05 Changes to the memory map are shown in red...
View Full Document

This document was uploaded on 11/03/2011 for the course CSE 341 at SUNY Buffalo.

Ask a homework question - tutors are online