Lecture 3-MIPS

# Lecture 3-MIPS - Chapter 2 Instructions Language of the...

This preview shows pages 1–10. Sign up to view the full content.

Chapter 2 Instructions: Language of the Computer Monday, May 18, 2009

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

View Full Document
Chapter 2 — Instructions: Language of the Computer — Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects in common Early computers had very simple instruction sets Simplified implementation Many modern computers also have simple instruction sets §2.1 Introduction Monday, May 18, 2009
Chapter 2 — Instructions: Language of the Computer — The MIPS Instruction Set Used as the example throughout the book Stanford MIPS commercialized by MIPS Technologies ( www.mips.com ) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, … Typical of many modern ISAs See MIPS Reference Data tear-out card, and Appendixes B and E Monday, May 18, 2009

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

View Full Document
Chapter 2 — Instructions: Language of the Computer — Arithmetic Operations Add and subtract, three operands Two sources and one destination add a, b, c # a gets b + c All arithmetic operations have this form Design Principle 1: Simplicity favors regularity Regularity makes implementation simpler Simplicity enables higher performance at lower cost §2.2 Operations of the Computer Hardware Monday, May 18, 2009
Chapter 2 — Instructions: Language of the Computer — Arithmetic Example C code: f = (g + h) - (i + j); Compiled MIPS code: add t0, g, h # temp t0 = g + h add t1, i, j # temp t1 = i + j sub f, t0, t1 # f = t0 - t1 Monday, May 18, 2009

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

View Full Document
Chapter 2 — Instructions: Language of the Computer — Register Operands Arithmetic instructions use register operands MIPS has a 32 × 32-bit register file Use for frequently accessed data Numbered 0 to 31 32-bit data called a “word” Assembler names \$t0, \$t1, …, \$t9 for temporary values \$s0, \$s1, …, \$s7 for saved variables Design Principle 2: Smaller is faster c.f. main memory: millions of locations §2.3 Operands of the Computer Hardware Monday, May 18, 2009
Chapter 2 — Instructions: Language of the Computer — Register Operand Example C code: f = (g + h) - (i + j); f, …, j in \$s0, …, \$s4 Compiled MIPS code: add \$t0, \$s1, \$s2 add \$t1, \$s3, \$s4 sub \$s0, \$t0, \$t1 Monday, May 18, 2009

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

View Full Document
Chapter 2 — Instructions: Language of the Computer — Memory Operands Main memory used for composite data Arrays, structures, dynamic data To apply arithmetic operations Load values from memory into registers Store result from register to memory Memory is byte addressed Each address identifies an 8-bit byte Words are aligned in memory Address must be a multiple of 4 MIPS is Big Endian Most-significant byte at least address of a word c.f. Little Endian: least-significant byte at least address Monday, May 18, 2009
Chapter 2 — Instructions: Language of the Computer —

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

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

{[ snackBarMessage ]}

### Page1 / 57

Lecture 3-MIPS - Chapter 2 Instructions Language of the...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online