lecture 12 MIPS assembly language 5 - coprocessor 1 (floating - - PowerPoint PPT Presentation

lecture 12 mips assembly language 5
SMART_READER_LITE
LIVE PREVIEW

lecture 12 MIPS assembly language 5 - coprocessor 1 (floating - - PowerPoint PPT Presentation

lecture 12 MIPS assembly language 5 - coprocessor 1 (floating point unit FPU) - coprocessor 0 (kernel use, exception handing) February 17, 2016 lecture 12 MIPS assembly language 5 - coprocessor 1 (floating point unit FPU) -


slide-1
SLIDE 1

lecture 12 MIPS assembly language 5

  • coprocessor 1 (floating point unit FPU)
  • coprocessor 0 (kernel use, exception handing)

February 17, 2016

slide-2
SLIDE 2
slide-3
SLIDE 3

lecture 12 MIPS assembly language 5

  • coprocessor 1 (floating point unit FPU)
  • coprocessor 0 (kernel use, exception handling)

February 17, 2016 Example: arithmetic overflow addi $s0, $0, 1 # $s0 = 2^0 sll $s0, $s0, 30 # $s0 = 2^30 add $t0, $s0, $s0 # $t0 = 2^31 This causes overflow because largest signed number is 2^31 - 1.

slide-4
SLIDE 4

addi $s0, $0, 1 # $s0 = 1 sll $s0, $s0, 30 # $s0 = 2^30 addi $s0, $s0, -1 # $s0 = 2^30 - 1 add $t0, $s0, $s0 # $t0 = 2^31 - 2 This does not cause overflow, because it is within the range allowed for signed numbers. addi $s0, $0, 1 sll $s0, $s0, 30 # $s0 = 2^30 mtc1 $s0, $f0 cvt.s.w $f0, $f0 # $f0 = 2^30 mul.s $f0, $f0, $f0 # $f0 = 2^60 mul.s $f0, $f0, $f0 # $f0 = 2^120 mul.s $f0, $f0, $f0 # $f0 = 2^240 -> overflow In fact, what happens is $f0 = +infinity (no exception)

slide-5
SLIDE 5

Announcements

Quiz 3 on Monday ( Lastname I-P in Arts 145) It will cover lectures 8, 9, 10 (not this week's lectures) A2 is due next Sunday at midnight. A3 will be posted early next week and will be due on the last day of Reading Week (~3 weeks from now).