DOC PREVIEW
Berkeley COMPSCI 61C - Instructions as Numbers

This preview shows page 1-2-3-4-5-39-40-41-42-43-44-78-79-80-81-82 out of 82 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 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 82 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 82 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Levels of Representation/InterpretationAgendaAgendaKey ConceptsNumber RepresentationNumber RepresentationSigned and Unsigned IntegersUnsigned IntegersSigned Integers and Two’s Complement RepresentationTwo’s Complement IntegersPeer Instruction QuestionPeer Instruction AnswerMIPS Logical InstructionsBit-by-bit DefinitionExamplesExamplesExamplesExamplesExamplesExamplesShiftingShiftingShiftingShiftingShiftingImpact of Signed and Unsigned Integers on Instruction SetsPeer Instruction QuestionPeer Instruction AnswerAgendaAdministriviaCS61c in the NewsDon’t Go Driving with Randy!AgendaGoals for Floating PointScientific Notation (e.g., Base 10)Scientific Notation (e.g., Base 10)Which is Smaller? (i.e., closer to -∞)Which is Smaller? (i.e., closer to -∞)Floating Point: Representing Very Small NumbersBias Notation (+127)What If Operation Result Doesn’t Fit in 32 Bits?Depends on the Programming LanguageDepends on the Programming LanguageDepends on the Programming LanguageMIPS Solution: Offer BothWhat About Real Numbers in Base 2?Floating Point NumbersFloating Point NumbersMore Floating PointMIPS Floating Point InstructionsMIPS Floating Point InstructionsMIPS Floating Point InstructionsPeer Instruction QuestionPeer Instruction AnswerPitfallsAgendaKey ConceptsInstructions as NumbersInstructions as NumbersInstructions as NumbersEverything in a Computer is Just a Binary NumberImplications of Everything is a NumberNames of MIPS fieldsWhat about Load, Store, Immediate, Branches, Jumps?Names of MIPS Fields in I-typeRegister (R), Immediate (I), Jump (J) Instruction FormatsEncoding of MIPS Instructions: Must Be Unique!AgendaSlide 71AgendaSlide 73Slide 74Addressing in BranchesAddressing in BranchesAddressing in JumpsConverting to MIPS Machine codeConverting to MIPS Machine code32 bit Constants in MIPSAssembly and Pseudo-instructions“And in Conclusion, …”CS 61C: Great Ideas in Computer Architecture (Machine Structures)Instructions as NumbersInstructors:Randy H. KatzDavid A. Pattersonhttp://inst.eecs.Berkeley.edu/~cs61c/fa101Spring 2011 -- Lecture #701/14/201901/14/2019 Spring 2011 -- Lecture #7 2Levels of Representation/Interpretationlw $t0, 0($2)lw $t1, 4($2)sw $t1, 0($2)sw $t0, 4($2)High Level LanguageProgram (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;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 ImplementationAnything can be representedas a number, i.e., data or instructions01/14/2019 3Spring 2011 -- Lecture #7We are here!Agenda•Everything is a Number•Administrivia•Overflow and Real Numbers•Instructions as Numbers•Technology Break•Assembly Language to Machine Language•Summary01/14/2019 Spring 2011 -- Lecture #7 4Agenda•Everything is a Number•Administrivia•Overflow and Real Numbers•Instructions as Numbers•Technology Break•Assembly Language to Machine Language•Summary01/14/2019 Spring 2011 -- Lecture #7 5Key Concepts•Inside computers, everything is a number•But everything is of a fixed size–8-bit bytes, 16-bit half words, 32-bit words, 64-bit double words, …•Integer and floating point operations can lead to results too big to store within their representations: overflow/underflow01/14/2019 Spring 2011 -- Lecture #7 6Number Representation•Value of i-th digit is d × Basei where i starts at 0 and increases from right to left:•12310 = 110 x 10102 + 210 x 10101 + 310 x 10100= 1x10010 + 2x1010 + 3x110= 10010 + 2010 + 310= 12310•Binary (Base 2), Hexadecimal (Base 16), Decimal (Base 10) different ways to represent an integer–We use 1two, 5ten, 10hex to be clearer (vs. 12, 48, 510, 1016 )01/14/2019 Spring 2011 -- Lecture #7 7Number Representation•Hexadecimal digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F•FFFhex= 15tenx 16ten2 + 15tenx 16ten1 + 15tenx 16ten0 = 3840ten + 240ten + 15ten = 4095ten•1111 1111 1111two = FFFhex = 4095ten•May put blanks every group of binary, octal, or hexadecimal digits to make it easier to parse, like commas in decimal01/14/2019 Spring 2011 -- Lecture #7 8Signed and Unsigned Integers•C, C++, and Java have signed integers, e.g., 7, -255:int x, y, z;•C, C++ also have unsigned integers, which are used for addresses•32-bit word can represent 232 binary numbers•Unsigned integers in 32 bit word represent 0 to 232-1 (4,294,967,295)01/14/2019 Spring 2011 -- Lecture #7 9Unsigned Integers0000 0000 0000 0000 0000 0000 0000 0000two = 0ten0000 0000 0000 0000 0000 0000 0000 0001two = 1ten0000 0000 0000 0000 0000 0000 0000 0010two = 2ten... ...0111 1111 1111 1111 1111 1111 1111 1101two = 2,147,483,645ten0111 1111 1111 1111 1111 1111 1111 1110two = 2,147,483,646ten0111 1111 1111 1111 1111 1111 1111 1111two = 2,147,483,647ten1000 0000 0000 0000 0000 0000 0000 0000two = 2,147,483,648ten1000 0000 0000 0000 0000 0000 0000 0001two = 2,147,483,649ten1000 0000 0000 0000 0000 0000 0000 0010two = 2,147,483,650ten... ...1111 1111 1111 1111 1111 1111 1111 1101two = 4,294,967,293ten1111 1111 1111 1111 1111 1111 1111 1110two = 4,294,967,294ten1111 1111 1111 1111 1111 1111 1111 1111two = 4,294,967,295ten01/14/2019 Spring 2011 -- Lecture #7 10Signed Integers and Two’s Complement Representation•Signed integers in C; want ½ numbers <0, want ½ numbers >0, and want one 0 •Two’s complement treats 0 as positive, so 32-bit word represents 232 integers from-231 (–2,147,483,648) to 231-1 (2,147,483,647)–Note: one negative number with no positive version–Book lists some other options, all of which are worse–Every computers uses two’s complement today•Most significant bit (leftmost) is the sign bit, since 0 means positive (including 0), 1 means negative–Bit 31 is most significant, bit 0 is least significant01/14/2019 Spring 2011 -- Lecture #7 11Two’s Complement Integers0000 0000 0000 0000 0000 0000 0000 0000two = 0ten0000 0000 0000 0000 0000 0000 0000 0001two = 1ten0000 0000 0000 0000 0000 0000 0000 0010two = 2ten... ...0111 1111 1111 1111 1111 1111 1111 1101two = 2,147,483,645ten0111 1111 1111 1111 1111 1111 1111 1110two = 2,147,483,646ten0111 1111 1111 1111 1111 1111 1111 1111two = 2,147,483,647ten1000 0000 0000 0000 0000 0000 0000 0000two =


View Full Document

Berkeley COMPSCI 61C - Instructions as Numbers

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 Instructions as Numbers
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 Instructions as Numbers 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 Instructions as Numbers 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?