byu cs/ecen 124chapter 01 - abstraction1 cs/ecen 124 – computer systems winter 2010 section 001,...
TRANSCRIPT
BYU CS/ECEn 124 Chapter 01 - Abstraction 1
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-8149Email: [email protected]
Office Hours: MWF 10:00 – 11:40 am
Let’s Get Started…
What’s inside this thing...
BYU CS/ECEn 124 Chapter 01 - Abstraction 3
Concepts to Learn…
Computers Power of Abstraction Hardware vs. Software Turing Machine Universal Computing Devices The “Gap” Solving Problems w/Computer Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 4
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.
Computers
BYU CS/ECEn 124 Chapter 01 - Abstraction 5
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.
Computers
BYU CS/ECEn 124 Chapter 01 - Abstraction 6
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
Computers
BYU CS/ECEn 124 Chapter 01 - Abstraction 7
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, ...
Computers
BYU CS/ECEn 124 Chapter 01 - Abstraction 8
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
Computers
BYU CS/ECEn 124 Chapter 01 - Abstraction 9
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.
Computers
BYU CS/ECEn 124 Chapter 01 - Abstraction 10
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.
Abstraction
BYU CS/ECEn 124 Chapter 01 - Abstraction 11
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.
Hardware/Software
BYU CS/ECEn 124 Chapter 01 - Abstraction 12
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
Turning Machine
BYU CS/ECEn 124 Chapter 01 - Abstraction 13
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)
Tadda,b a+b
Turing machine that adds
Tmula,b ab
Turing machine that multiplies
Turning Machine
BYU CS/ECEn 124 Chapter 01 - Abstraction 14
Turing Machine DetailsTurning Machine
BYU CS/ECEn 124 Chapter 01 - Abstraction 15
Turing Machine Example
Old Read Write NewState Sym Sym Move State
S1 1 0 R S2S2 1 1 R S2S2 0 0 R S3S3 0 1 L S4S3 1 1 R S3S4 1 1 L S4S4 0 0 L S5S5 1 1 L S5S5 0 1 R S1
Step State Tape 1 S1 11
“Action Table”
Start State(State Register)
Tape Read Head
2 S2 01 3 S2 010 4 S3 0100 5 S4 0101 6 S5 0101 7 S5 0101 8 S1 1101 9 S2 1001 10 S3 1001 11 S3 10010 12 S4 10011 13 S4 10011 14 S5 10011 15 S1 11011 --HALT--
Turning Machine
BYU CS/ECEn 124 Chapter 01 - Abstraction 16
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!
Ua,b,c c(a+b)
Universal Turing Machine
Tadd, Tmul
A computer is a universal computing device.
Universal Turning Machine
BYU CS/ECEn 124 Chapter 01 - Abstraction 17
The “Gap”
Wordprocessing…Games…Surfing the web…
10101101011011…
Computational Problem
Implementation
The “Gap”
BYU CS/ECEn 124 Chapter 01 - Abstraction 18
Overcoming the Gap
Problems
Algorithms
Language (Program)
Machine (ISA) Architecture
Micro-architecture
Circuits
Devices
Programmable
Computer Specific
Manufacturer Specific
As we move down, many choices must be
made.
This is how we make our living!
The “Gap”
BYU CS/ECEn 124 Chapter 01 - Abstraction 19
Problem Solving w/Computers
ProblemProblem
ProgramProgram
Programming:use language to express design
AlgorithmAlgorithm
Software Design:choose algorithms and data structures
Instruction SetArchitecture
Instruction SetArchitecture
Compiling/Interpreting:convert language to machine instructions
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 20
Deeper and Deeper…
Instruction SetArchitecture
Instruction SetArchitecture
DevicesDevices
Process Engineering & Fabrication:develop and manufacturelowest-level components
CircuitsCircuits
Logic/Circuit Design:gates and low-level circuits toimplement components
Micro-Architecture
Micro-Architecture
Processor Design:choose structures to implement ISA
Instruction Set Design:Design ISA that enables efficient problem solving
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 21
Levels of Transformation
Problems
Algorithms
Language (Program)
Machine (ISA) Architecture
Micro-architecture
Circuits
Devices
Problems
Algorithms
Language (Program) Programmable
Fixed
Which Levels are Programmable?Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 22
Problems
Why not use natural languages to program computers? Incomplete
Missing words and/or word structures for computer procedures.
ImpreciseWords that mean the same thing are difficult to translate into computer instructions.
Ambiguous – the most unacceptable attribute!To infer the meaning of a sentence, alistener is often helped by the tone of thespeaker, or at the very least, the contextof the sentence.
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 23
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
AlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 24
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.
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 25
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
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 26
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:
Application Program
Operating System
Program (Software)
This lecture
PowerPoint
Windows XP
Data
Application Program
Operating System
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 27
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, …)
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 28
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
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Solving Problems
BYU CS/ECEn 124 Chapter 01 - Abstraction 29
Levels of Transformation
Problems
Algorithms
Language (Program)
Machine (ISA) Architecture
Micro-architecture
Circuits
Devices
Programmable
Computer Specific
Manufacturer Specific
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 30
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.
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 31
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?
faster and more com
plex
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 32
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.
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 33
Devices
Finally, each basic logic circuit is implemented by a particular device technology. Wires and traces Types of circuits (transistors)
CMOSNMOSGallium arsenide
Devices are the building blocks for more complex circuits.
ProblemsAlgorithmsPrograms
Machine (ISA) Architecture
Micro-architectureCircuitsDevices
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 34
High vs Low Level Programming
Swap v[i]and v[i+1]
Very high-level languageobjectivesor tasks
More concrete, machine-dependent; error-prone, harder to write, read, debug, maintain
More abstract, machine-independent;easier to write, read, debug, maintain
Inte
rpre
ter
temp=v[i];v[i]=v[i+1];v[i+1]=temp;
High-levellanguagestatements
One task =Many instructions
Com
pile
r
MOV.B 0x0001(SP),R14MOV.W SP,R15INCD.W R15ADD.W R15,R14MOV.B @R14,0x0000(SP)MOV.B 0x0001(SP),R14INC.W R14MOV.W SP,R15INCD.W R15ADD.W R15,R14MOV.B 0x0001(SP),R13MOV.W SP,R15INCD.W R15ADD.W R15,R13MOV.B @R14,0x0000(R13)MOV.B 0x0001(SP),R15INC.W R15MOV.W SP,R14INCD.W R14ADD.W R15,R14MOV.B @SP,0x0000(R14)
Assemblylanguageinstruction,mnemonic
One statement =Several instructions
Ass
em
ble
r
415E 0001410F532F5F0E4EE1 0000415E 0001531E410F532F5F0E415D 0001410F532F5F0D4EED 0000415F 0001531F410E532E5F0E41EE 0000
Machinelanguageinstructionsbinary (hex)
Mostly onefor one
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 35
Example: Levels of Translation
Algorithm
C-language program (HLL)c = a + b;
by hand
Machine language programs0010110010010001111
assembler
Assembly language program (LLL)ADD.W r4,r12
compiler
Algorithm
Language
ISA
program execution
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 36
Levels of Transformation
Problems
Algorithms
Language (Program)
Machine (ISA) Architecture
Micro-architecture
Circuits
Devices
Labs 4-5
Lab 3
Labs 6-8
Labs 9-10
Labs 11-12
Lab 2
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 37
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
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 38
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
Levels of Transformation
BYU CS/ECEn 124 Chapter 01 - Abstraction 39
Auxilliary Slides…
BYU CS/ECEn 124 Chapter 01 - Abstraction 41
From Components to Applications
Subfields or views in computer system engineering.
High-level view
Com
put
er d
esig
ner
Circ
uit
desi
gne
r
App
licat
ion
des
igne
r
Sys
tem
des
igne
r
Log
ic d
esig
ner
Software
Hardware
Computer organization
Low-level view
App
licat
ion
dom
ains
Ele
ctro
nic
com
pon
ents
Computer architecture
BYU CS/ECEn 124 Chapter 01 - Abstraction 42
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.
Architect Interface
Interface
Goals
Means
Arts Engineering
Client’s taste: mood, style, . . .
Client’s requirements: function, cost, . . .
The world of arts: aesthetics, trends, . . .
Construction technology: material, codes, . . .
BYU CS/ECEn 124 Chapter 01 - Abstraction 43
Parts of a Computer System
The space of computer systems, with what we normally mean by the word “computer” highlighted.
Computer
Analog
Fixed-function Stored-program
Electronic Nonelectronic
General-purpose Special-purpose
Number cruncher Data manipulator
Digital
BYU CS/ECEn 124 Chapter 01 - Abstraction 44
Price/Performance Pyramid
Classifying computers by computational power and price range.
Embedded Personal
Workstation
Server
Mainframe
Super $Millions $100s Ks
$10s Ks
$1000s
$100s
$10s
Differences in scale,
not in substance
BYU CS/ECEn 124 Chapter 01 - Abstraction 45
Automotive Embedded Computers
Embedded computers are ubiquitous, yet invisible. They are found in
our automobiles, appliances, and many other places.
Engine
Impact sensors
Navigation & entertainment
Central controller
Brakes Airbags
BYU CS/ECEn 124 Chapter 01 - Abstraction 46
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?
BYU CS/ECEn 124 Chapter 01 - Abstraction 47