L09 - CS61C Machine Structures Lecture 9 MIPS Load/Store...

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

View Full Document Right Arrow Icon
CS 61C L09 MIPS Load/Store, Branch (1) Wawrzynek Fall 2007 © UCB 9/17/2007 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS61C – Machine Structures Lecture 9 - MIPS Load/Store & Branch Instructions CS 61C L09 MIPS Load/Store, Branch (2) Wawrzynek Fall 2007 © UCB Review ° In MIPS Assembly Language: Registers replace variables One Instruction (simple operation) per line Simpler is Better, Smaller is Faster ° Instructions introduced: add, addi, sub ° General Purpose Registers Introduced: C Variables: $s0 - $s7 Temporary Variables: $t0 - $t7 Zero: $zero
Image of page 1

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

View Full Document Right Arrow Icon
CS 61C L09 MIPS Load/Store, Branch (3) Wawrzynek Fall 2007 © UCB Assembly Operands: Memory ° C variables map onto registers; what about large data structures like arrays? ° 1 of 5 components of a computer: memory contains such data structures ° But MIPS arithmetic instructions only operate on registers, never directly on memory. ° Data transfer instructions transfer data between registers and memory: Memory to register Register to memory CS 61C L09 MIPS Load/Store, Branch (4) Wawrzynek Fall 2007 © UCB Anatomy: 5 components of any Computer Personal Computer Processor Computer Control (“brain”) Datapath Registers Memory Devices Input Output Load (from) Store (to) Store (to) These are “data transfer” instructions… Registers are in the datapath of the processor; if operands are in memory, we must transfer them to the processor to operate on them, and then transfer back to memory when done.
Image of page 2
CS 61C L09 MIPS Load/Store, Branch (5) Wawrzynek Fall 2007 © UCB Data Transfer: Memory to Reg (1/4) ° To transfer a word of data, we need to specify two things: Register : specify this by # ($0 - $31) or symbolic name ($s0,…, $t0, …) Memory address : more difficult - Think of memory as a single one- dimensional array, so we can address it simply by supplying a pointer to a memory address. - Other times, we want to be able to offset from this pointer. ° Remember: “ Load FROM memory CS 61C L09 MIPS Load/Store, Branch (6) Wawrzynek Fall 2007 © UCB Data Transfer: Memory to Reg (2/4) ° To specify a memory address to copy from, specify two things: A register containing a pointer to memory A numerical offset ( in bytes ) ° The desired memory address is the sum of these two values.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
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