2. Embedded Systems
❖ Definition 1) Any device that includes a programmable computer but is not itself a
general-purpose computer.
or 2) Embedded systems are computing systems with tightly coupled hardware and
software integration, that are designed to perform a dedicated function.
❖ Take advantage of application characteristics to optimize the design:
• Does not need all the general-purpose elements.
Household
Appliances
Communication
Avionics
3. Example: Automotive Embedded Systems
• Modern embedded systems are often based on microcontrollers (i.e.
CPUs with integrated memory or peripheral interfaces)
• For example, today’s high-end automobile have > 80
microprocessors:
• 3-bit microcontroller checks seat belt;
• microcontrollers run dashboard devices;
• 16/32-bit microprocessor controls engine.
• Thousands lines of code
4. Embedded Systems
❖Characteristics of Embedded Systems:
•Real-time operation.
•Low manufacturing cost.
•Low power.
•Portable
• Designing hardware for embedded systems is challenging, because
the designers have to be, very careful, for a lot of reasons…
Embedded System Design
5. Embedded System Design
1. Required Hardware
–How many processors? How much memory?
• Let’s design an elevator control’ system.
• How much data would the system need to process in single cycles? The largest would be
the highest number of floors the elevator has to travel up. Assuming that the number is 50
(for a 50-storey building), we need to store all the numbers from 0 to 50 and the processor
should be able to process those numbers.
• In such cases, an 6-bit processor (one which can process 8 bits in one clock cycle) is more
than enough since it will be able to process any number between 0 and 127.
6. Embedded System Design
2. Power Consumption
Why is Power Consumption an Issue?
• Portable systems - battery life time!
• Systems with a very limited power budget: Mars
Pathfinder, autonomous vehicle and helicopter, ...
• Desktops and servers: high power consumption -
raises temperature
• One of the main difficulties with developing high
performance chips is heat extraction.
7. How do we minimize power?
• Sleep mode: A common practice to prevent the microcontroller from drawing
maximum power is to put it into deep sleep mode when it’s idle. In deep sleep
mode, microcontrollers often consume a tiny fraction of the maximum current,
often in nano-amps. interrupts can then be used to wake up the
microcontroller.
• Dynamic change of the processor frequency: low frequency could be used
during the idle periods and a high frequency during the intensive calculations
• Turn off unnecessary devices: Turn off wifi, Bluetooth, etc..
• Code optimization…
Embedded System Design
8. How to minimize power?: code optimization
Some tips:
• Reduce the usage of variables
• Use bit shift operation instead of
multiplication and division
• Switch instead of if-else
• Work with interrupt
• Use decrement loop…
9. Decrement loop
• A decremented loop will generate less
assembly code as compared to an
incremented loop.
• That is because in an increment loop, a
comparison instruction is needed to
compare the loop index with the
maximum value in every loop to check if
the loop index reaches the maximum
value. On the contrary in a decrement
loop, this comparison is not needed any
more because the decremented result of
the loop index will set the zero flag in
SREG if it reaches zero.
Embedded System Design: code optimization
10. • How do we reduce size/weight?
• Flexibility and Upgradeability
• Use Reduced Instruction Set Compute (RISC) Architecture instead of Complex
Instruction Set Computer (CISC).
• You’re not going to find a Core i7 in an embedded system!
Embedded System Design
11. RISC Architecture
• Small set of simple and general instructions, rather than a large set of
complex and specialized instructions
• Smartphones and tablet computers such as the iPad and Android devices
use of ARM architecture processors which is RISC-based systems.
• The CISC approach attempts to minimize the number of instructions per
program, sacrificing the number of cycles per instruction.
•. A CISC processor is easier to control and command because it carries
out some of the more complicated functions automatically but requires
more time
• An x86 (or x64) processor belongs CISC family. This type of processor has
a more complicated instruction. هذه
يةرمعما
مستخدمة
ي
ف
معالجات
انت
ل
CISC Architecture
12. CISC RISC
Many instructions More complex instruction than
RISC
Few instructions
Instructions have varying lengths Instructions have fixed lengths
Instructions execute in varying times Instructions execute in 1 bus cycles
Many instructions can access memory
Requires more memory access
Few instructions can access memory
• Load from memory to a register
• Store from register to memory
In one instruction, the processor can both
• read memory and
• write memory
No one instruction can both read and write
memory in the same instruction
Fewer and more specialized registers.
• some registers contain data,
• others contain addresses
Many identical general purpose registers
CISC vs RISC
14. Microcontrollers vs Microprocessors
• Microcontrollers have RAM, ROM, EEPROM embedded
in it while microprocessor has to use external circuits.
• Processing speed of microcontrollers is about 8 MHz to 50 MHz while the
speed of general microprocessors is above 1 GHz.
• Microprocessor is generally used for general purpose processing while
microcontroller is used for a specific purpose.
15. B.Random Access Memory (RAM): Also called Read/Write Memory,
requires external power to maintain memory content. The term random
access refers to the ability to access any memory cell directly. Types of
RAM that are of interest:
• Dynamic RAM (DRAM): DRAM is a RAM device that requires
periodic refreshing to retain its content.
• Static RAM (SRAM): SRAM is a RAM device that retains its content as long
as power is supplied by an external power source. SRAM does not
require periodic refreshing and it is faster than DRAM.
• Non-Volatile RAM (NVRAM): NVRAM is a special type of SRAM that
has backup battery power so it can retain its content after the main
system power is shut off.
Embedded System Memory: RAM
16. DRAM Memory Technology
• Dynamic random-access memory
• Capacitor charge state indicates stored value
• Whether the capacitor is charged or discharged indicates storage of 1 or 0
• 1 capacitor
• 1 access transistor
• Capacitor leaks
• Needs Recherche after each read (destructive read)
21
DRAM
17. Dynamic RAM
• DRAM stores the binary information in the form of electric charges on
capacitors.
• The capacitors are provided inside the chip by MOS transistors.
• The capacitors tends to discharge with time and must be periodically
recharged by refreshing the dynamic memory.
• DRAM offers reduced power consumption and larger storage capacity
in a single memory chip.
• High capacity, low cost, low speed, low power consumption.
18. SRAM Memory Technology
24
• Static random access memory
• Two cross coupled inverters store a single bit
• 6 Transistors in total
• 4 transistors for storage (each invertor has 2 transistor)
• 2 transistors for access
19. Static RAM
• SRAM consists essentially of internal latches that store the binary
information.
• The stored information remains valid as long as power is applied to
the unit.
• SRAM is easier to use and has shorter read and write cycles.
• Low capacity, high cost, high speed, high power consumption.
20. Hard Disk Drives (HDDs)
Read/Write Head
Side View
Platters
• HDD is an electromechanical data storage device that uses magnetic storage to store
and retrieve digital information using one or more rigid rapidly rotating disks (platters)
coated with magnetic material.
• Speed is dependent on rotation speed (5400, 7200…10000)
21. SSD vs HDD
Reliability on storage
retention
SSDs typically start to lose data after
about 5-10 years
If kept in a dry environment at low
temperature, HDDs can retain their data
for a very long period.
Power consumption
High performance flash-based SSDs.
No moving parts(eliminate
seek/rotational delay)
Consume more power due to motors
Durability Can tolerate shock Shock can damage the hard
Weight Light weight Heavier weight
Speed High (250-500MB) Low (75-140 MB)
22. Solid State Hard (SSD)
• Like a memory stick, the SSD stores information on microchips and
contains no moving parts.
• Most SSD manufacturers use non-volatile NAND flash memory in the
construction of their SSDs because of the lower cost compared with
DRAM and the ability to retain the data without a constant power
supply.
• Replace rotating magnetic media with non- volatile
memory (battery backed DRAM)
23. Types of Memories
Type Size Latency Cost/bit
Register < 1KB < 1ns $$$$
On-chip SRAM 8KB-6MB < 2ns $$$
Off-chip SRAM 1Mb – 16Mb < 10ns $$
DRAM 64MB – 1TB < 100ns $
Disk (SSD, HDD) 40GB – 1PB < 20ms < $1/GB
CAPACITY
SPEED
and
COST
24. Flash Memory
• Invented in 1984 by a Japanese engineer (Fujio Masuoka) at TOSHIBA
• Non-volatile memory technology
• Very fast eraser process similar to a camera flash
• Has limited number of write cycles (endurance)
34
25. Floating Gate MOSFET (FGMOS)
• The fundamental build block of flash memory is FGMOS
32. There are two types of flash memory: NOR Flash and NAND Flash
33. New technology for storing data
SLC: Single layer Cell
QLC: Quad layer Cell TLC: Triple layer Cell
34.
35. NAND vs NOR
• NOR for high reliability mobile phone and low capacity such as
medical devices and instruments
• NAND high memory not needing fast reading time such as camera
and flash memory
NAND Flash
Page addressable (e.g., 512 Bytes )
Slow random reads (~30us)
fast writes (~3.5ms to erase 120KB)
Higher density
Used for normal storage
NOR Flash
Reads at byte granularity
Fast random reads (~120ns)
slow writes (~520ms to erase 120KB)
Lesser density
Primarily used as code storage
36. Question
• Why NOR flash is an attractive technology for storing program’s
binary on an embedded platform? Focus on Read speed, and write
speed for reasoning.
47