Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Computer System Organization and Design •Instructor –Morris Chang –Tel: 294-7618 –Email: [email protected] –Office Hours: MW 10:00-11:00 •Teaching Assistant –See Web Page for Information •Web Page –Follow link from WebCT •Text Book: Computer Organization and Design, 3nd edition, 2005 –Patterson and Hennessy 2004 Morgan Kaufmann Publishers 1 Chapter 1 2004 Morgan Kaufmann Publishers 2 Introduction • This course is all about how computers work • But what do we mean by a computer? – Different types: desktop, servers, embedded devices – Different uses: automobiles, graphics, finance, genomics… – Different manufacturers: Intel, Apple, IBM, Microsoft, Sun… – Different underlying technologies and different costs! • Analogy: Consider a course on “automotive vehicles” – Many similarities from vehicle to vehicle (e.g., wheels) – Huge differences from vehicle to vehicle (e.g., gas vs. electric) • Best way to learn: – Focus on a specific instance and learn how it works – While learning general principles and historical perspectives 2004 Morgan Kaufmann Publishers 3 Why learn this stuff? • You want to call yourself a “computer scientist” • You want to build software people use (need performance) • You need to make a purchasing decision or offer “expert” advice • Both Hardware and Software affect performance: – Algorithm determines number of source-level statements – Language/Compiler/Architecture determine machine instructions (Chapter 2 and 3) – Processor/Memory determine how fast instructions are executed (Chapter 5, 6, and 7) • Assessing and Understanding Performance in Chapter 4 2004 Morgan Kaufmann Publishers 4 What is a computer? • • Components: – input (mouse, keyboard) – output (display, printer) – memory (disk drives, DRAM, SRAM, CD) – network Our primary focus: the processor (datapath and control) – implemented using millions of transistors – Impossible to understand by looking at each transistor – We need... 2004 Morgan Kaufmann Publishers 5 Abstraction • Delving into the depths reveals more information • An abstraction omits unneeded detail, helps us cope with complexity What are some of the details that appear in these familiar abstractions? 2004 Morgan Kaufmann Publishers 6 How do computers work? • Need to understand abstractions such as: – Applications software – Systems software – Assembly Language – Machine Language – Architectural Issues: i.e., Caches, Virtual Memory, Pipelining – Sequential logic, finite state machines – Combinational logic, arithmetic circuits – Boolean logic, 1s and 0s – Transistors used to build logic gates (CMOS) – Semiconductors/Silicon used to build transistors – Properties of atoms, electrons, and quantum dynamics • So much to learn! 2004 Morgan Kaufmann Publishers 7 Instruction Set Architecture • A very important abstraction – interface between hardware and low-level software – standardizes instructions, machine language bit patterns, etc. – advantage: different implementations of the same architecture – disadvantage: sometimes prevents using new innovations True or False: Binary compatibility is extraordinarily important? • Modern instruction set architectures: – IA-32, PowerPC, MIPS, SPARC, ARM, and others 2004 Morgan Kaufmann Publishers 8 Historical Perspective • ENIAC built in World War II was the first general purpose computer – Used for computing artillery firing tables – 80 feet long by 8.5 feet high and several feet wide – Each of the twenty 10 digit registers was 2 feet long – Used 18,000 vacuum tubes – Performed 1900 additions per second –Since then: Moore’s Law: transistor capacity doubles every 18-24 months 2004 Morgan Kaufmann Publishers 9 Chapter 2 2004 Morgan Kaufmann Publishers 10 Instructions: • • Language of the Machine We’ll be working with the 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 Other SPARC Hitachi SH PowerPC Motorola 68K MIPS 900 IA-32 800 ARM 700 600 500 400 300 200 100 0 1998 1999 2000 2001 2002 2004 Morgan Kaufmann Publishers 11 MIPS arithmetic • • All instructions have 3 operands Operand order is fixed (destination first) Example: C code: a = b + c MIPS ‘code’: add a, b, c (we’ll talk about registers in a bit) “The natural number of operands for an operation like addition is three…requiring every instruction to have exactly three operands, no more and no less, conforms to the philosophy of keeping the hardware simple” 2004 Morgan Kaufmann Publishers 12 MIPS arithmetic • • Design Principle: simplicity favors regularity. Of course this complicates some things... C code: a = b + c + d; MIPS code: add a, b, c add a, a, d • • Operands must be registers, only 32 registers provided Each register contains 32 bits • Design Principle: smaller is faster. Why? 2004 Morgan Kaufmann Publishers 13 Registers vs. Memory • • • Arithmetic instructions operands must be registers, — only 32 registers provided Compiler associates variables with registers What about programs with lots of variables Control Input Memory Datapath Processor Output I/O 2004 Morgan Kaufmann Publishers 14 Memory Organization • • • Viewed as a large, single-dimension array, with an address. A memory address is an index into the array "Byte addressing" means that the index points to a byte of memory. 0 1 2 3 4 5 6 ... 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 2004 Morgan Kaufmann Publishers 15 Memory Organization • • • • • Bytes are nice, but most data items use larger "words" For MIPS, a word is 32 bits or 4 bytes. 0 32 bits of data 4 32 bits of data Registers hold 32 bits of data 32 bits of data 8 12 32 bits of data ... 232 bytes with byte addresses from 0 to 232-1 230 words with byte addresses 0, 4, 8, ... 232-4 Words are aligned i.e., what are the least 2 significant bits of a word address? 2004 Morgan Kaufmann Publishers 16