{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

code-trace-simulated-quiz-solution

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

Info icon This 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
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern