Download Computer System Organization and Design and more Lecture notes Design in PDF only on Docsity! 1 Computer System Organization and Design • Instructor – Zhao Zhang – Tel: 294-7940 – Email: zzhang@iastate.edu – Office Hours: MWF 10:00-11:00 • Teaching Assistant – See Web Page for Information • Web Page – Follow link from home page of department • Text Book: Computer Organization and Design 2nd edition – Patterson and Hennessy 2 Outline of the Course • Learn computer architecture, design and organization • Evaluating computer system performance • Instruction set design • Computer algorithms and ALU design • Processor data path design • Pipelined control and performance • Memory system design • I/O system design • Putting it all together • Examples 3 Introduction • Rapidly changing field: – vacuum tube -> transistor -> IC -> VLSI (see section 1.4) – memory capacity and processor speed is doubling every 1.5 years: • Things you’ll be learning: – how computers work, a basic foundation – how to analyze their performance (or how not to!) – issues affecting design of modern processors (caches, pipelines) • Why learn this stuff? – You want to design state-of-art system – you want to call yourself a “computer scientist or engineer” – you want to build software people use (need performance) – you need to make a purchasing decision or offer “expert” advice 4 What is a computer? • Components: – input (mouse, keyboard) – output (display, printer) – memory (disk drives, DRAM, SRAM, CD) – network • Our primary focus: – understanding performance – the processor (datapath and control) – implemented using millions of transistors – impossible to understand by looking at each transistor – we need an abstraction 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? swap(int v[], int k) {int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } swap: muli $2, $5,4 add $2, $4,$2 lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) jr $31 00000000101000010000000000011000 00000000100011100001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000 Binary machine language program (for MIPS) C compiler Assembler Assembly language program (for MIPS) High-level language program (in C) 6 What is Computer Architecture? • A programmer’s view of machine • What does it include? • What is Computer Organization, Structure, and Function? 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: – 80x86/Pentium/K6, PowerPC, DEC Alpha, MIPS, SPARC, HP • Historical Perspective 8 A View of Hardware/Software Hierarchy • Hardware and software are layered • Some functions can be moved back and forth • System software is a collection of programs – OS, compilers are some examples – It makes job of individuals user easy • Application software programs – Used by many users 17 • Response Time (latency) — How long does it take for my job to run? — How long does it take to execute a job? — How long must I wait for the database query? • Throughput — How many jobs can the machine run at once? — What is the average execution rate? — How much work is getting done? • If we upgrade a machine with a new processor what do we increase? If we add a new machine to the lab what do we increase? Computer Performance: TIME, TIME, TIME 18 • Elapsed Time – counts everything (disk and memory accesses, I/O , etc.) – a useful number, but often not good for comparison purposes • CPU time – doesn't count I/O or time spent running other programs – can be broken up into system time, and user time • Our focus: user CPU time – time spent executing the lines of code that are "in" our program Execution Time 19 • For some program running on machine X, PerformanceX = 1 / Execution timeX • "X is n times faster than Y" PerformanceX / PerformanceY = n • Problem: – machine A runs a program in 20 seconds – machine B runs the same program in 25 seconds Book's Definition of Performance 20 Clock Cycles • Instead of reporting execution time in seconds, we often use cycles • Clock “ticks” indicate when to start activities (one abstraction): • cycle time = time between ticks = seconds per cycle • clock rate (frequency) = cycles per second (1 Hz. = 1 cycle/sec) A 200 Mhz. clock has a cycle time time seconds program = cycles program × seconds cycle 1 200 ×106 ×109 = 5 nanoseconds 21 So, to improve performance (everything else being equal) you can either ________ the # of required cycles for a program, or ________ the clock cycle time or, said another way, ________ the clock rate. How to Improve Performance seconds program = cycles program × seconds cycle 22 • Could assume that # of cycles = # of instructions This assumption is incorrect, different instructions take different amounts of time on different machines. Why? hint: remember that these are machine instructions, not lines of C code time 1s t i ns tru ct io n 2n d in st ru ct io n 3r d in st ru ct io n 4t h 5t h 6t h ... How many cycles are required for a program? 23 • Multiplication takes more time than addition • Floating point operations take longer than integer ones • Accessing memory takes more time than accessing registers • Important point: changing the cycle time often changes the number of cycles required for various instructions (more later) time Different numbers of cycles for different instructions 24 • Our favorite program runs in 10 seconds on computer A, which has a 400 Mhz. clock. We are trying to help a computer designer build a new machine B, that will run this program in 6 seconds. The designer can use new (or perhaps more expensive) technology to substantially increase the clock rate, but has informed us that this increase will affect the rest of the CPU design, causing machine B to require 1.2 times as many clock cycles as machine A for the same program. What clock rate should we tell the designer to target?" • Don't Panic, can easily work this out from basic principles Example