490 likes | 677 Views
CS/ECEn 124 – Computer Systems. Winter 2010 Section 001 , MWF 1:00 – 1:50 pm Section 002 , MWF 2:00 – 2:50 pm Help Sessions , MWF 4:00 – 4:45 pm Instructor: Paul Roper Office: TMCB 3370, 422-8149 Email: proper@cs.byu.edu Office Hours: MWF 10:00 – 11:40 am. Let’s Get Started….
E N D
CS/ECEn 124 – Computer Systems • Winter 2010 • Section 001, MWF 1:00 – 1:50 pm • Section 002, MWF 2:00 – 2:50 pm • Help Sessions, MWF 4:00 – 4:45 pm • Instructor:Paul RoperOffice:TMCB 3370, 422-8149 Email:proper@cs.byu.edu • Office Hours:MWF 10:00 – 11:40 am Chapter 01 - Abstraction
Let’s Get Started… What’s inside this thing...
Concepts to Learn… • Computers • Power of Abstraction • Hardware vs. Software • Turing Machine • Universal Computing Devices • The “Gap” • Solving Problems w/Computer • Levels of Transformation Chapter 01 - Abstraction
Computers Computers… • There is no magic to computing. • Computers do not have minds of their own. You have to tell them exactly what to do. • Computers follow instructions exactly. • Computers are made of very simple parts…albeit, fast parts and a whole lot of them! • We will study the MPS430 micro-controller, which has all of the important characteristics of today’s commercial computers. Chapter 01 - Abstraction
Computers A Computer • A computer • figures out what to do next – control. • does the computations on the data – data path. • A computer uses a “program” for control and the data path. • A computer is called a • a central processing unit, • or a CPU, MPU, MSP, • or simply, a processor. Chapter 01 - Abstraction
Computers Digital vs. Analog • Wristwatches (numbers vs. hands) • LP’s vs. CD’s • Rotary phone vs. Cell phone • NTSC vs. HDTV • Slide rule vs. calculator • 737’s vs. 787’s Chapter 01 - 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, ... Chapter 01 - Abstraction
Computers Computing Machines • Ubiquitous (meaning everywhere!) • General purpose: servers, desktops, laptops, PDAs, … • Special purpose: cash registers, ATMs, games, telephone switches, … • Embedded: cars, hotel doors, printers, VCRs, industrial machinery, medical equipment, … • Distinguishing Characteristics • Speed • Cost • Ease of use, software support & interface • Scalability • Reliability Chapter 01 - Abstraction
Computers Computing Machines • Use Abstraction • Hardware verses Software • to manage complexity. • to enhance productivity. • to hide unnecessary details when everything works. • to focus on what is important. • are just different parts of a computing system. • understanding together best solve computing problems. • mastery makes you more capable. Chapter 01 - Abstraction
Abstraction The Concept of Abstraction • We abstract naturally– • focus on the essential aspects of an entity. • hide the underlying complexity. • Avoid getting bogged down in unnecessary details (when everything is working fine). • More efficient to think about something at the highest possible level of abstraction. • Without abstraction, one would 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. Chapter 01 - 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. Chapter 01 - 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 Chapter 01 - Abstraction
Tmul Tadd a,b ab a,b a+b Turing machine that multiplies Turing machine that adds Turning Machine Turing Machine • Mathematical model of a device that can performany computation – Alan Turing (1936) • ability to read/write symbols on an infinite “tape” • “state” transitions, based on current state and symbol • Every computation can be performed by some Turing machine. (Turing’s thesis) Chapter 01 - Abstraction
Turning Machine Turing Machine Details Chapter 01 - Abstraction
Turning Machine Turing Machine Example Start State (State Register) “Action Table” StepStateTape 1 S1 11 Old Read Write New State Sym Sym Move State S1 1 0 R S2 S2 1 1 R S2 S2 0 0 R S3 S3 0 1 L S4 S3 1 1 R S3 S4 1 1 L S4 S4 0 0 L S5 S5 1 1 L S5 S5 0 1 R S1 2 S201 3 S2010 4 S30100 5 S40101 6 S50101 7 S50101 8 S11101 9 S2 1001 10 S3 1001 11 S3 10010 12 S4 10011 13 S4 10011 14 S5 10011 15 S1 11011 --HALT-- Tape Read Head Chapter 01 - Abstraction
U Tadd, Tmul a,b,c c(a+b) Universal Turing Machine Universal Turning Machine Universal Turing Machine • A Universal Turing Machine is a theoretical device • that can simulate any other Turing machine. • that accepts both input data and instructions as to how to operate on the data. • that is also a Turing Machine! A computer is a universal computing device. Chapter 01 - Abstraction
The “Gap” The “Gap” Implementation Wordprocessing… Games… Surfing the web… 10101101011011… Computational Problem Chapter 01 - Abstraction
The “Gap” Overcoming the Gap Problems Algorithms Language (Program) Programmable Computer Specific Machine (ISA) Architecture Micro-architecture Manufacturer Specific As we move down, many choices must be made. This is how we make our living! Circuits Devices Chapter 01 - Abstraction
Software Design: choose algorithms and data structures Algorithm Programming: use language to express design Program Compiling/Interpreting: convert language to machine instructions Instruction Set Architecture Solving Problems Problem Solving w/Computers Problem Chapter 01 - Abstraction
Instruction Set Design: Design ISA that enables efficient problem solving Processor Design: choose structures to implement ISA Micro- Architecture Logic/Circuit Design: gates and low-level circuits toimplement components Circuits Process Engineering & Fabrication: develop and manufacturelowest-level components Devices Solving Problems Deeper and Deeper… Instruction Set Architecture Chapter 01 - Abstraction
Programmable Fixed Solving Problems Levels of Transformation Which Levels are Programmable? Problems Problems Algorithms Algorithms Language (Program) Language (Program) Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - 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 at the very least, the context of the sentence. Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Solving Problems For example… • Consider the English 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. Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
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. Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Solving Problems Programs • The next step is to transform the algorithm into a computer program using a computer language. • computer languages communicate with the computer • computer languages are defined by a grammar • computer languages are mechanical rather than natural • computer languages are 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 Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Application Program Operating System This lecture Data Program (Software) PowerPoint Application Program Windows XP Operating System Solving Problems The Program Level • Most computers run a management program called the operating system (OS). • Application programs interface to the machine architecture via the OS. An example: Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Solving Problems High-Level Languages (HLL’s) • Machine independent • not dependent on a particular machine’s organization • can be compiled to run anywhere • Easier to write than low-level languages • Usually result in higher programmer productivity • Incorporate higher levels of abstraction • data structures (stacks, arrays) • control structures (loops, switch statements, …) Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Solving Problems Low-Level Languages (LLL’s) • Machine-specific • internal machine organization is exposed to the programmer • they can access the nitty gritty details • numbers and types of registers • specific instructions • memory addressing modes • condition code flags, special purpose • hardware features • Assembly programming • lower productivity, but • higher performing code Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Levels of Transformation Levels of Transformation Problems Algorithms Language (Program) Programmable Computer Specific Machine (ISA) Architecture Micro-architecture Manufacturer Specific Circuits Devices Chapter 01 - Abstraction
Levels of Transformation Instruction Set Architecture (ISA) • Next is to translate the computer program (language) 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 Micro-architecture Circuits Devices Chapter 01 - Abstraction
faster and more complex Levels of Transformation Micro-Architecture • The micro-architecture transforms the ISA into an implementation. • 8051 • IA-32 • 386 • 486 • Pentium • Pentium-II, III, IV • Xeon • MSP430 • How the operations in the ISA are implemented • how do you add two binary numbers? • or, how do you access memory? Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Levels of Transformation Circuits • The next step is to implement each element of the micro-architecture with simple logic circuits. • Gates, adders, multiplexers • Flip flops, memory cells • Adders, subtracters, multipliers Circuits are used to make the computer do useful things like multiply or store a result. Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
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. Problems Algorithms Programs Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
More abstract, machine-independent; easier to write, read, debug, maintain More concrete, machine-dependent; error -prone, harder to write, read, debug, maintain Very high- level language objectives or tasks High-level language statements Assembly language instruction, mnemonic Machine language instructions binary (hex) Compiler Interpreter Assembler Swap v[i] and v[i+1] temp=v[i]; v[i]=v[i+1]; v[i+1]=temp; 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 MOV.W SP,R15 INCD.W R15 ADD.W R15,R14 MOV.B 0x0001(SP),R13 MOV.W SP,R15 INCD.W R15 ADD.W R15,R13 MOV.B @R14,0x0000(R13) MOV.B 0x0001(SP),R15 INC.W R15 MOV.W SP,R14 INCD.W R14 ADD.W R15,R14 MOV.B @SP,0x0000(R14) 415E 0001 410F 532F 5F0E 4EE1 0000 415E 0001 531E 410F 532F 5F0E 415D 0001 410F 532F 5F0D 4EED 0000 415F 0001 531F 410E 532E 5F0E 41EE 0000 One task = Many instructions One statement = Several instructions Mostly one for one Levels of Transformation High vs Low Level Programming Chapter 01 - Abstraction
by hand C-language program (HLL) c = a + b; compiler Assembly language program (LLL) ADD.W r4,r12 assembler Machine language programs 0010110010010001111 program execution Levels of Transformation Example: Levels of Translation Algorithm Algorithm Language ISA Chapter 01 - Abstraction
Labs 11-12 Labs 9-10 Labs 6-8 Labs 4-5 Lab 3 Lab 2 Levels of Transformation Levels of Transformation Problems Algorithms Language (Program) Machine (ISA) Architecture Micro-architecture Circuits Devices Chapter 01 - Abstraction
Levels of Transformation Review: Descriptions of Each Level • Problem Statement • stated using "natural language“ • ambiguous, imprecise • Algorithm • step-by-step procedure, guaranteed to finish • definiteness, effective computability, finiteness • Program • express the algorithm using a computer language • high-level language, low-level language Chapter 01 - Abstraction
Levels of Transformation Review of Each Level(continued…) • Instruction Set Architecture (ISA) • set of instructions the computer can execute • data types, addressing mode • Micro-architecture • detailed organization of a processor implementation • different implementations of a single ISA • Logic Circuits • combine basic operations to realize microarchitecture • many different ways to implement a single function • Devices • properties of materials, manufacturability Chapter 01 - Abstraction
From Components to Applications Subfields or views in computer system engineering. Chapter 01 - Abstraction
What Is Computer Architecture? Like a building architect, whose place at the engineering/arts and goals/means interfaces is seen in this diagram, a computer architect reconciles many conflicting or competing demands. Chapter 01 - Abstraction
Parts of a Computer System The space of computer systems, with what we normally mean by the word “computer” highlighted. Chapter 01 - Abstraction
Price/Performance Pyramid Differences in scale, not in substance Classifying computers by computational power and price range. Chapter 01 - Abstraction
Automotive Embedded Computers Embedded computers are ubiquitous, yet invisible. They are found in our automobiles, appliances, and many other places. Chapter 01 - Abstraction
PC’s and Workstations Notebooks, a common class of portable computers, are much smaller than desktops but offer substantially the same capabilities. What are the main reasons for the size difference? Chapter 01 - Abstraction