Monday, January 30, 2012

Embedded Systems


If we look around, we will find ourselves to be surrounded by computing systems. Every year millions of computing systems are built destined for desktop computersEmbedded Systems (Personal Computers, workstations, mainframes and servers) but surprisingly, billions of computing systems are built every year embedded within larger electronic devices and still goes unnoticed. Any device running on electric power either already has computing system or will soon have computing system embedded in it. 
Today, embedded systems are found in cell phones, digital cameras, camcorders, portable video games, calculators, and personal digital assistants, microwave ovens, answering machines, home security systems, washing machines, lighting systems, fax machines, copiers, printers, and scanners, cash registers, alarm systems, automated teller machines, transmission control, cruise control, fuel injection, anti-lock brakes, active suspension and many other devices/ gadgets.



DEFINITION
A precise definition of embedded systems is not easy. Simply stated, all computing systems other than general purpose computer (with monitor, keyboard, etc.) are embedded systems.
System is a way of working, organizing or performing one or many tasks according to a fixed set of rules, program or plan. In other words, an arrangement in which all units assemble and work together according to a program or plan. An embedded system is a system that has software embedded into hardware, which makes a system dedicated for an application (s) or specific part of an application or product or part of a larger system. It processes a fixed set of pre-programmed instructions to control electromechanical equipment which may be part of an even larger system (not a computer with keyboard, display, etc).
A general-purpose definition of embedded systems is that they are devices used to control, monitor or assist the operation of equipment, machinery or plant. “Embedded” reflects the fact that they are an integral part of the system. In many cases, their “embeddedness” may be such that their presence is far from obvious to the casual observer. Block diagram of a typical embedded system is shown in fig.
Embedded System Architecture
An embedded system is an engineering artefact involving computation that is subject to physical constraints (reaction constraints and execution constraints) arising through interactions of computational processes with the physical world. Reaction constraints  originate from the behavioural requirements & specify deadlines, throughput, and jitter whereas execution constraints originate from the implementation requirements & put bounds on available processor speeds, power, memory and hardware failure rates. The key to embedded systems design is to obtain desired functionality under both kinds of constraints.

CHARACTERISTICS  
a)    Embedded systems are application specific & single functioned; application is known apriori, the programs are executed repeatedly.
b)    Efficiency is of paramount importance for embedded systems. They are optimized for energy, code size, execution time, weight & dimensions, and cost.
c)    Embedded systems are typically designed to meet real time constraints; a real time system reacts to stimuli from the controlled object/ operator within the time interval dictated by the environment. For real time systems, right answers arriving too late (or even too early) are wrong.
d)   Embedded systems often interact (sense, manipulate & communicate) with external world through sensors and actuators and hence are typically reactive systems; a reactive system is in continual interaction with the environment and executes at a pace determined by that environment.
e)    They generally have minimal or no user interface.

DESIGN METRICS FOR EMBEDDED SYSTEMS  
In addition to meeting the desired functionality of an embedded system, embedded system designer must optimize on the following design metrics
·         Non Recurring Engineering (NRE) Cost: Money invested in R&D and developing first, functional and tested prototype.
·         Unit Cost: Cost of producing one unit
·         Electrical Power
·         Performance - System Throughput, Computational Power, response time
·         Functional Correctness
·         Dependability; Fault Tolerance, Reliability, Maintainability, Availability
·          Physical Size and Weight
·         Time to prototype
·         Time to market
·         Safety: It should not cause harm to others.
·         Maintenance, Ease of Use
These metrics compete amongst themselves; increasing one may affect others. Hence optimisation of these metrics is a challenge for an embedded system designer. 

ELEMENTS OF EMBEDDED SYSTEMS
.      Hardware  
Core element of an embedded system is the processor or a computational unit. Processors can act as brain of the system. They can be programmed to do perform a task. This can be designed using variety of options. 
·         General Purpose Microprocessors
General purpose microprocessors are single chip semi conductor device which is a computer on chip, but not a complete computer. Its CPU contains an Arithmetic & Logic Unit(ALU), a Program Counter(PC), a Stack Pointer(SP), registers, a clock and interrupts circuit on a single chip. To make complete micro computer, one must add memory usually ROM and RAM, memory decoder, an oscillator, a number of serial and parallel ports
Elements of Embedded Systems
A general-purpose processor is designed to cater for large amount of applications and hence is produced in bulk. Using it in an embedded system offers various benefits. Design time is low as only software is to be developed, no digital design is involved. Typical characteristics of a general purpose processors are relatively high cost, high speeds, higher Power consumption,  large architecture, large memory size, onboard flash and cache, an external bus interface for greater memory usage.
Examples: Motorola’s 680x0, Intel‘s x86 
·         Microcontrollers/ Embedded Processors
microcontroller is a functional computer system-on-a-chip. It contains an integrated processor, memory (a small amount of RAM, program memory, or both), several peripheral devices, such as timers, analog to digital converters, and serial communication devices all on one chip resulting in compact and low-power implementations.It is not expandable as it has no external bus interface. Examples are PIC’s DSPIC33 / PIC24, Motorola’s 6811, Intel’s 8051
Typical characteristics of a microcontroller are: Low cost, Low speed, Low Power, small architecture, Small memory size, Onboard Flash, Limited I/O.
Elements of Embedded System
Microcontrollers provide pin access which allows programs to easily monitor sensors, set actuators, and transfer data with other devices. Providing specialized instructions improves performance for embedded systems applications; thus, microcontrollers can be considered ASIPs to some degree.
Special microcontrollers are often called embedded processors. The difference between a microcontroller and an embedded processor is not clear, but processors with large architectures with fast processing, fast context-switching & atomic ALU operations are marketed by many vendors as embedded processors. Examples of embedded processors are ARM 7, INTEL i960, AMD 29050
·          ASIP/DSPs
An application-specific instruction-set processor (or ASIP) is designed for a specific class of applications with common characteristics, such as digital-signal processing, telecommunications, embedded control, etc. Using an ASIP in an embedded system can provide the benefit of flexibility while still achieving good performance, power and size. However, such processors can require large Non-Recurring Engineeing(NRE) cost (to build the processor, compiler if they don’t exist). Digital-Signal Processors (DSPs) are a common class of ASIP. DSP is a single chip  VLSI unit; a processor designed especially to support high-performance, repetitive, numerically intensive tasks, including operations like multiply and add or shift and add.
Typical features of DSP processors are
1.      Harvard Architecture
2.      MAC Unit to support Multiply-ACcumulate operations in a single cycle.
3.      Ability to complete several accesses to memory in a single instruction cycle.
4.      One or more dedicated address generation units to speed up arithmetic processing.
Examples of a DSP are: TMS320Cxx, SHARC, and Motorola 5600xx.
·         ASICs
ICs are basically “chips”, i.e., Silicon Wafers with transistors, resistors, capacitors fabricated to act as Microprocessors, Amplifier, Memory, etc. ASICs (Application Specific Integrated Circuits) are designed for a special application. Digital to Audio Converter, DSSS receiver, Mpeg2 Decoder are examples of ASICs.

ASICs offer very high performance, but NRE cost is very high. With ASICs, timing closure is an issue especially with Deep-submicron geometries. Re-configurability is highly limited.

·         FPGA/CPLDs
Field Programmable Gate Array(FPGA) is a fully programmable alternative to a customized chip. They are also called Reconfigurable Processing Unit.
It is a two dimensional array of logic blocks and flip flops with a means for user to configure interconnection between logic blocks &     function of each block. FPGA technology allows you to embed a processor, ROM, RAM, DSP, and any other block onto a single chip. This is replacing a lot of Application Specific Integrated Circuit chips. FPGA offers performance advantage of parallel hardware with the flexibility of the software. This has major advantages in terms of cost, reliability, reusability of intellectual property, and time to market.
      Based on Interconnections between cells, they are of two types of FPGAs
¨      Reprogrammable (SRAM-based)- Xilinx, LatticeXP2, Altera, Atmel
¨      One time programmable – Actel, Quicklogic
Complex Programmable Logic Devices(CPLD) are slightly different from FPGAs; difference mainly lies in the architecture. A CPLD consists of one or more programmable sum-of-products logic arrays feeding a relatively small number of clocked registers. As a result, they are less flexible and hence offers the advantage of more predictable timing delays and a higher logic-to-interconnect ratio. On the other hand, the FPGA architectures are dominated by interconnect. This makes them far more flexible but also far more complex to design for. Also, FPGAs are usually much larger in terms of resources than CPLDs. Another common distinction is that CPLDs contain embedded flash to store their configuration while FPGAs usually, but not always, require an external flash.
·         Reconfigurable SoCs
Technological evolution, particularly shrinking silicon fabrication geometries, is enabling the integration of complex platforms in a single System-on-Chip (SoC). In addition to speci?c hardware subsystems, a modern SoC also can include one or several CPU subsystems to execute software and sophisticated interconnects. Multimedia platforms such as Nomadik and Nexperia are examples of multiprocessor SoCs that use digital signal processors, microcontrollers, and other kinds of programmable processors. Atmel’s FPSLIC (AVR+FPGA), TI’s OMAP (ARM Cortex + Custom GPU+TI DSP) are other examples.

2.      Software
If hardware forms the body of the embedded systems, software is a soul of embedded systems. The software lends the functionality to an embedded system.
Variety of languages has emerged as the tasks to be performed by embedded systems are of quite diverse nature. One language may be good for control-dominated application but may not so good for signal processing applications.
a)      Hardware languages
Verilog and Very high speed integrated circuits Hardware Description Language (VHDL) are the most popular languages in this category. Both describe systems with structural hierarchy, model systems with discrete event semantics; allow concurrent processes to be described procedurally. Verilog is destined for simulating digital integrated circuits whereas VHDL is much larger and verbose and can handle wider class of modelling and simulation tasks.
b)     Software languages
Software languages use instructions to describe sequences to be executed. Software languages are of two types: Assembly and high level languages. An assembly language program contains instructions written in a symbolic form and is de?ned by opcodes, addressing modes, registers, and memories. High level languages include C, C++, RT-Java, ADA, etc. They use various constructs like functions, loops, arrays, variables, structures etc. and are written in easy to understand language. 
c)      Dataflow languages
Datafow languages describe systems of procedural processes that run concurrently and communicate through queues. A data flow model is composed of nodes, that transform data, and arcs, which represent the passing of data between those nodes. They are not convenient for general applications but very good for signal processing applications. Kahn process networks are one of the applications. LUSTRE is an example of synchronous dataflow language.
d)     Hybrid languages
This category of languages combines ideas from other languages.
Esterel (intended for control-dominated reactive systems) combines abstract hardware semantics (concurrency, and a synchronism of digital circuits) with different kinds of constructs of typical software language.
SDL is a graphical language developed for describing telecommunication protocols (uses finite state machines)
SystemC offers synchronous VHDL-like discrete event simulation models but allows for the introduction of asynchronous execution and interaction mechanisms from software (C++).
CoCentricTM System Studio combines Kahn-like data?ow with Esterel-like FSM semantics to simulate and synthesize data?ow applications that also require control.

3.      Interface to physical world
Embedded systems interface with the physical world through Sensors and Actuators. Sensors act as “senses” for an embedded system, whereas actuators act as “limbs”. Varieties of sensors working on variety of sensing principles are used in embedded systems. Light, temperature, acceleration, speed, mass, distance, etc. are common physical parameters which are sensed. Motors are one of the actuators used in many systems.
These transducers interface to the processor through variety of interfaces:
Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485 etc
Synchronous Serial Communication Interface: I2C, SPI
Universal Serial Bus (USB)
Networks: Ethernet, Controller Area Network(CAN), etc
Discrete IO: General Purpose Input/ Output (GPIO)
Analog to Digital/Digital to Analog Converter (ADC/DAC). 

RELEVANT IMPORTANT CONCEPTS
1.      Computer Architecture
Two common prevalent processor architectures are Neumann Vs Harvard. Von Neumann architectures have same program and data memory space; both shares address bus and data bus. Harvard architecture has different memory space for program and data. For each of them, separate data bus and address bus are provided.  
2.      Instruction Set Architecture(ISA)
ISA serves as an abstraction layer between the software and hardware. Reduced Instruction Set Computer (RISC) andComplex Instruction Set Computer (CISC) stand for twodifferent competing philosophies in designing modern computer architecture.
RISC has simple primitiveinstructions and addressing modes. The instructions are of uniform length, execute in one clock cycle & support pipelining. CISC chips have a large amount of variable length, different and complex instructions and take longer than a clock cycle to execute.
CISCchips are relatively slow per instruction compared to RISC chips, but usefewer instructions than RISC. Thus, RISC systems shorten execution time by reducing the clock cycles per instruction, whereas CISC shorten execution time by reducing MIPS R2000 is a typical product of pure RISC and Intel 80386 is a typical kind of pure CISC chip.
DESIGNING AN EMBEDDED SYSTEM
      An embedded system design involves number of stages which are listed below 
·         Requirement analysis
·         Defining the system specifications
o   Modeling the system to be designed- Experimenting with different algorithms and their preliminary evaluation. Factoring the task into smaller subtasks and modeling their interaction
o   HW-SW partitioning (Allocating the tasks into H/W, S/W) or Co-design (H/W and S/W design proceed in parallel with interactions and feedback between the two processes. Joint optimization optimize design metrics)
·         Selection of technology
·         Resource Analysis – Cost, Time & Manpower
·         Identification of components and development tools
·         Circuit design/ Schematic Capture, PCB layout design & fabrication
·         Firmware development –Debugging & testing
·         System Integration
·         Testing – functional, environmental
·         Certifications, if required.
·         Documentation
      There are different design cycles methodologies used for designing embedded systems.
·         Waterfall model

Waterfall is a development model in which development is seen flowing steadily through the phases of Requirement Analysis, Design, Implementation, Testing, Integration and Maintenance. It allows good progress tracking due to clear milestones but its inflexibility (to respond to changing requirements) is its demerit.

·         Top-down versus Bottom-up 
In Top-Down Model, the overall functionality of a system is considered initially, without going into finer aspects of the requirements. Further analyses will go deeper and deeper in greater details.
The Bottom-Up Model follows a reverse approach. First, it defines the individual parts of the system in great detail. The individual subsystems are then integrated to form larger systems, leading to whole system.
·         Spiral Model

Spiral model is the one commonly used in modern design practices. It uses both top-down and bottom-up approach. The objectives, alternatives and constraints are first defined. Then iterations are initiated to eliminate main risks. Finer details of each subsystem are then worked out.

·         GANTT Charts
 GANTT/PERT chart shows the relationships of various scheduled activities and helps to monitor the progress of the project.





0 comments:

Post a Comment