cse331-week3 - CSE 331 Computer Organization and Design...

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

View Full Document Right Arrow Icon
CSE331 W03.1 KB Fall 2008 PSU CSE 331 Computer Organization and Design Spring 2008 Week 3 Section 1: Course material on ANGEL: cms.psu.edu [Thanks to M. J. Irwin versions of D. Patterson slides ]
Background image of page 1

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

View Full DocumentRight Arrow Icon
CSE331 W03.2 KB Fall 2008 PSU Head’s Up CSE 331.1&2 – Exam 1 on 9/29/2008 (MON) - 6:30-7:45 p.m. – 101Thomas EXAM 2 (Both classes) - 11/10/2008 (Mon) - 6:30-7:45 p.m. – 119 Osmond Introduction to MIPS assembler, adds/loads/stores This week’s material MIPS control flow and logic operations - Reading assignment - PH 2.6 & 2.5 & 2.8-2.9 (1 st part) Next week’s material Supporting procedure calls and returns; addressing modes - Reading assignment - PH: 2.7 & 2.9, A.6, D.2 Reminders: Do your online Quiz 1,2 during 2.30PM to 11-55 PM Angel Online Quiz both 1 and 2 are due (by 11:55pm 9-12-08 Friday) HW # 3 (another spim assignment) will be due (by 9-18-08 11:55pm)
Background image of page 2
CSE331 W03.3 KB Fall 2008 PSU
Background image of page 3

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

View Full DocumentRight Arrow Icon
CSE331 W03.4 KB Fall 2008 PSU Review: Signed Binary Representation 2’sc binary decimal 1000 -8 1001 -7 1010 -6 -5 -4 -3 -2 1111 -1 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 2 3 - 1 = -(2 3 - 1) = -2 3 = 1010 complement all the bits 1011 and add a 1 complement all the bits 0101 and add a 1 0110
Background image of page 4
CSE331 W03.5 KB Fall 2008 PSU 32-bit signed numbers (2’s complement): 0000 0000 0000 0000 0000 0000 0000 0000 two = 0 ten 0000 0000 0000 0000 0000 0000 0000 0001 two = + 1 ten ... 0111 1111 1111 1111 1111 1111 1111 1110 two = + 2,147,483,646 ten 0111 1111 1111 1111 1111 1111 1111 1111 two = + 2,147,483,647 ten 1000 0000 0000 0000 0000 0000 0000 0000 two = – 2,147,483,648 Review: MIPS Number Representations maxint minint Converting <32 bit values into 32 bit values copy the most significant bit (the sign bit) into the “empty” bits 0010 -> 0000 0010 1010 -> 1111 1010 sign extend versus zero extend MSB LSB
Background image of page 5

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

View Full DocumentRight Arrow Icon
CSE331 W03.6 KB Fall 2008 PSU Review: MIPS Organization Processor Memory 32 bits 2 30 words read/write addr read data write data word address (binary) 0…0000 0…0100 0…1000 0…1100 1…1100 Register File src1 addr src2 addr dst addr write data 32 bits src1 data src2 data 32 registers ($zero - $ra) 32 32 32 32 32 32 5 5 5 ALU 32 32 32 0 1 2 3 7 6 5 4 byte address (big Endian) Arithmetic instructions – to/from the register file Load/store instructions – from/to memory Fetch Decode Exec
Background image of page 6
CSE331 W03.7 KB Fall 2008 PSU Review: MIPS Instructions, so far Category Instr OpCode Example Meaning Arithmetic (R format) add 0 & 20 add $s1, $s2, $s3 $s1 = $s2 + $s3 subtract 0 & 22 sub $s1, $s2, $s3 $s1 = $s2 - $s3 Arithmetic (I format) add immediate 8 addi $s1, $s2, 4 $s1 = $s2 + 4 Data transfer (I format) load word 23 lw $s1, 100($s2) $s1 = Memory($s2+100) store word 2b sw $s1, 100($s2) Memory($s2+100) = $s1 hex
Background image of page 7

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

View Full DocumentRight Arrow Icon
CSE331 W03.8 KB Fall 2008 PSU Decision making instructions alter the control flow i.e., change the "next" instruction to be executed MIPS conditional branch instructions: bne $s0, $s1, Lbl #go to Lbl if $s0 $s1 beq $s0, $s1, Lbl #go to Lbl if $s0=$s1 Example: if (i==j) h = i + j; bne $s0, $s1, Lbl1 add $s3, $s0, $s1 Lbl1: ... Instructions for Making Decisions
Background image of page 8
CSE331 W03.9 KB Fall 2008 PSU Instructions: bne $s0, $s1, Lbl #go to Lbl if $s0 $s1 beq $s0, $s1, Lbl #go to Lbl if $s0=$s1 Machine Formats: How is the branch destination address specified?
Background image of page 9

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

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

Page1 / 53

cse331-week3 - CSE 331 Computer Organization and Design...

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

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