Kĩ thuật vi xử lý ComputerOrganization
Computer Organization: An Abstraction What’s inside this thing??? Computers Computers… There is no magic to computing A computer Computers not have minds of their own Computers follow our instructions exactly Computers are made of very simple parts, albeit, fast parts and a whole lot of them! figures out what to next – control does the computations on the data – data path A computer uses a “program” for control and the data path Computers are ubiquitous (meaning everywhere!) CPU, MPU, MSP, or simply, a processor Computer Organization: An Abstraction Computers Analog to Digital Transformation Wristwatches → LCDs Books → Nooks Film → Flash LP’s → CD’s Rotary phone → Cell phone NTSC → HDTV Slide rule → Calculator 737’s → 787’s Computer Organization: An Abstraction Computers All Computers Are Created Equal… In theory, any computer can compute anything that’s possible to compute given enough memory and given enough time In practice, solving a problem is constrained by Time (weather forecast, next frame of animation, ) Cost (cell phone, automotive engine controller, ) Power (cell phone, handheld video game, ) Computer Organization: An Abstraction Computers Price/Performance Pyramid Cost Power Time Super $Millions Mainframe $100s Ks Server Workstation Personal Differences in scale, not in substance Embedded Computer Organization: An Abstraction $10s Ks $1000s $100s $10s Abstraction The Concept of Abstraction We abstract naturally– Avoid getting bogged down in unnecessary details by focusing on the essential aspects of an entity More efficient to think about something at the highest possible level of abstraction (when everything is working fine) Without abstraction, one would certainly be overwhelmed by the complexity of a computer But, when something doesn’t work, then abstraction fails and you have to look at the details Computer Organization: An Abstraction Hardware/Software Hardware versus Software Some people think that its OK for– Software engineers to be clueless about hardware, or Hardware engineers to be clueless about software Don’t believe it! Hardware and software are both essential parts of a computing system Computer systems work best when designed by someone who understands both parts Hardware designers that understand programming design the best computers Software designers that understand the capabilities and limitations of hardware design more efficient programs Computer Organization: An Abstraction Turning Machine Computing Devices Alan Turing In 1936 he proposed a way to define the term “computable” The Turing Machine Basic abstract symbol-manipulating devices which can be adapted to simulate the logic of any computer algorithm Anything that can be computed, can be computed by a TM… The TM is not a real machine, but an abstract machine Computer Organization: An Abstraction Turning Machine Turing Machine Details Computer Organization: An Abstraction Turning Machine Turing Machine Example “Action Table” Old Read State Sym S1 S2 S2 S3 S3 S4 S4 S5 S5 1 0 1 → → → → → → → → → Step Write New Sym Move State 1 1 1 R R R L R L L L R S2 S2 S3 S4 S3 S4 S5 S5 S1 State S1 S2 S2 S3 S4 S5 S5 S1 S2 10 S3 11 S3 12 S4 13 S4 14 S5 15 S1 HALT-Computer Organization: An Abstraction Start State (State Register) Tape 11 01 010 0100 0101 0101 0101 1101 1001 1001 10010 10011 10011 10011 11011 Tape Read Head The “Gap” Overcoming the Gap Computational Problem Wordprocessing… Games… Surfing the web… Problems Algorithms Language (Program) Machine (ISA) Architecture Computer Specific Micro-architecture Manufacturer Specific 10101101011011… Circuits Devices Implementation Programmable Computer Organization: An Abstraction Solving Problems Problem Solving w/Computers Wordprocessing… Games… Surfing the web… Problem Problem Algorithm Algorithm Program Program Instruction InstructionSet Set Architecture Architecture MicroMicroArchitecture Architecture Circuits Circuits 101011011… Devices Devices Software Design: choose algorithms and data structures Programming: use language to express design Compiling/Interpreting: convert language to machine instructions Instruction Set Design: Design ISA that enables efficient problem solving Processor Design: choose structures to implement ISA Logic/Circuit Design: gates and low-level circuits to implement components Process Engineering & Fabrication: develop and manufacture Computer Organization: Anlowest-level components Abstraction Solving Problems Problems Why not use natural languages to program computers? Incomplete Missing words and/or word structures for computer procedures Imprecise Words that mean the same thing are difficult to translate into computer instructions Ambiguous – the most unacceptable attribute! To infer the meaning of a sentence, a listener is often helped by the tone of the speaker or the context of the sentence “Time flies like an arrow.” One is noticing how fast time passes, One is at a track meet for insects, One is writing a letter to the Dear Abby of Insectville Computer Organization: An Abstraction Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Solving Problems Algorithms An algorithm is a step-by-step procedure that: guarantees to terminate (finiteness) each step is precisely stated (definiteness) each step can be carried out (effective computability) Examples Starting a car Computing the average of n integers For any given problem, there are usually multiple algorithms that will work Computer Organization: An Abstraction Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Solving Problems Programs An algorithm is tranformed into a computer program using a computer language communicate with the computer defined by a grammar mechanical rather than natural not ambiguous More than 1,000 programming languages different languages for different purposes financial processing/report generation manipulating lists of symbolic data natural language processing often, just a personal preference Computer Organization: An Abstraction Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Solving Problems Computer Languages High Level Languages (HLL’s) Machine independent Easier to write than low-level languages Usually result in higher programmer productivity Incorporate higher levels of abstraction Java, C++, Python, FORTRAN Low Level Languages (LLL’s) Machine-specific internal machine organization is exposed to the programmer lower programmer productivity Problems higher performing code Algorithms Programs IA-32, 8051, MSP430 Machine (ISA) Architecture Computer Organization: An Abstraction Micro-architecture Circuits Devices Solving Problems Compilers vs Interpreters Compiled Language Language compiled once to machine code Machine dependent Higher performance code Requires re-compilation to move to another platform C, C++, FORTRAN Interpretive Languages Language executed line by line Machine independent Slower performing code Requires machine dependent interpreter (JVM) Java, Lisp, Basic, Python Computer Organization: An Abstraction Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Solving Problems temp=v[i]; v[i]=v[i+1]; v[i+1]=temp; = Executable 415E 0001 410F 532F 5F0E 4EE1 0000 415E 0001 531E Source code = Data Path Computer Organization: An Abstraction Application MOV.B 0x0001(SP),R14 MOV.W SP,R15 INCD.W R15 ADD.W R15,R14 MOV.B @R14,0x0000(SP) MOV.B 0x0001(SP),R14 INC.W R14 Object code Interpreter High-level language statements Assembly Assembler temp=v[i]; v[i]=v[i+1]; v[i+1]=temp; Compiler Compilers vs Interpreters Levels of Transformation Instruction Set Architecture (ISA) The computer program (language) is translated into the instruction set of a particular computer Specific to a CPU Data types - what are the different representations of operands Operations on data - what functions can be done Addressable memory - where are operands stored Addressing modes - how to find operands in memory Machine code, or the 1’s and 0’s that instruct the machine Problems Algorithms Programs Machine (ISA) Architecture Computer Organization: An Abstraction Micro-architecture Circuits Devices Levels of Transformation Micro-Architecture 8051 IA-32 386 486 Pentium Pentium-II, III, IV Xeon MSP430 faster and more complex The micro-architecture transforms the ISA into an implementation How the operations in the ISA are implemented how you add two binary numbers? or, how you access memory? Problems Algorithms Programs Machine (ISA) Architecture Computer Organization: An Abstraction Micro-architecture Circuits Devices Levels of Transformation Circuits The next step is to implement each element of the microarchitecture with simple logic circuits Gates, adders, multiplexers Flip flops, memory cells Adders, subtracters, multipliers Circuits are used to make the computer useful things like multiply or store a result Computer Organization: An Abstraction Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Levels of Transformation Devices Finally, each basic logic circuit is implemented by a particular device technology Wires and traces Types of circuits (transistors) CMOS NMOS Gallium arsenide Devices are the building blocks for more complex circuits Computer Organization: An Abstraction Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Levels of Transformation Levels of Transformation Labs 11-12 Problems Algorithms Labs 9-10 Language (Program) Labs 6-8 Machine (ISA) Architecture Labs 4-5 Micro-architecture Circuits Lab Lab Devices Computer Organization: An Abstraction Questions… Define abstraction What was Alan Turning’s contribution to the computing world? What defines an algorithm? What is the difference between a computer’s ISA and its micro-architecture? At which level of transformation are solutions ambiguous? How compilers differ from interpreters? Is C a high or low level language? Computer Organization: An Abstraction