CS 250 – Computer Organization & Assembly Instructor: Paul Anderson 212 JC Long andersonp@cs.cofc.edu Lecture slides, labs, and other materials courtesy of Dr. Michael Raymer, Wright State University, and Dr. Travis Doom, Wright State University, and Dr. Sridhar Ramachandran, Indiana University Southeast College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 1 Why study computer organization? 1. You need to understand hardware to program well. – Cache thrashing – Concurrency – Representations 2. 3. You need to understand hardware to program correctly. You need to understand assembly language (at least every once in a while) College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 2 Black Boxes The Problem Every level of this hierarchy that you don’t understand is a black box – It might as well be magic – “Debugging by superstition” Algorithm & Language ISA & Microarchitecture The objective of this course is to move the black-box boundary down to the Microarchitecture level! Circuits & Devices College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 3 The instruction set architecture (ISA) The Problem Algorithm & Language ISA & Microarchitecture Circuits & Devices The next step is to translate the program into the instruction set of the particular computer that will be used to carry out the work of the program. The Instruction Set Architecture (ISA) is the complete specification of the interface between programs that have been written and the underlying hardware that must carry out the work of those programs. – Examples: IA-32 (Intel, AMD, and others), PowerPC (Motorola) Programs are translated from high languages in to the ISA of the computer on which they will be run by a program called a compiler (specific to the ISA). Programs are translated from assembly to the ISA by an assembler College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 4 The microarchitecture The Problem Algorithm & Language The next step is to transform the ISA into an implementation. The detailed organization of an implementation is called its microarchitecture. – The IA-32 has been implemented by several different processors over the past twenty years 8086 (Intel, 1979), 8286, 8386, 8486, Pentium, Pentium II, Athlon, Pentium III. – Each implementation is an opportunity for computer designers to make different trade-offs between cost and performance. [Computer design is always an exercise in trade-offs.] ISA & Microarchitecture Circuits & Devices College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 5 The logic circuit The Problem Algorithm & Language ISA & Microarchitecture The next step is to implement each element of the microprocessor out of simple logic circuits. Here there are also choices, as the logic designer decides how to best make the tradeoffs between cost and performance. Even in the case of addition, there are several choices of logic circuits to perform this operation and differing speeds and corresponding costs. Circuits & Devices College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 6 The devices The Problem Algorithm & Language Finally, each basic logic circuit is implemented in accordance with the requirements of the particular device technology used. So, CMOS circuits are different from NMOS circuits, which are different, in turn, from gallium arsenide circuits. Vcc Rc ISA & Microarchitecture Vin Circuits & Devices College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department Vout Rb GND CS 250 Comp. Org. & Assembly 7 CS Realities You’ve got to understand binary encodings – – – – Integers Floats Characters Instructions You’ve got to understand how a machine processes instructions – The stack You have to understand memory – Memory references (pointers) Computers do more than execute your program – I/O – Interrupts – Network behavior In short: – You must understand the system in order to optimize performance! College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 8 Understanding your hardware Intel® Core™ i7-3930K Processor (12M Cache, 3.20 GHz) # of Cores 6 # of Threads 12 Clock Speed 3.2 GHz Max Turbo Frequency 3.8 GHz Intel® Smart Cache 12 MB Bus/Core Ratio 57 Instruction Set 64-bit Lithography 32nm Recommended Customer Price $583 - $594 Idle States Yes Enhanced Intel SpeedStep® Technology Yes Execute Disable Bit Yes College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 9 Where we are heading College of Charleston, School of Science & Mathematics Dr. Anderson, Computer Science Department CS 250 Comp. Org. & Assembly 10