Upload
lionel-curtis
View
217
Download
0
Embed Size (px)
Citation preview
©2008 R. Gupta, UCSD
COSMOS Summer 2008
Embedded Systems
Rajesh K. Gupta
Computer Science and Engineering
University of California, San Diego.
©2008 R. Gupta, UCSD
Roadmap
• Topic:– What are embedded systems?
– What has that got to do with computers and ‘chips’?
• This lecture– Concepts covered: computing, computers, computer
architecture
– Computer peripherals
• Next lecture– Computer interfaces and networks: I2C, SPI
• Reference– None
Keywords:Embedded ComputerComputing MachinesComputer ApplicationComputer ArchitectureComputer OrganizationCPU, Memory, BusISA
©2008 R. Gupta, UCSD
Conventions (if I can follow them• Important concept words are usually
highlighted – Or strongly highlighted.
• “Memory” means more than it says
• Challenges and Teasers– Teaser questions are not meant to be answered
©2008 R. Gupta, UCSD
©2008 R. Gupta, UCSD
Embedded Systems
• “Systems” that are part of another “Application”
• We are interested in “Embedded Computer Systems”– Why? Hold that thought for now. (Hint: wait until ‘chips’)
• Computers are machines that are designed either for general-purpose applications or for specific applications.
• Computing refers to problem solving using Computers– machine-centric problem solving.
• In the past, computing are confined to scientific applications, and machines were expensive and necessarily shared.
©2008 R. Gupta, UCSD
Examples of Computational Problem Solving• Can you think of examples where you need
computers to solve problems?– Day-to-day
– In-the-interest-science-and-humanity
• Actually by far the largest application of computing was in building computers (hw, sw)
©2008 R. Gupta, UCSD
Problem Solving
• Problem: – Find greatest common divisor of two numbers: 6, 15.
• Solutions:1. Mathematical:
gcd(a, b) = gcd(a-b, b) assume w.l.o.g. a >=b
gcd(a, 0) = a
2. Procedural (Sequential): Chinese Remainder Theorem. if (x != 0 and y!= 0) {
repeat {while (x>=y)
x = x - y;swap x, y;} until (y=0);
write gcd = x;
©2008 R. Gupta, UCSD
Traditional Problem Solving using Computers• Describe the method in a programming
language
• Compile this program into a machine language
• Execute machine program– supply input data
©2008 R. Gupta, UCSD
The Computing Experience• The Computer Center
– Mainframe computing
• The Personal Computer– Desktop, laptop, palm top computing
• The Ubiquitous Embedded Computer– Mobile, purpose-built.
©2008 R. Gupta, UCSD
Computing Machines: Touchpoints in History• Generation 0: Mechanical machines
– Difference engine by Babbage (1834)
• Generation 1: Vacuum Tubes (1945-1955)– ENIAC by Eckert and Mauchly (1943)
• Generation 2: Transistors (1955-1965)– PDP-1 by DEC (1960): first microcomputer
• Generation 3: Integrated Circuits (1965-1980)– IBM 1401, 7094 and System/360 (1964)
• Generation 4: PCs and VLSI (1980-continuing)
©2008 R. Gupta, UCSD
The Computer
• Computers manipulate information by means of programmed instructions
• A computer hardware that makes this possible is called a stored program computer.
• A computer system designer must – evaluate applications for which the computer is to be used
– build a system architecture from software to its hardware organization
– (by architecture we often mean how the system appears to the system programmer, though it is not strictly correct..)
• The lexicon: architecture, organization, usage.
©2008 R. Gupta, UCSD
Computer Architecture
• Architecture provides– A model to organize, implement system parts
– A model to use the system
• Architectures can be diverse…
Architectural Design Paradigms
SpecializedAmbitious (and never finished)
The sacrificial altar
Engineered
“Organically grown”
The Planned Community
©2008 R. Gupta, UCSD
Hardware Organization
• Computer Organization refers to the structure of a computer:
DataPathController
controlenablesselects
dataconditions
Memory
CPUAddress
R/W
Data
©2008 R. Gupta, UCSD
Software ‘Architecture’
Assembler
Hardware
Micro-operations
Application
Compiler
©2008 R. Gupta, UCSD
A Personal Computer (PC)
• Uses commodity components and standard interfaces to build the machine
• Performance/cost variations due to choice of components and (sometimes) their interconnection.
©2008 R. Gupta, UCSD
PC Components
• Case:– desktop, minitower, mid case, mid tower, full tower, large tower– include a power supply (typically 200 watts)
• CPU and CPU fan– sold as a chip
• Motherboard– single-board computer – contains place holders for CPU and Memories– Memory modules
• Interfaces– Video (card and monitor)– Others: (I/O card) “Floppy, CD-ROM, Keyboard, Hard drive,
Sound card, Speakers, Modem, Tape/zip drive, Mouse”
©2008 R. Gupta, UCSD
168-pin SDRAM
184-pin DDR-SDRAM
The Stuff at Fry’s
©2008 R. Gupta, UCSD
Personal Computing
• “Low cost and general purpose”
CPU MEM
BUS
CPU DATA
BUS
INST
©2008 R. Gupta, UCSD
Computer Organization
CPU MEM
BUS
DevicesDevicesDevices
DrivesInput devices
Output devicesNetworking Interface
1
2
3
4
©2008 R. Gupta, UCSD
Memory
CPU MEM
BUS
DevicesDevicesDevices
2-3 GHz 50 ns SIMMPC2-5300 667 MHz DIMM
©2008 R. Gupta, UCSD
Lexicon: Non-intuitive & Not-obvious• Random Access: RAMs
– static
– dynamic
– quasi-static
• Read Only: ROMs– PROM
– EPROM
– EEPROM
– Flash EPROM
– “CMOS”
• “Cache”?
CPU
Cache
Memory
What are L1, L2, L3?
©2008 R. Gupta, UCSD
Buses
• Functions:– transmit information
– coordinate activities
– interface standard
• Bandwidth, width/xfr * xfr/sec
• Memory addressing, addr/word, addr/block
• Latency tolerance: low, medium, high
• Length: microns, mm, inches, feet, km, 1000s km
©2008 R. Gupta, UCSD
Buses
• CPU -- L1 Cache– very high bandwidth, 50-500
MB/sec, addr/word
• L1 Cache -- L2 Cache
• Cache -- Main Memory– very high bandwidth, 1-200
MB/sec
• Main Memory -- Disk– high bandwidth, 2 MB/sec,
addr/block
• Network -- Main Memory– similar to disk-memory
• Memory/CPU -- Display– high bandwidth, 1-20 MB/sec
• Computer -- Computer– medium bandwidth, kbps to
Mbps, addr/message.
©2008 R. Gupta, UCSD
CPU – Memory Interaction
DataPathController
controlenablesselects
dataconditions
Memory
CPUAddress
R/W
Data
• CPU controlled by a clock pulse.• Memory is controlled by R/W control signals.
• CPU must synchronize its memory read, write operations with respect to its internal clock.
• Example: 5 MHz clock, 500 ns access time.
Clock
clock
addr VALID
select
R/W’
VALIDdata
WRITE CYCLE
200 ns
500 ns
©2008 R. Gupta, UCSD
CPU Operation
• A computing machine delivers its functionality using instructions.– instruction set architecture (ISA)
• A CPU executes each instruction in steps:– Fetch instruction
– Decode instruction
– Execute instruction
• Fetch instruction– location pointed by the Program Counter
©2008 R. Gupta, UCSD
CPU Simplified
ALU
A B
FileRegister
Accumulator
©2008 R. Gupta, UCSD
The Assembly Language
• Machine defined by an ISA
• A program is translated into an object program
• An assembly language consists of– statement corresponding to machine instructions
– represented mnemonically: easier to remember than numbers and bits
– typical mnemonics: ADD, SUB, MUL
– machine dependent
©2008 R. Gupta, UCSD
Level 0
Level 1
Level 2
Level 3
A B
mux
C
ALU
MEM
SR
SA
Lc
Controller
controlenablesselects
dataconditions
Data Path
Hardware View Software View
ALU
A B
FileRegister
Accumulator
Program
CPU prog.
data
©2008 R. Gupta, UCSD
Let us see how a programmer would build a CPU...
Step 1: PC points to an instruction in the memory.
Mem
PC
©2008 R. Gupta, UCSD
Let us see how a programmer would build a CPU...
Step 1: PC points to an instruction in the memory.
Mem
PC
Step 2: Memory responds with “data” that represent an instruction to be stored in IR.
Mem
PC
IR
©2008 R. Gupta, UCSD
Let us see how a programmer would build a CPU...
Step 1: PC points to an instruction in the memory.
Mem
PC
Step 2: Memory responds with “data” that represent an instruction to be storedin IR.
Mem
PC
IR
Mem
PC
IR
Step 3: an instruction is decoded into“control” lines by the control block.
control
©2008 R. Gupta, UCSD
Let us see how a programmer would build a CPU...
Step 1: PC points to an instruction in the memory.
Mem
PC
Step 2: Memory responds with “data” that represent an instruction to be storedin IR.
Mem
PC
IR
Mem
PC
IR
Step 3: an instruction is decoded into“control” lines by the control block.
control
Step 4: Memory also provides “data” that is used by the ALU to compute variable values.
Mem
PC
IR
control
ALU
Acc
©2008 R. Gupta, UCSD
CPU Building (contd.)
Step 5: ALU output is stored back into memory; the ALU may also compute address, in which case ACC output it input to PC. ALU also computes data which is stored in memory.
Mem
PC
IR
control
ALU
Accsave data into memory.
load new address into PC, jump operation. addr
data in
data out
©2008 R. Gupta, UCSD
The Changing Computer
Instrumented wide-area spaces
Personal area spaces
Internet end-points
In-body, in-cell, in-vitro spaces
©2008 R. Gupta, UCSD
Driven By “Chips” Underneath
Graphics ControllerGraphics ControllerCellphone BasebandCellphone Baseband
©2008 R. Gupta, UCSD
Embedded Systems: Sensor Node
©2008 R. Gupta, UCSD
©2008 R. Gupta, UCSD
Recap
• A computer is a ‘Computing Machine’
• We saw what a computer looks like– Beyond what you see at Fry’s
– Architectural components & interfaces
• CPU, ALU, Memory, Bus
• Application = What can we do with computers– Traditional numeric problem solving replaced by ‘special-
purpose’ functions
• Sensing, control, media,…
• Next: what are peripherals and how we connect to these?