DOC PREVIEW
Berkeley COMPSCI 61C - Lecture 13 MIPS Instruction Representation I

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Review61C Levels of Representation (abstractions)Overview – Instruction RepresentationBig Idea: Stored-Program ConceptConsequence #1: Everything AddressedConsequence #2: Binary CompatibilityInstructions as Numbers (1/2)Instructions as Numbers (2/2)Instruction FormatsR-Format Instructions (1/5)R-Format Instructions (2/5)R-Format Instructions (3/5)R-Format Instructions (4/5)R-Format Instructions (5/5)R-Format Example (1/2)R-Format Example (2/2)AdministriviaI-Format Instructions (1/4)I-Format Instructions (2/4)I-Format Instructions (3/4)I-Format Instructions (4/4)I-Format Example (1/2)I-Format Example (2/2)Peer InstructionIn conclusion…inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 13MIPS Instruction Representation I 2008-02-22AFTER MOORE’S LAW?The National Science Foundation (NSF) requested $20 million to start the “Science and Engineering Beyond Moore’s Law” effort, to fund academic research in carbon nanotubes, quantum computing, massively multicore computers, etc. (that could improve and replace current transistor technology). That’s great for Cal – leaders in these! Lecturer SOE Dan Garciawww.pcworld.com/article/id,142561-page,1/article.htmlCS61C L12 MIPS Instruction Representation I (2)Garcia, Spring 2008 © UCBRegister Conventions: Each register has a purpose and limits to its usage. Learn these and follow them, even if you’re writing all the code yourself.Logical and Shift InstructionsOperate on bits individually, unlike arithmetic, which operate on entire word.Use to isolate fields, either by masking or by shifting back and forth.Use shift left logical, sll,for multiplication by powers of 2Use shift right arithmetic, sra,for division by powers of 2.New Instructions:and, andi, or, ori, sll, srl, sraReviewCS61C L12 MIPS Instruction Representation I (3)Garcia, Spring 2008 © UCBHigh Level Language Program (e.g., C)Assembly Language Program (e.g.,MIPS)Machine Language Program (MIPS)Hardware Architecture Description (e.g., block diagrams) CompilerAssemblerMachine Interpretationtemp = v[k];v[k] = v[k+1];v[k+1] = temp;lw $t0, 0($s2)lw $t1, 4($s2)sw $t1, 0($s2)sw $t0, 4($s2)0000 1001 1100 0110 1010 1111 0101 10001010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 Logic Circuit Description (Circuit Schematic Diagrams)Architecture ImplementationRegister FileALU61C Levels of Representation (abstractions)CS61C L12 MIPS Instruction Representation I (4)Garcia, Spring 2008 © UCBOverview – Instruction RepresentationBig idea: stored program consequences of stored programInstructions as numbersInstruction encoding MIPS instruction format for Add instructionsMIPS instruction format for Immediate, Data transfer instructionsCS61C L12 MIPS Instruction Representation I (5)Garcia, Spring 2008 © UCBBig Idea: Stored-Program ConceptComputers built on 2 key principles:Instructions are represented as bit patterns - can think of these as numbers.Therefore, entire programs can be stored in memory to be read or written just like data.Simplifies SW/HW of computer systems: Memory technology for data also used for programsCS61C L12 MIPS Instruction Representation I (6)Garcia, Spring 2008 © UCBConsequence #1: Everything AddressedSince all instructions and data are stored in memory, everything has a memory address: instructions, data wordsboth branches and jumps use theseC pointers are just memory addresses: they can point to anything in memoryUnconstrained use of addresses can lead to nasty bugs; up to you in C; limits in JavaOne register keeps address of instruction being executed: “Program Counter” (PC)Basically a pointer to memory: Intel calls it Instruction Address Pointer, a better nameCS61C L12 MIPS Instruction Representation I (7)Garcia, Spring 2008 © UCBConsequence #2: Binary CompatibilityPrograms are distributed in binary formPrograms bound to specific instruction setDifferent version for Macintoshes and PCsNew machines want to run old programs (“binaries”) as well as programs compiled to new instructionsLeads to “backward compatible” instruction set evolving over timeSelection of Intel 8086 in 1981 for 1st IBM PC is major reason latest PCs still use 80x86 instruction set (Pentium 4); could still run program from 1981 PC todayCS61C L12 MIPS Instruction Representation I (8)Garcia, Spring 2008 © UCBInstructions as Numbers (1/2)Currently all data we work with is in words (32-bit blocks):Each register is a word.lw and sw both access memory one word at a time.So how do we represent instructions?Remember: Computer only understands 1s and 0s, so “add $t0,$0,$0” is meaningless.MIPS wants simplicity: since data is in words, make instructions be words tooCS61C L12 MIPS Instruction Representation I (9)Garcia, Spring 2008 © UCBInstructions as Numbers (2/2)One word is 32 bits, so divide instruction word into “fields”.Each field tells processor something about instruction.We could define different fields for each instruction, but MIPS is based on simplicity, so define 3 basic types of instruction formats:R-formatI-formatJ-formatCS61C L12 MIPS Instruction Representation I (10)Garcia, Spring 2008 © UCBInstruction FormatsI-format: used for instructions with immediates, lw and sw (since offset counts as an immediate), and branches (beq and bne), (but not the shift instructions; later)J-format: used for j and jal R-format: used for all other instructionsIt will soon become clear why the instructions have been partitioned in this way.CS61C L12 MIPS Instruction Representation I (11)Garcia, Spring 2008 © UCBR-Format Instructions (1/5)Define “fields” of the following number of bits each: 6 + 5 + 5 + 5 + 5 + 6 = 32For simplicity, each field has a name:Important: On these slides and in book, each field is viewed as a 5- or 6-bit unsigned integer, not as part of a 32-bit integer.Consequence: 5-bit fields can represent any number 0-31, while 6-bit fields can represent any number 0-63.6 5 5 5 65opcode rs rt rd functshamtCS61C L12 MIPS Instruction Representation I (12)Garcia, Spring 2008 © UCBR-Format Instructions (2/5)What do these field integer values tell us?opcode: partially specifies what instruction it is Note: This number is equal to 0 for all R-Format instructions.funct: combined with opcode,


View Full Document

Berkeley COMPSCI 61C - Lecture 13 MIPS Instruction Representation I

Documents in this Course
SIMD II

SIMD II

8 pages

Midterm

Midterm

7 pages

Lecture 7

Lecture 7

31 pages

Caches

Caches

7 pages

Lecture 9

Lecture 9

24 pages

Lecture 1

Lecture 1

28 pages

Lecture 2

Lecture 2

25 pages

VM II

VM II

4 pages

Midterm

Midterm

10 pages

Load more
Download Lecture 13 MIPS Instruction Representation I
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 13 MIPS Instruction Representation I and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 13 MIPS Instruction Representation I 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?