CS 3841 Computer Organization II Recitation LAB6 - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

CS 3841 Computer Organization II Recitation LAB6

Description:

Trace (after input 'AB') 13. Trace (convert A' to a') 14. Trace ... Exercise. Download the ... store a and b. Modify the code to fix the problem (ab ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 19
Provided by: csU66
Category:

less

Transcript and Presenter's Notes

Title: CS 3841 Computer Organization II Recitation LAB6


1
CS 3841 Computer Organization IIRecitation LAB6
  • - Debugging -

LI XU
2
XSpim
  • Registers
  • function keys
  • Text segment
  • Data segment
  • Messages

3
Text segment
  • MIPS instructions
  • First column - hexadecimal address
  • Second - encoded machine language
  • Last - original assembly code

4
Data segment
  • MIPS memory data
  • DATA, STACK, KERNEL DATA

5
Registers
  • Shows the contents of
  • All 32 general purpose registers
  • floating point registers, and a few others

6
Function Keys
  • Run
  • Break points
  • Step
  • step ltNgt

7
Function Keys
  • Continue
  • Set value
  • Print

8
Example
  • Convert capital string to lowercase string.
  • Read a string from keyboard
  • Convert the capital letter to lowercase letter.
  • Print the result
  • Expect ABCD ? abcd

9
Pseudo code
  • i 0
  • read_char string_inputi
  • while (read_char ! EndOfString)
  • lower_char read_char 32
  • string_outputi lower_char
  • i
  • read_char string_inputi
  • string_outputi EndOfString

10
Assembly code (part)
  • li t0, 0 t0 is index register
  • lb t1, str_in(t0) read one character
  • loop
  • beq t1, 0, end if (string end)
    goto end
  • add t2, t1, 32 a A 32
  • sb t2, str_out(t0) write one charater
  • add t0, t0, 1 increase index by 1
  • lb t1, str_in(t0) read one character
  • b loop repeat the loop
  • end
  • sb zero, str_out(t0) mark the end of
    string
  • Wrong result ABCD ? abcd

11
Trace (init status)
12
Trace (after input AB)
13
Trace (convert A to a)
14
Trace (convert B to b)
15
Trace (unexpected converting)
16
ASCII Chart
17
Trace (result)
  • Reason
  • Null ASCII cord 0
  • New line ASCII cord 10

18
Exercise
  • Download the following code and run.
  • Run the instructions one by one by using Single
    Step.
  • Find the addresses that store A and B.
  • Find the data bytes store a and b.
  • Modify the code to fix the problem (ab)
Write a Comment
User Comments (0)
About PowerShow.com