2008SpCS61C-L10-ddg-decisionsII

2008SpCS61C-L10-ddg-decisionsII -...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CS61C L10 Introduction to MIPS : Decisions II (1) Garcia, Spring 2008 © Click to edit Master subtitle style inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 10 – Introduction to MIPS Decisions II 2008-02-13 Spore : 2008-09-07 In what may be regarded as the most anticipated game in a long time, EA will be releasing Maxis’ Spore on PCs / Macs / Nintendo DS™, and mobile phones in the fall. Players will be able to “create and evolve life, establish tribes, build Lecturer SOE Dan Garcia www.spore.com Obama sweeps 8th state in a row; it’s getting tight!
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS61C L10 Introduction to MIPS : Decisions II (2) Garcia, Spring 2008 © Revie Memory is byte -addressable, but lw and sw access one word at a time. A pointer (used by lw and sw ) is just a memory address, so we can add to it or subtract from it (using offset). A Decision allows us to decide what to execute at run-time rather than compile- time. C Decisions are made using conditional statements within if , while , do while , for . MIPS Decision making instructions are the conditional branches : beq and bne .
Background image of page 2
CS61C L10 Introduction to MIPS : Decisions II (3) Garcia, Spring 2008 © Last time: Loading, Storing bytes In addition to word data transfers ( lw , sw ), MIPS has byte data transfers: load byte: lb store byte: sb same format as lw , sw E.g., lb $s0, 3($s1) contents of memory location with address = sum of “3” + contents of register s1 is copied to the low byte position of register
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS61C L10 Introduction to MIPS : Decisions II (4) Garcia, Spring 2008 © x Loading, Storing bytes What do with other 24 bits in the 32 bit register? byte loade d …is copied to “sign- extend” This bit xxxx xxxx xxxx xxxx xxxx xxxx zzz zzzz Normally don’t want to sign extend chars MIPS instruction that doesn’t sign extend when loading bytes:
Background image of page 4
L10 Introduction to MIPS : Decisions II (5) Garcia, Spring 2008 © Overflow in Arithmetic (1/2) Reminder: Overflow occurs when there is a mistake in arithmetic due to the limited precision in computers. Example (4-bit unsigned numbers):
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 24

2008SpCS61C-L10-ddg-decisionsII -...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online