MSC - Microprocessors: Dr. Konstantinos Tatas Com - Tk@Fit - Ac.Cy
MSC - Microprocessors: Dr. Konstantinos Tatas Com - Tk@Fit - Ac.Cy
1
Useful Information
2
Course Objectives
By the end of the course students should be able
to:
– Evaluate the complex trade-offs involved in embedded
system design
– Write detailed embedded system requirements and
specification documents
– Write executable specifications using UML/SystemC
– Develop applications using ARM Developer Suite
– Write efficient ARM assembly and C programs in ARM and
Thumb mode
– Analyze program performance using traces
– Use code transformations to improve performance/code
size/power consumption.
3
Course Outline (1/2)
Week 1: Introduction to embedded systems – Embedded
microprocessor evolution – Design metrics and constraints
(performance, power, cost, time-to-market) and design optimization
challenges - Distributed and Real-time systems
Week2: Key embedded system technologies – Integrated Circuit
technology – Microprocessor technology – CAD tool technology –
Sensor technology
Week 3: Embedded system specification and modeling – Object-
oriented specification (UML/C++/SystemC) – Assignment 1
Week 4: Computer Architecture – Instruction sets – RISC vs. CISC
– pipelining - The ARM microprocessor architecture - ARM assembly
– ARM mode – Thumb mode - ARM and Thumb instruction set -
ARM conditional execution
Week 5: Processor I/O – Serial I/O – Busy/wait I/O – Interrupts –
Exceptions – Traps – ARM memory mapped I/O - Caches – Memory
Management Units – Protection Units – ARM cache and MMU –
Assignment 2
4
Course Outline (2/2)
Week 6: Assignment 1
Week 7: Programme design and analysis – DFGs –
CDFGs – Compilers – Assemblers – Linkers – Basic
compiler optimizations/code transformations –
Measuring programme speed – Trace-driven
performance analysis – Energy optimization –
programme size optimization
Week 8: Code transformations – Loop unrolling –
loop merging – loop tiling – performance optimizing
transformations
Week 9: Test
Week 10: Assignment 2
5
Course Assessment
6
References
Books
– W. Wolf, “Computers as Components”
– W. Wolf, “High-Performance Embedded
Computing”
– H. Kopetz, “Real-Time Systems: Design Principles
for Distributed Embedded Applications”
– S. Furber, “ARM System-on-Chip Architecture”
– P. Panda, “Memory Issues in Embedded Systems-
on-Chip”
– F. Vahid and T. Givargis, “Embedded System
Design: A Unified Hardware/Software
Introduction”
– F. Catthoor, “Data Access and Storage Management
for Embedded Programmable Processors”
7
Microprocessors for
Embedded systems
Computing systems are everywhere
Most of us think of “desktop”
computers
– PC’s
– Laptops
– Mainframes
– Servers
But there’s another type of computing
system
– Far more common... 8
Embedded systems
overview
Embedded computing
Computers are in here...
systems and here...
goes on and on
Home security systems VCR’s, DVD players
Life-support systems Video game consoles
Medical testing systems Video phones 10
Washers and dryers
Some common characteristics of
embedded systems
Single-functioned
– Executes a single program, repeatedly
Tightly-constrained
– Low cost, low power, small, fast, etc.
Reactive and real-time
– Continually reacts to changes in the
system’s environment
– Must compute certain results in real-time
without delay 11
An embedded system example –
Digital camera
Digital camera chip
CCD
lens
13
A System-on-a-Chip:
Example
Courtesy: Philips
14
Design at a crossroad
System-on-a-Chip
Analog
Spectral + 1 Gbit DRAM
RAM
where cost, performance,
Imager Preprocessing and energy are the real
issues!
64 SIMD Processor mC
Array + SRAM system DSP and control intensive
+2 Gbit Mixed-mode
Image Conditioning DRAM
Recog- Combines programmable
100 GOPS
nition and application-specific
modules
Software plays crucial role
15
Disciplines involved in
Embedded System Design
Digital System Design
Software Design
Analog/Mixed-Signal/RF System Design
Operating Systems
Microprocessors/Computer Architecture
Verification
Testing
etc
16
Languages traditionally used
in Embedded System Design
Specification/modeling Software design
– UML – C/C++
– SDL – Java
– C/C++ – Assembly
Hardware design Verification
– VHDL – VHDL/Verilog
– Verilog – SystemVerilog
– Tcl/tk
– Vera
17
Design challenge – optimizing
design metrics
Obvious design goal:
– Construct an implementation with desired
functionality
Key design challenge:
– Simultaneously optimize numerous design
metrics
Design metric
– A measurable feature of a system’s
implementation
– Optimizing design metrics is a key 18
challenge
Design challenge –
optimizing design metrics
Common metrics
– Unit cost: the monetary cost of manufacturing each
copy of the system, excluding NRE cost
– NRE cost (Non-Recurring Engineering
cost): The one-time monetary cost of designing the
system
– Size: the physical space required by the system
– Performance: the execution time or throughput of
the system
– Power: the amount of power consumed by the system
– Flexibility: the ability to change the functionality of
the system without incurring heavy NRE cost 19
Design challenge – optimizing
design metrics
in order to choose
lens
constraints 21
Memory controller ISA bus interface UART LCD ctrl
Time-to-market: a demanding
design metric
Time required to
develop a product to
the point it can be sold
to customers
Revenues ($)
Market window
– Period during which
the product would
have highest sales
Time (months) Average time-to-
market constraint is
about 8 months
22
Delays can be costly
Losses due to delayed market entry
Peak revenue
Simplified revenue model
Revenues ($)
Technology
– A manner of accomplishing a task,
especially using technical processes,
methods, or knowledge
Three key technologies for embedded
systems
– Processor technology
– IC technology
– Design technology 26
Processor technology
The architecture of the computation engine used to
implement a system’s desired functionality
Processor does not have to be programmable
– “Processor” not equal to general-purpose processor
Controller Datapath Controller Datapath Controller Datapath
Control index
Control Register Control logic Registers
logic
logic and file and State total
State register register
Custom State
+
ALU register
General
IR PC ALU IR PC
Data Data
memory memory
Program Data Program memory
memory memory
Assembly code Assembly code
for: for:
total = 0 total = 0
for i =1 to … for i =1 to …
27
General-purpose (“software”) Application-specific Single-purpose (“hardware”)
Processor technology
– Program memory
– General datapath with large Program memory Data
register file and general ALU memory
Features
– Contains only the components Data
needed to execute a single memory
program
– No program memory
Benefits
– Fast
– Low power 30
– Small size
Application-specific
processors Controller Datapath
Features
Assembly code
– Program memory for:
gate
oxide
IC package IC
source channel drain
32
Silicon substrate
IC technology Design
Approaches
IC Technology Implementation Approaches
Custom Semicustom
Cell-based Array-based
33
Full-custom design
35
Courtesy Intel
Transition to Automation and Regular
Structures
36
Intel 8286 Courtesy Intel Intel 8486
37
IC technology Design
Approaches
IC Technology Implementation Approaches
Custom Semicustom
Cell-based Array-based
38
Semi-custom
Routing channel
requirements are
reduced by presence
of more interconnect
layers
40
Standard Cell — Example
[Brodersen92]
41
Standard Cell - Example
Custom Semicustom
Cell-based Array-based
43
Programmable Logic Devices
VD D
metal
rows of Uncommited
uncommitted possible
cells GND contact Cell
routing
channel Committed
Cell
(4-input NOR)
Out
45
Sea-of-gate Primitive Cells
Oxide-isolation
PMOS
PMOS
NMOS
NMOS
NMOS
Random Logic
Memory
Subsystem
49
From Smith97
Altera MAX Interconnect
Architecture
column channel row channel
t PIA
LAB1 LAB2
LAB
PIA
t PIA
LAB6
Array-based Mesh-based
50
(MAX 3000-7000) (MAX 9000)
LUT-Based Logic Cell
4
C1....C4
D4 Bits xxxx
Logic control
D3 xx xx
function xx
xx x xx x
D2 of xx
xxx
D1
Logic xx xx
functionx x
x
of x x
F4 xxx
Bits xxxx
F3 Logic xx control xx
function xx
xx x xx x
F2 of xx
xxx
F1
xx xx
x
xxxxx x
H x
P
Multiplexer Controlled
by Configuration Program 51
Xilinx 4000 Series
Array-Based Programmable
Wiring
Interconnect
Point
M
Cell
Horizontal
tracks
52
Vertical tracks
Transistor Implementation of
Mesh
53
Xilinx XC4000ex
54
Design Technology
The manner in which we convert our concept
of desired system functionality into an
implementation
Compilation/ Libraries/ Test/
Synthesis IP Verification
Test/Verification: Ensures
correct functionality at each
level, thus reducing costly Logic Logic Gates/ Gate
iterations between levels. specification synthesis Cells simulators
To final implementation
55
The co-design ladder
In the past: Sequential program code (e.g., C, VHDL)
synthesis enables a
Assemblers, linkers
(1950's, 1960's) Logic equations / FSM's
unified view of Logic synthesis
(1970's, 1980's)
hardware and software Machine instructions
Logic gates
Hardware/software
“codesign” Microprocessor plus
Implementation
VLSI, ASIC, or PLD
program bits: “software” implementation: “hardware”
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.
56
Independence of processor and IC
technologies
Basic tradeoff
– General vs. custom
– With respect to processor technology or IC
technology
– The two technologies are independent
General- Single-
purpose ASIP purpose
General, processor processor Customized,
providing improved: providing improved:
58
Generalised Design Flow
59
Architecture ReUse
Silicon System Platform
– Flexible architecture for hardware and software
– Specific (programmable) components
– Network architecture
– Software modules
– Rules and guidelines for design of HW and SW
Has been successful in PC’s
– Dominance of a few players who specify and control architecture
Application-domain specific (difference in constraints)
– Speed (compute power)
– Dissipation
– Costs
– Real / non-real time data
60
Platform-Based Design
“Only the consumer gets freedom of choice;
designers need freedom from choice”
(Orfali, et al, 1996, p.522)
A platform is a restriction on the space of possible implementation
choices, providing a well-defined abstraction of the underlying
technology for the application developer
New platforms will be defined at the architecture-micro-architecture
boundary
They will be component-based, and will provide a range of choices
from structured-custom to fully programmable implementations
Key to such approaches is the representation of communication in
the platform model
61
Source:R.Newton
Platform-based Design –
System-on-Chip
Use of predefined Intellectual Property (IP)
A platform-based system consists of a RISC
processor, memories, busses and a common
language
Platform-based design poses the problem of
partitioning a solution between hardware
(HDL) and software (programming
processors)
62
Platforms Enable Simplified SoC
Design
Core Customer demands
Near Peripherals
– Fast turn-around time
– Easy access to pre-qualified
building blocks
– Web enabled
Design technology
– Core platforms
– ‘Big’ IP
– Emerging SoC bus standards
– Embedded software
Far Peripherals – HW/SW co-verification 63
And Automation of IP Selection
& Integration
64
Heterogeneous Programmable
Platforms FPGA Fabric
Embedded memories
Embedded PowerPc
Hardwired multipliers
66
Xilinx’s products
67
Comparison of CMOS design
methods
Design NRE Unit Cost Power Complexity Time-to- Performance Flexibility
Method Dissipation of Market
Implement
ation
μProcessor low medium high low low low high
/DSP
Hardwired custom
None
100-1000
Choices
Configurable/Parameterizable
10-100
flexible
Domain-specific processor
Somewhat
(e.g. DSP)
1-10
Embedded microprocessor
Fully
flexible
0.1-1
Flexibility
Impact of Implementation
69
(or application scope)
Design Economics (1)
70
Design Economics (2)
Costs:
– Unit cost: the monetary cost of manufacturing each copy
of the system, excluding NRE cost
– NRE cost (Non-Recurring Engineering cost): The one-time
monetary cost of designing the system
– total cost = NRE cost + unit cost * # of units
– per-product cost = total cost / # of units
= (NRE cost / # of units) + unit cost
• Example
– NRE=$2000, unit=$100
– For 10 units
– total cost = $2000 + 10*$100 = $3000
– per-product cost = $2000/10 + $100 = $300
72
Amortizing NRE cost over the units results in an
additional $200 per unit
NRE and unit cost metrics
Compare technologies by costs -- best depends on
quantity
– Technology A: NRE=$2,000, unit=$100
– Technology B: NRE=$30,000, unit=$30
– Technology C: NRE=$100,000, unit=$2
$200,000 $200
A A
B B
$160,000 $160
C C
tota l c ost (x1000)
p er p rod uc t c ost
$120,000 $120
$80,000 $80
$40,000 $40
$0 $0
0 800 1600 2400 0 800 1600 2400
Numb er of units (volume) Numb er of units (volume)
10,000
Productivity
100
10
0.1
0.01
2005
2001
1993
2003
1987
1983
1985
1991
1989
1999
1997
1995
2007
2009
Exponential increase over the past few
decades
76
The growing design-
productivity gap
Moore’s Law: Design Productivity Crisis (SRC 1997)
Standard cell density and speed Potential Design Complexity and Designer Productivity
10,000 10,000 100,000,000
Equivalent Added Complexity
Gates
100
ASIC clock (MHz)
Tr./S.M. 1,000
10 100
1,000
1 10
x x
0.1 1
xx
xx x
x
0.01 0.1
80
Real-time and
distributed systems
Dr. Konstantinos Tatas
81
What is real-time? Is there
any other kind?
A real-time computer system is a
computer system where the
correctness of the system behavior
depends not only on the logical results
of the computations, but also on the
physical time when these results are
produced.
By system behavior we mean the
sequence of outputs in time of a 82
Real-time means reactive
A real-time computer system must react to stimuli
from its environment
The instant when a result must be produced is
called a deadline.
If a result has utility even after the deadline has
passed, the deadline is classified as soft, otherwise
it is firm.
If severe consequences could result if a firm
deadline is missed, the deadline is called hard.
Example: Consider a traffic signal at a road before a
railway crossing. If the traffic signal does not
change to red before the train arrives, an accident
could result. 83
Reliability
The Reliability R(t) of a system is the probability that a system
will provide the specified service until time t, given that the
system was operational at the beginning (t-t0)
The probability that a system will fail in a given interval of
time is expressed by the failure rate, measured in FITs (Failure
In Time).
A failure rate of 1 FIT means that the mean time to a failure
(MTTF) of a device is 10^9 h, i.e., one failure occurs in about
115,000 years.
If a system has a constant failure rate of λ failures/h, then the
reliability at time t is given by
R(t)= exp(-λ(t-to))
MTTF = 1/λ
84
Example
85
Safety
86
Maintainability
87
Name some hard, firm and
soft deadline embedded
systems
88
Example
an automotive company produces 2,000,000 electronic engine
controllers of a special type.
The following design alternatives are discussed
(a) Construct the engine control unit as a single SRU with the
application software in Read Only Memory (ROM).The production
cost of such a unit is $250. In case of an error, the complete unit
has to be replaced.
(b) Construct the engine control unit such that the software is
contained in a ROM that is placed on a socket and can be replaced
in case of a software error. The production cost of the unit without
the ROM is $248. The cost of the ROM is $5.
(c) Construct the engine control unit as a single SRU where the
software is loaded in a Flash EPROM that can be reloaded. The
production cost of such a unit is $255.
The labor cost of repair is assumed to be $50 for each vehicle. (It is
assumed to be the same for each one of the three alternatives).
Calculate the cost of a software error for each one of the three
alternative designs if 300,000 cars have to be recalled because of
the software error (example in Sect. 1.6.1).
Which one is the lowest cost alternative if only 1,000 cars are
affected by a recall? 89
Distributed RT system
model
From the POV of an outside observer, a real-time
(RT) system can be decomposed into three
communicating subsystems:
– a controlled object (the physical subsystem, the behavior
of which is governed by the laws of physics),
– a “distributed” computer subsystem (the cyber system, the
behavior of which is governed by the programs that are
executed on digital computers)
– a human user or operator
The distributed computer system consists of
computational nodes that interact by the exchange
of messages.
A computational node can host one or more
computational components.
90
Event-Triggered Control
Versus Time-Triggered
Control
91
92