Chapter 2 Instructions Language of the Computer_341 -...

This preview shows page 1 - 11 out of 60 pages.

The preview shows page 9 - 11 out of 60 pages.
Chapter 2Instructions: Language of the ComputerBy Dr. Xiaolong WUDept. of Computer Engineering & Computer ScienceCollege of EngineeringCalifornia State University, Long Beach
AgendaIntroductionOperations of the Computer HardwareOperandsSigned and Unsigned NumbersChapter 2 — Instructions: Language of the Computer — 2
Chapter 2 — Instructions: Language of the Computer — 3Instruction SetInstructions: words of a computer’s languageInstruction set:The repertoire of instructions of a computerVocabulary of instructionsDifferent computers have different instruction setsBut with many aspects in commonEarly computers had very simple instruction setsSimplified implementationMany modern computers also have simple instruction sets
Chapter 2 — Instructions: Language of the Computer — 4The MIPS Instruction SetUsed as the example throughout the bookStanford MIPS commercialized by MIPS Technologies ()Large share of embedded core marketApplications in consumer electronics, network/storage equipment, cameras, printers, …Two other instructions setsARM Intel x86
Chapter 2 — Instructions: Language of the Computer — 52.2 Arithmetic OperationsAdd and subtract, three operandsTwo sources and one destinationadd a, b, c # a gets b + cAll arithmetic operations have this formDesign Principle 1:Simplicity favors regularityRegularity makes implementation simplerSimplicity enables higher performance at lower cost
Chapter 2 — Instructions: Language of the Computer — 6Compiling Two C Statements into MIPSC code:f = (g + h) - (i + j);Compiled MIPS code:add t0, g, h # temp t0 = g + hadd t1, i, j # temp t1 = i + jsub f, t0, t1 # f = t0 - t1
Chapter 2 — Instructions: Language of the Computer — 7
Chapter 2 — Instructions: Language of the Computer — 82.3 Register OperandsArithmetic instructions use registeroperandsMIPS has a 32 32-bitregister fileUse for frequently accessed dataNumbered 0 to 3132-bit data called a “word”Assembler names$t0, $t1, …, $t9 for temporary values$s0, $s1, …, $s7 for saved variablesDesign Principle 2:Smaller is fasterc.f. main memory: millions of locations
Chapter 2 — Instructions: Language of the Computer — 9Register Operand ExampleC code:f = (g + h) - (i + j);f,g,h,i, j in $s0, …, $s4Compiled MIPS code:add $t0, $s1, $s2add $t1, $s3, $s4sub $s0, $t0, $t1
Chapter 2 — Instructions: Language of the Computer — 10Memory OperandsMain memory used for composite dataArrays, structures, dynamic dataAs explained above, arithmetic operations occur only on registers in MIPS instructions; thus MIPS must include instructions that transfer data between memory and register.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 60 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
Hernandez
Tags
Assembly Language, MIPS architecture, Machine code, Computer Engineering Computer Science

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture