spring elec 5200 0016200 001 lecture 3 10 registers

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: register contains 32 bits Spring 2013, Jan 25 . . . Spring ELEC 5200-001/6200-001 Lecture 3 10 Registers vs. Memory Arithmetic instructions operands must be registers 32 registers provided Compiler associates variables with registers. What about programs with lots of variables? Must use What memory. memory. Control Input Memory Datapath Processor Output I/O 2004 © Morgan Kaufman Publishers Spring 2013, Jan 25 . . . Spring ELEC 5200-001/6200-001 Lecture 3 11 Memory Organization Viewed as a large, single-dimension array, with an Viewed address. address. A memory address is an index into the array. "Byte addressing" means that the index points to a byte "Byte of memory. of Byte 0 byte 1 byte 2 byte 3 32 bit word 8 bits of data 32 bit word 8 bits of data 32 bit word 8 bits of data 32 bit word 8 bits of data . 8 bits of data . . byte 4 Spring 2013, Jan 25 . . . Spring 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data byte 10 ELEC 5200-001/6200-001 Lecture 3 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 2004 © Morgan Kaufman Publishers 12 Memory Organization Bytes are nice, but most data items use larger "words" For MIPS, a word contains 32 bits or 4 bytes. 0 4 word addresses 8 12 ... . 32 bits of data 32 bits of data 32 bits of data 32 bits of data 32 bits of data Registers hold 32 bits of data Use 32 bit address 32 232 bytes with addresses from 0 to 232 – 1 32 230 words with addresses 0, 4, 8, ... 232 – 4 Words are aligned Words i.e., what are the least 2 significant bits of a word address? 2004 © Morgan Kaufman Publishers Spring 2013, Jan 25 . . . Spring ELEC 5200-001/6200-001 Lecture 3 13 Instructions Load and store instructions Example: C code: A[12] = h + A[8]; MIPS code: lw $t0, 32($s3) #addr of A in reg s3 add $t0, $s2, $t0 #h in reg s2 sw $t0, 48($s3) Can refer to registers by name (e.g., $s2, $t2) instead of number Store word has destination last R...
View Full 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