{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
CSE331 W03.1 KB Spring 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 ]
Image of page 1

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

View Full Document Right Arrow Icon
CSE331 W03.2 KB Spring 2008 PSU Head’s Up CSE 331.1&2 – Exam 1 on 2/14/2007 - 6:30-7:45 p.m. – 26 HOSLER EXAM 2 - 3/27/2007 - 6:30-7:45 p.m. - 26 Hosler 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: 2-5-07. 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 2-5-07 Monday) HW # 3 (another spim assignment) will be due (by 2-12-07 11:55pm)
Image of page 2
CSE331 W03.3 KB Spring 2008 PSU
Image of page 3

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

View Full Document Right Arrow Icon
CSE331 W03.4 KB Spring 2008 PSU Review: Signed Binary Representation 2’sc binary decimal 1000 -8 1001 -7 1010 -6 1011 -5 -4 -3 -2 1111 -1 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 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
Image of page 4
CSE331 W03.5 KB Spring 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
Image of page 5

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

View Full Document Right Arrow Icon
CSE331 W03.6 KB Spring 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
Image of page 6
CSE331 W03.7 KB Spring 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
Image of page 7

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

View Full Document Right Arrow Icon
CSE331 W03.8 KB Spring 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
Image of page 8
CSE331 W03.9 KB Spring 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 Assembling Branches op rs rt 16 bit number I format 5 16 17 ????
Image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the 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