Computer Architecture and Embedded System
Computer Architecture and Embedded System
L1
References
1. Embedded Systems Design, Steve Heath, Elsevier 2. Embedded Systems Design, Frank Vahid & Tony Givargis, John wiley 3. Fundamentals of embedded software, Daniel W lewis, Pearson education
(Micro)processors are embedded within electronic devices, equipment, appliances Hard to define - any computing Toys, mobile phones, system other than a desktop kitchen appliances, computer even pens Billions of units produced yearly, versus millions of Many times more desktop units Perhaps 50 per household and processors used in each of them , per automobile though they cost These processors make these devices much less sophisticated, versatile and inexpensive
Embedded systems A microprocessor based system that is built to control a function(s) of a system and is designed not to be programmed by the user. (controller) User could select the functionality but cannot define the functionality. Embedded system is designed to perform one or limited number of functions, may be with choices or options. PCs provide easily accessible methodologies, HW & SW that are used to build Embedded systems
Why did they become popular? Replacement for discrete logic-based circuits Functional upgradability ?, easy maintenance upgrades Improves the performance of mechanical systems through close control Protection of Intellectual property Replacement of Analogue circuits (DSPs)
Inputs and outputs / sensors & actuators Digital - binary, serial/parallel, Analogue, Displays and alarms, Timing devices
SW OS, application SW, initialisation, self check Algorithms
Path of electronic design Mechanical control systems- expensive & bulky Discrete electronic circuits fast but no flexibility
Pixel coprocessor
D2A
JPEG codec
Microcontroller
Multiplier/Accum
DMA controller
Display ctrl
Memory controller
UART
LCD ctrl
Single-functioned -- always a digital camera Tightly-constrained -- Low cost, low power, small, fast Reactive and real-time -- only to a small extent
Size: the physical space required by the system Performance: the execution time or throughput of
the system
Power: amount of power consumed by the system Flexibility: the ability to change the functionality of
the system without incurring heavy NRE cost
Expertise with both software and hardware is needed to optimize design metrics A designer must be comfortable with various technologies in order to choose the best for a given application and constraints
Hardware
CD
Microcontroller
Software
Memory controller
UART
LCD ctrl
On-time
Market rise
Product life = 2W, peak at W Time of market entry defines a triangle, representing market penetration Triangle area equals revenue
The difference between the on-time and delayed triangle areas
Revenues ($)
2W
Loss
On-time entry
Delayed entry
Time
Revenues ($)
On-time
Percentage revenue loss = (D(3W-D)/2W2)*100% Try some examples Lifetime 2W=52 wks, delay D=4 wks (4*(3*26 4)/2*26^2) = 22% Lifetime 2W=52 wks, delay D=10 wks (10*(3*26 10)/2*26^2) = 50% Delays are costly!
Market rise
Delayed
2W
On-time entry
Delayed entry
Time
Example
NRE= Rs 20000, unit= Rs100 For 100 units
total cost = 20000 + 100*100 = 30000 per-product cost = 30,000/100 or 20000/100 + 100 = 300
Amortizing NRE cost over the units results in an additional Rs 200 per
NRE and unit cost metrics Compare technologies by costs -- best depends on quantity !
Technology A: NRE=Rs 5,000, unit=Rs 100 Technology B: NRE=Rs 1,00,000, unit=Rs 25 Technology C: NRE=Rs10,00,000, unit= Rs 2
Processor technology
The architecture of the computation engine used to implement a systems desired functionality Processor does not have to be programmable
Processor not equal to general-purpose processor
Controller
Control logic and State register IR PC
Datapath
Register file General ALU
Controller
Control logic and State register IR PC
Datapath
Registers Custom ALU
Controller Datapath
Control logic State register index total +
Data memory
Program memory
Data memory
Data memory
Program memory
Assembly code for: total = 0 for i =1 to
General-purpose (software)
Application -specific
Single-purpose (hardware)
Processor technology
Processors vary in their customization for the problem at hand
Desired functionality
Generalpurpose processor
Applicationspecific processor
Singlepurpose processor
General-purpose processors
Programmable device used in a variety of applications
Also known as microprocessor
Controller
Control logic and State register IR PC
Features
Program memory General datapath with large register set and general ALU
User benefits
Low time-to-market and NRE costs High flexibility
Program memory
Assembly code for: total = 0 for i =1 to
Data memory
Single-purpose processors
Digital circuit designed to execute exactly one program
Ex. coprocessor, accelerator Features Contains only the components needed to execute a single program No program memory
Controller
Control logic
Datapath
index
total
State register +
Data memory
Benefits
Fast Low power Small size
Datapath
Registers Custom ALU Data memory
IR
PC
Features
Program memory
Assembly code for: total = 0 for i =1 to
Benefits
Some flexibility, good performance, size and power
IC technology
The manner in which a digital (gate-level) implementation is mapped onto an IC
IC: Integrated circuit, or chip IC technologies differ in their customization to a design ICs consist of numerous layers (perhaps 10 or more)
IC technologies differ with respect to who builds each layer & when
gate
IC package IC source oxide channel drain
Silicon substrate
Full-custom/VLSI
All layers are optimized for an embedded systems particular digital implementation
Placing transistors Sizing transistors Routing wires
Benefits
Excellent performance, small size, low power
Drawbacks
High NRE cost (e.g., Rs 2 M), long time-to-market
Benefits
Good performance, good size, less NRE cost than a full-custom implementation (perhaps $10k to $100k)
Drawbacks
Still require weeks to months to develop
Benefits
Low NRE costs, almost instant IC availability
Drawbacks
Bigger, expensive (perhaps Rs 2000 per unit), power hungry, slower
Moores law
The most important trend in embedded systems
Predicted in 1965 by Intel co-founder Gordon Moore IC transistor capacity has doubled roughly every 18 months for the past several decades
10,000 Logic 1,000 transistors per 100 chip 10 (in millions) 1 0.1 0.01 Note: logarithmic 0.001 scale
Moores law This growth rate is hard to imagine, most people underestimate
1984
1987
1990
1993
1996
1999
Something that doubles frequently grows more quickly than most people realize!
A 2002 chip can hold about 15,000 1981 chips inside itself
Design needs Design technology Achieving the metrics + fast & reliably Enhanced productivity
Design
single stage
Multi stage - several abstraction levels
Design Technology
The manner in which we convert our concept of desired system functionality into an implementation
Compilation/Synthesis: Automates exploration and insertion of implementation details for lower level. Compilation/ Libraries/ Synthesis IP
System specification
Test/ Verification Model simulat./ checkers Hw-Sw cosimulators HDL simulators Gate simulators
Hw/Sw/ OS
Libraries/IP: Incorporates pre-designed implementation from lower abstraction level into higher level.
Test/Verification: Ensures correct functionality at each level, thus reducing costly iterations between levels.
Behavioral specification
Cores
RT components
RT specification
Logic specification
Gates/ Cells
To final implementation
Functionality perspective
Environmental
User I/F or Operator perspective
System
Performance
Physical
Architectural perspective
Models are foundations of science and engineering Designs usually start with informal specifications However, soon a need for Models and Abstractions is established Models or abstractions have connections to Implementation (h/w, s/w) and Application Two types of modeling: System structure & system behavior The relationships, behavior and interaction of atomic components Coordinate computation of & communication between components Models from classical CS FSM, RAM (von Neumann), CCS (Milner) Turing machine, Universal Register Machine
Models
Conceptual model Physical model
Analogue model
Mathematical model
Numerical model
Computational model Implementation Assumptions & accuracy
Good Models
Simple Ptolemy vs. Galileo Amenable for development of theory to reason should not be too general Has High Expressive Power a game is interesting only if it has some level of difficulty! Provides Ability for Critical Reasoning Science vs. Religion Practice is currently THE only serious test of model quality Executable (for Simulation) Synthesizable Unbiased towards any specific implementation (h/w or s/w)
Others: size, weight, heat, temperature, reliability etc System model must support description of both functional behavior and physical interaction
Simulation and Synthesis Two sides of the same coin Simulation: scheduling then execution on desktop computer(s) Synthesis: scheduling then code generation in C++, C, assembly, VHDL, etc. Validation by simulation important throughout design flow Models of computation enable Global optimization of computation and communication Scheduling and communication that is correct by construction
By verification
property is provable.
By simulation
check behavior for all inputs.
By intuition
property is true. I just know it is.
By assertion
property is true. Would make something of it?
By intimidation
Dont even try to doubt whether it is true
An embedded system is expected to receive inputs, process data or information, and provide outputs
Models exist without language Models are expressed in some language or the other A model could be expressed in different languages A language could express more than one model Some languages are better suited to express some models
Sequential model A model that represents the embedded system as a sequence of actions. A variety of systems need this sequence of steps. Most programming languages and natural languages can express this feature Communicating-process model A number of independent processes (may be sequential) communicate among themselves whilst doing their job. Synchronisation/signalling, passing data, mutual exclusion etc. Some languages are better suited.
State machine model A model where the embedded system resides in a state till an input to the system/event makes it change its state. Most reactive and control system applications fall under this category. FSM representations are good way expressing the model. Text Vs Graphic languages Data flow model An embedded system that functions mainly by transforming an input data stream into an output data stream functioning of an mpeg camera UML may be more useful. Most DSP applications
OO models Well known Useful for successive decomposition problems, problems where OO paradigm is useful etc.
Multiple models and multiple languages may be needed to describe a complex system. The model description must be accompanied by semantic descriptions for proper processing
Lift model - English language description Lift cage contains a number of controls floor numbers, open and close door, it receives the data regarding the floor it is at. Users press the floor number to which they desire to go and depending upon the current location and the floor it has to go it moves up and down. Before it moves, the door is closed. On reaching the floor it keeps the door open for 15 sec, unless close door operation is executed before door closes. When stationary, door is kept closed. When moving in a direction it does not return to opposite direction, even on request, unless no request for higher or lower floor in the same direction is pending
Problems 1. Develop a model for the lift controller 2. Identify one problem each that fits into the models discussed above. 3. Develop a model for a data acquisition system that receives data from 14 channels through A/D converters and takes appropriate control actions as a function of the 14 inputs and communicates with 4 actuators. Inputs from channel 15 or 16 need immediate response, and the controller must respond in a time of about 20 clock cycles. In these cases, actuator 5 is activated.
Modeling Approaches based on Software Design Methods No systematic design in 60s From 70s, many different s/w design strategies Design methods based on functional decomposition Real-Time Structured Analysis and Design(RTSAD) Design methods based on concurrent task structuring Design Approach for Real-Time Systems (DARTS) Design methods based on information hiding Object-Oriented Design method (OOD) Design methods based on modeling the domain Jackson System Development method (JSD) Object-Oriented Design method (OOD)
continued
UML is the latest manifestation becoming prevalent in complex embedded system design
Example: given input from a camera, digitally encode it using MPEG II encoding standards. this task involves: storing the image for processing going through a number of processing steps, e.g., Discrete cosine transform (DCT), Quantization, encoding (variable length encoding), formatting the bit stream, Inverse Discrete Cosine transform (IDCT), ... Is this problem appropriate for Reactive Systems, Synchronous Data flow, CSP, ... More than one model could be appropriate.
Choice of Model
Model Choice: depends on application domain DSP applications use data flow models Control applications use finite state machine models Event driven applications use reactive models efficiency of the model in terms of simulation time in terms of synthesized circuit/code. Language Choice: depends on underlying semantics semantics in the model appropriate for the application. available tools personal taste and/or company policy
10,000
1,000
100
10 1 0.1
0.0 1
1993
2001
1983
1985
1987
1989
1991
1995
1997
1999
2003
2005
2007
2009
In the past:
Hardware and software design technologies were very different Recent maturation of synthesis enables a unified view of hardware and software
Compilers (1960's,1970's)
Assembly instructions
Hardware/software codesign
Implementation
The choice of hardware versus software for a particular function is simply a tradeoff among various design metrics, like performance, power, size, NRE cost, and especially flexibility; there is no fundamental difference between what hardware or software can implement.
Generalpurpose processor
ASIP
Singlepurpose processor
PLD
Semi-custom Full-custom
100,000 10,000
1000
IC capacity
productivity
Gap
1M transistors, 1 designer=5000 trans/month Each additional designer reduces for 100 trans/month So 2 designers produce 4900 trans/month each
16 19 24 43
15 16
18
23
Summary
Embedded systems are everywhere Key challenge: optimization of design metrics
Design metrics compete with one another
A unified view of hardware and software is necessary to improve productivity Three key technologies
Processor: general-purpose, application-specific, single-purpose IC: Full-custom, semi-custom, PLD Design: Compilation/synthesis, libraries/IP, test/verification