1.1 chuong 1
INTRODUCTION
In this chapterwe set the stage for our study of embedded computing systemdesign.
In order to understand the design processes,we ?rst need to understand how and
why microprocessors are used for control, user interface, signal processing, and
many other tasks. The microprocessor has become so common that it is easy to
forget how hard some things are to do without it.
We ?rst review the various uses of microprocessors and then review the major
reasons why microprocessors are used in system design?delivering complex behav-
iors, fast design turnaround, and so on. Next, in Section 1.2, we walk through the
design of an example system to understand the major steps in designing a system.
Section 1.3 includes an in-depth look at techniques for specifying embedded sys-
tems?we use these speci?cation techniques throughout the book. In Section 1.4,
we use a model train controller as an example for applying the speci?cation tech-
niques introduced in Section1.3 that we use throughout the rest of the book.
Section 1.5 provides a chapter-by-chapter tour of the book.
1.1 COMPLEX SYSTEMS AND MICROPROCESSORS
What is an embedded computer system? Loosely de?ned, it is any device that
includes a programmable computer but is not itself intended to be a general-purpose
computer.Thus,a PC is not itself an embedded computing system,although PCs are
often used to build embedded computing systems. But a fax machine or a clock
built from a microprocessor is an embedded computing system.
This means that embedded computing system design is a useful skill for many
types of product design. Automobiles, cell phones, and even household appliances
make extensive use of microprocessors. Designers in many ?elds must be able to
identify where microprocessors can be used, design a hardware platform with I/O
devices that can support the required tasks, and implement software that performs
the required processing. Computer engineering, like mechanical design or thermo-
dynamics, is a fundamental discipline that can be applied inmany different domains.
But of course, embedded computing system design does not stand alone. Many of
the challenges encountered in the design of an embedded computing system are
not computer engineering?for example, they may be mechanical or analog electri-
cal problems. In this book we are primarily interested in the embedded computer
itself, so we will concentrate on the hardware and software that enable the desired
functions in the ?nal product.
1.1.1 Embedding Computers
Computers have been embedded into applications since the earliest days of com-
puting. One example is the Whirlwind, a computer designed at MIT in the late
1940s and early 1950s.Whirlwind was also the ?rst computer designed to support
real-time operation and was originally conceived as a mechanism for controlling
an aircraft simulator. Even though it was extremely large physically compared to
todayfs computers (e.g., it contained over 4,000 vacuum tubes), its complete design
from components to system was attuned to the needs of real-time embedded com-
puting.The utility of computers in replacing mechanical or human controllers was
evident fromthe very beginning of the computer era?for example,computerswere
proposed to control chemical processes in the late 1940s [Sto95].
A microprocessor is a single-chip CPU. Very large scale integration (VLSI)
stet?the acronymis the name technology has allowed us to put a complete CPU on
a single chip since 1970s, but those CPUs were very simple. The ?rst microproces-
sor, the Intel 4004,was designed for an embedded application,namely, a calculator.
The calculator was not a general-purpose computer?it merely provided basic
arithmetic functions. However, Ted Hoff of Intel realized that a general-purpose
computer programmed properly could implement the required function, and that
the computer-on-a-chip could then be reprogrammed for use in other products
as well. Since integrated circuit design was (and still is) an expensive and time-
consuming process, the ability to reuse the hardware design by changing the
software was a key breakthrough. The HP-35 was the ?rst handheld calculator to
perform transcendental functions [Whi72]. It was introduced in 1972, so it used
several chips to implement the CPU, rather than a single-chip microprocessor. How-
ever, the ability to write programs to perform math rather than having to design
digital circuits to perform operations like trigonometric functions was critical to
the successful design of the calculator.
Automobile designers started making use of the microprocessor soon after
single-chip CPUs became available. The most important and sophisticated use of
microprocessors in automobileswas to control the engine:determiningwhen spark
plugs ?re, controlling the fuel/air mixture, and so on. There was a trend toward
electronics in automobiles in general?electronic devices could be used to replace
the mechanical distributor. But the big push toward microprocessor-based engine
control came from two nearly simultaneous developments: The oil shock of the
1970s caused consumers to place much higher value on fuel economy, and fears of
pollution resulted in laws restricting automobile engine emissions. The combina-
tion of low fuel consumption and low emissions is very dif?cult to achieve; to meet
these goals without compromising engine performance, automobile manufacturers
turned to sophisticated control algorithms that could be implemented only with
microprocessors.
Microprocessors come in many different levels of sophistication; they are usu-
ally classi?ed by their word size.An 8-bit microcontroller is designed for low-cost
applications and includes on-board memory and I/O devices; a 16-bit microcon-
troller is often used for more sophisticated applications that may require either
longer word lengths or off-chip I/O and memory;and a 32-bit RISC microprocessor
offers very high performance for computation-intensive applications.
Given thewide variety ofmicroprocessor types available,it should be no surprise
that microprocessors are used in many ways. There are many household uses of
microprocessors. The typical microwave oven has at least one microprocessor to
control oven operation. Many houses have advanced thermostat systems, which
change the temperature level at various times during the day.The modern camera is
a prime example of the powerful features that can be added under microprocessor
control.
Digital television makes extensive use of embedded processors. In some cases,
specialized CPUs are designed to execute important algorithms?an example is
the CPU designed for audio processing in the SGS Thomson chip set for DirecTV
[Lie98]. This processor is designed to ef?ciently implement programs for digital
audio decoding. A programmable CPU was used rather than a hardwired unit for
two reasons: First, it made the system easier to design and debug; and second, it
allowed the possibility of upgrades and using the CPU for other purposes.
A high-end automobile may have 100 microprocessors, but even inexpensive
cars today use 40 microprocessors. Some of these microprocessors do very simple
things such as detect whether seat belts are in use. Others control critical functions
such as the ignition and braking systems.
Application Example 1.1 describes some of the microprocessors used in the
BMW 850i.
stability control (ASC T) system intervenes with the engine during maneuvering to improve
the carfs stability. These systems actively control critical systems of the car; as control systems,
they require inputs from and output to the automobile.
Letfs ?rst look at the ABS. The purpose of an ABS is to temporarily release the brake on
a wheel when it rotates too slowly?when a wheel stops turning, the car starts skidding and
becomes hard to control. It sits between the hydraulic pump, which provides power to the
brakes, and the brakes themselves as seen in the following diagram. This hookup allows the
ABS system to modulate the brakes in order to keep the wheels from locking. The ABS system
uses sensors on each wheel to measure the speed of the wheel. The wheel speeds are used
by the ABS system to determine how to vary the hydraulic ?uid pressure to prevent the wheels
from skidding.
Sensor
Sensor Sensor
Sensor
Hydraulic
pump
Brake Brake
Brake Brake ABS
The ASC T systemfs job is to control the engine power and the brake to improve the
carfs stability during maneuvers. The ASC T controls four different systems: throttle, ignition
timing, differential brake, and (on automatic transmission cars) gear shifting. The ASC T
can be turned off by the driver, which can be important when operating with tire snow chains.
The ABS and ASC T must clearly communicate because the ASC T interacts with the
brake system. Since the ABS was introduced several years earlier than the ASC T, it was
important to be able to interface ASC T to the existing ABSmodule, as well as to other existing
electronic modules. The engine and control management units include the electronically con-
trolled throttle, digital engine management, and electronic transmission control. The ASC T
control unit has two microprocessors on two printed circuit boards, one of which concentrates
on logic-relevant components and the other on performance-speci?c components.
1.1.2 Characteristics of Embedded Computing Applications
important in both general-purpose computing and embedded computing, but
embedded applications must meet many other constraints as well.
On the one hand, embedded computing systems have to provide sophisticated
functionality:
¡ Complex algorithms: The operations performed by the microprocessor may
be very sophisticated. For example, the microprocessor that controls an
automobile engine must perform complicated ?ltering functions to opti-
mize the performance of the car while minimizing pollution and fuel
utilization.
¡ User interface: Microprocessors are frequently used to control complex user
interfaces that may include multiple menus and many options. The moving
maps in Global Positioning System (GPS) navigation are good examples of
sophisticated user interfaces.
To make things more dif?cult, embedded computing operations must often be
performed to meet deadlines:
¡ Real time: Many embedded computing systems have to performin real time?
if the data is not ready by a certain deadline, the system breaks. In some cases,
failure tomeet a deadline is unsafe and can even endanger lives. In other cases,
missing a deadline does not create safety problems but does create unhappy
customers?missed deadlines in printers, for example,can result in scrambled
pages.
¡ Multirate: Not only must operations be completed by deadlines, but many
embedded computing systems have several real-time activities going on at
the same time. They may simultaneously control some operations that run
at slow rates and others that run at high rates. Multimedia applications are
prime examples of multirate behavior. The audio and video portions of a
multimedia stream run at very different rates, but they must remain closely
synchronized. Failure to meet a deadline on either the audio or video portions
spoils the perception of the entire presentation.
Costs of various sorts are also very important:
¡ Manufacturing cost: The total cost of building the system is very important in
many cases. Manufacturing cost is determined by many factors, including the
type of microprocessor used, the amount of memory required, and the types
of I/O devices.
¡ Power and energy: Power consumption directly affects the cost of the
hardware, since a larger power supply may be necessary. Energy con-
sumption affects battery life, which is important in many applications,
as well as heat consumption, which can be important even in desktop
applications.
Embedded computing is in many ways much more demanding than the sort of
programs that you may have written for PCs or workstations. Functionality is
Finally, most embedded computing systems are designed by small teams on
tight deadlines. The use of small design teams for microprocessor-based systems
is a self-ful?lling prophecy?the fact that systems can be built with microproces-
sors by only a few people invariably encourages management to assume that all
microprocessor-based systems can be built by small teams.Tight deadlines are facts
of life in todayfs internationally competitive environment. However,building a prod-
uct using embedded software makes a lot of sense:Hardware and software can be
debugged somewhat independently and design revisions can be made much more
quickly.
1.1.3 Why Use Microprocessors?
There are many ways to design a digital system: custom logic, ?eld-programmable
gate arrays (FPGAs), and so on.Why use microprocessors?There are two answers:
¡ Microprocessors are a very ef?cient way to implement digital systems.
¡ Microprocessors make it easier to design families of products that can be built
to provide various feature sets at different price points and can be extended
to provide new features to keep up with rapidly changing markets.
The paradox of digital design is that using a predesigned instruction set processor
may in fact result in faster implementation of your application than designing your
own custom logic. It is tempting to think that the overhead of fetching, decoding,
and executing instructions is so high that it cannot be recouped.
But there are two factors that work together to make microprocessor-based
designs fast. First,microprocessors execute programs very ef?ciently. Modern RISC
processors can execute one instruction per clock cycle most of the time, and high-
performance processors can execute several instructions per cycle.While there is
overhead that must be paid for interpreting instructions, it can often be hidden by
clever utilization of parallelism within the CPU.
Second, microprocessor manufacturers spend a great deal of money to make
their CPUs run very fast. They hire large teams of designers to tweak every aspect
of the microprocessor to make it run at the highest possible speed. Few products
can justify the dozens or hundreds of computer architects and VLSI designers cus-
tomarily employed in the design of a singlemicroprocessor;chips designed by small
design teams are less likely to be as highly optimized for speed (or power) as are
microprocessors.They also utilize the latest manufacturing technology. Just the use
of the latest generation of VLSI fabrication technology, rather than one-generation-
old technology, can make a huge difference in performance. Microprocessors gen-
erally dominate new fabrication lines because they can be manufactured in large
volume and are guaranteed to command high prices. Customers who wish to fab-
ricate their own logic must often wait to make use of VLSI technology from the
latest generation of microprocessors. Thus, even if logic you design avoids all the
overhead of executing instructions, the fact that it is built from slower circuits often
means that its performance advantage is small and perhaps nonexistent.
It is also surprising but true that microprocessors are very ef?cient utilizers
of logic. The generality of a microprocessor and the need for a separate memory
may suggest that microprocessor-based designs are inherently much larger than
custom logic designs. However, in many cases the microprocessor is smaller when
size is measured in units of logic gates. When special-purpose logic is designed
for a particular function, it cannot be used for other functions. A microprocessor,
on the other hand, can be used for many different algorithms simply by changing
the program it executes. Since so many modern systems make use of complex
algorithms and user interfaces, we would generally have to design many different
customlogic blocks to implement all the required functionality.Many of those blocks
will often sit idle?for example,the processing logicmay sit idlewhen user interface
functions are performed. Implementing several functions on a single processor often
makes much better use of the available hardware budget.
Given the small or nonexistent gains that can be had by avoiding the use ofmicro-
processors, the fact that microprocessors provide substantial advantages makes
them the best choice in a wide variety of systems. The programmability of micro-
processors can be a substantial bene?t during the design process. It allows program
design to be separated (at least to some extent) from design of the hardware on
which programs will be run.While one team is designing the board that contains
themicroprocessor, I/O devices,memory,and so on,others can be writing programs
at the same time. Equally important,programmability makes it easier to design fam-
ilies of products. In many cases,high-end products can be created simply by adding
code without changing the hardware. This practice substantially reduces manufac-
turing costs. Evenwhen hardwaremust be redesigned for next-generation products,
it may be possible to reuse software, reducing development time and cost.
Why not use PCs for all embedded computing? Put another way, how many
different hardware platforms do we need for embedded computing systems? PCs
arewidely used and provide a very ?exible programming environment. Components
of PCs are, in fact, used in many embedded computing systems. But several factors
keep us from using the stock PC as the universal embedded computing platform.
First, real-time performance requirements often drive us to different architec-
tures.As we will see later in the book, real-time performance is often best achieved
by multiprocessors.
Second, low power and low cost also drive us away from PC architectures and
toward multiprocessors. Personal computers are designed to satisfy a broad mix
of computing requirements and to be very ?exible. Those features increase the
complexity and price of the components.They also cause the processor and other
components to use more energy to perform a given function. Custom embedded
systems that are designed for an application,such as a cell phone,burn several orders
of magnitude less power than do PCs with equivalent computational performance,
and they are considerably less expensive as well.
The cell phone may, in fact, be the next computing platform. Since over one
billion cell phones are sold each year, a great deal of effort is put into designing
them. Cell phones operate on batteries, so they must be very power ef?cient.They
must also perform huge amounts of computation in real time. Not only are cell
phones taking over some PC-oriented tasks, such as e-mail andWeb browsing, but
the components of the cell phone can also be used to build non-cell-phone systems
that are very energy ef?cient for certain classes of applications.
1.1.4 The Physics of Software
Computing is a physical act.Although PCs have trained us to think about computers
as purveyors of abstract information, those computers in fact do their work by
moving electrons and doing work. This is the fundamental reason why programs
take time to ?nish,why they consume energy, etc.
A prime subject of this book is what we might think of as the physics of
software. Software performance and energy consumption are very important prop-
ertieswhenwe are connecting our embedded computers to the realworld.We need
to understand the sources of performance and power consumption if we are to be
able to design programs that meet our applicationfs goals. Luckily,we donft have to
optimize our programs by pushing around electrons. In many cases,we can make
very high-level decisions about the structure of our programs to greatly improve
their real-time performance and power consumption.As much as possible,we want
to make computing abstractions work for us as we work on the physics of our
software systems.
1.1.5 Challenges in Embedded Computing System Design
External constraints are one important source of dif?culty in embedded system
design. Letfs consider some important problems that must be taken into account in
embedded system design.
How much hardware do we need?
We have a great deal of control over the amount of computing power we apply
to our problem. We cannot only select the type of microprocessor used, but also
select the amount ofmemory,the peripheral devices,andmore. Sincewe oftenmust
meet both performance deadlines andmanufacturing cost constraints, the choice of
hardware is important?too little hardware and the systemfails tomeet its deadlines,
too much hardware and it becomes too expensive.
How do we meet deadlines?
The brute force way of meeting a deadline is to speed up the hardware so that
the program runs faster. Of course, that makes the system more expensive. It is also
entirely possible that increasing the CPU clock ratemay notmake enough difference
to execution time,since the programfs speedmay be limited by thememory system.
How do we minimize power consumption?
In battery-powered applications,power consumption is extremely important. Even
in nonbattery applications, excessive power consumption can increase heat dis-
sipation. One way to make a digital system consume less power is to make it
run more slowly, but naively slowing down the system can obviously lead to
missed deadlines. Careful design is required to slow down the noncritical parts
of the machine for power consumption while still meeting necessary performance
goals.
How do we design for upgradability?
The hardware platform may be used over several product generations,or for several
different versions of a product in the same generation, with few or no changes.
However, we want to be able to add features by changing software. How can we
design a machine that will provide the required performance for software that we
havenft yet written?
Does it really work?
Reliability is always important when selling products?customers rightly expect
that products they buy will work. Reliability is especially important in some appli-
cations, such as safety-critical systems. If we wait until we have a running system
and try to eliminate the bugs,we will be too late?we wonft ?nd enough bugs, it
will be too expensive to ?x them, and it will take too long as well. Another set of
challenges comes from the characteristics of the components and systems them-
selves. If workstation programming is like assembling a machine on a bench, then
embedded system design is often more like working on a car?cramped, delicate,
and dif?cult. Letfs consider someways inwhich the nature of embedded computing
machines makes their design more dif?cult.
¡ Complex testing: Exercising an embedded system is generally more dif?cult
than typing in some data. We may have to run a real machine in order to
generate the proper data.The timing of data is often important,meaning that
we cannot separate the testing of an embedded computer from the machine
in which it is embedded.
¡ Limited observability and controllability: Embedded computing systems
usually do not comewith keyboards and screens.Thismakes itmore dif?cult to
see what is going on and to affect the systemfs operation.We may be forced to
watch the values of electrical signals on the microprocessor bus, for example,
to know what is going on inside the system. Moreover, in real-time applica-
tions we may not be able to easily stop the system to see what is going on
inside.
¡ Restricted development environments: The development environments for
embedded systems (the tools used to develop software and hardware) are
often much more limited than those available for PCs and workstations.We
generally compile code on one type of machine, such as a PC, and download
it onto the embedded system.To debug the code,we must usually rely on pro-
grams that run on the PC or workstation and then look inside the embedded
system.
1.1.6 Performance in Embedded Computing
When we talk about performance when writing programs for our PC, what do
we really mean? Most programmers have a fairly vague notion of performance?
they want their program to run gfast enoughh and they may be worried about
the asympototic complexity of their program. Most general-purpose programmers
use no tools that are designed to help them improve the performance of their
programs.
Embedded system designers, in contrast, have a very clear performance goal in
mind?their programmustmeet its deadline.At the heart of embedded computing
is real-time computing,which is the science and art of programming to deadlines.
The program receives its input data; the deadline is the time at which a computation
must be ?nished. If the program does not produce the required output by the
deadline, then the program does not work, even if the output that it eventually
produces is functionally correct.
This notion of deadline-driven programming is at once simple and demanding.
It is not easy to determine whether a large, complex program running on a sophis-
ticated microprocessor will meet its deadline.We need tools to help us analyze the
real-time performance of embedded systems;we also need to adopt programming
disciplines and styles that make it possible to analyze these programs.
In order to understand the real-time behavior of an embedded computing system,
we have to analyze the system at several different levels of abstraction.As we move
through this book,we will work our way up from the lowest layers that describe
components of the systemup through the highest layers that describe the complete
system.Those layers include:
¡ CPU: The CPU clearly in?uences the behavior of the program, particularly
when the CPU is a pipelined processor with a cache.
¡ Platform: The platform includes the bus and I/O devices. The platform com-
ponents that surround the CPU are responsible for feeding the CPU and can
dramatically affect its performance.
¡ Program: Programs are very large and the CPU sees only a small window of
the program at a time.We must consider the structure of the entire program
to determine its overall behavior.
¡ Task: We generally run several programs simultaneously on a CPU, creating a
multitasking system. The tasks interact with each other in ways that have
profound implications for performance.
¡ Multiprocessor: Many embedded systems have more than one processor?
they may include multiple programmable CPUs as well as accelerators. Once
again, the interaction between these processors adds yet more complexity to
the analysis of overall system performance.
Bạn đang đọc truyện trên: AzTruyen.Top