Lecture3_Chap2A

Lecture3_Chap2A - ECE/CSE 201 Spring 2009 Lecture 3...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE/CSE 201 Spring 2009 Lecture 3 Instruction set, arithmetic operations, operands, representations of integers Read: Sections 2.1-2.5
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 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
Background image of page 2
3 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Instructions: MIPS instruction set architecture similar to other architectures developed since the 1980's Almost 100 million MIPS processors manufactured in 2002 used by NEC, Nintendo, Cisco, Silicon Graphics, Sony, … 1400 1300 1200 1100 1000 900 800 700 600 500 400 300 200 100 0 1998 2000 2001 2002 1999 Other SPARC Hitachi SH PowerPC Motorola 68K MIPS IA-32 ARM
Background image of page 4
5 Arithmetic Operations Add and subtract, three operands Two sources and one destination add a, b, c # a = b + c All arithmetic operations have this form Design Principle 1: Simplicity favours regularity Regularity makes implementation simpler Simplicity enables higher performance at lower cost §2.2 Operations of the Computer Hardware
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 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
Background image of page 6
7 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
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Register Names in MIPS Assembly Language MIPS convention for register names ÍÎ register numbers. name $number binary usage $zero $0 00000 constant 0 $v0-$v1 $2-$3 00010-00011 results $a0-$a3 $4-$7 00100-00111 arguments $t0-$t7 $8-$15 01000-01111 temporaries $s0-$s7 $16-$23 10000-10111 saved Hint: to make it easier to remember “$t” registers start at 8, “$s” registers start at 16
Background image of page 8
9 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
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 Registers vs. Memory Processor I/O Control Datapath Memory Input Output Arithmetic instructions operands must be registers, — only 32 registers provided Compiler associates variables with registers What about programs with lots of variables
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 39

Lecture3_Chap2A - ECE/CSE 201 Spring 2009 Lecture 3...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online