Upload
phamphuc
View
245
Download
2
Embed Size (px)
Citation preview
Computer Organization
Embedded Systems
Wednesday 25 November 15
Computer Organization 2
Summary
• Previous Class – Analog-Digital Interface
• Today: – Embedded Systems
• Characteristics • Architectures • Complete Systems
Computer Organization 3
Embedded Systems
• What is an embedded system? – Not always easy to define:
• “Any sort of device which includes a programmable computer but itself is not intended to be a general-purpose computer”
• “An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system.”
• “A specialized computer system that is part of a larger system or machine”
• “An embedded system is a computer that has been built to solve only a few very specific problems and is not easily changed”
• “An embedded system is some combination of computer hardware and software, either fixed in capability or programmable”
• “An embedded system contains a computer as part of a larger system and does not exist primarily to provide standard computing services to a user”
– Keywords: variety, combination, any sort, dedicated, …
Computer Organization 4
Embedded Systems
• Growing Market – Smart homes – Internet of Things (IoT) – Vehicle networks – Wearables – Healthcare – Security
• Main goals – Reliable – Energy efficient
• Low energy, or energy harvesting – Cheap – Customizable and adaptable
• adapt to the user’s specific needs and evolve with the market
Computer Organization 5
Application Examples • Personal appliances
– Cellular phones – Watches – Smart watches – Calculators
• Computer components – Mouse – Keyboards – Routers – Battery charger – 3D Printers
• Home appliances – Alarms – Thermostats – Air conditioners – Remote controllers – Most domestic machines
Computer Organization 6
Application Examples
• Car industry – On-board computer – Controllers of traction,
injection, transmission, break (ABS), etc
– Air bag – Air conditioning – Instrumentation
• Entertainment – Video games – Consoles – Toys
• Industrial applications – Industrial robots
(manipulators) – Belt conveyor systems – Lifts – Automatic control – Instrumentation
Computer Organization 7
Automotive Embedded Systems • Today’s high-end automobile have more than 100
microprocessors: – 4-bit microcontroller checks seat belt – microcontrollers run dashboard devices – 16/32-bit microprocessor controls engine
• Customer’s requirements – Reduced cost – Increased functionality – Improved performance – Increased overall dependability
Computer Organization 8
An Engineering View
Computer Organization 9
Real Time Systems
• Real time systems have to guarantee that they will respond to an external event within a specified amount of time. – Do not have to be fast, but have to be reliably on time.
• System design: – Interrupt handling has to be specially careful. – Since task scheduling and interrupt handling is
performed by the operating system, real time must be supported by the OS (RTOS).
• Soft real time is usually available (linux, windows), but not hard real time...
Computer Organization 10
Real Time Systems
• Real time systems are classified as: – soft real time
• provide a statistical time guarantee. Missing an event is not catastrophic.
– e.g. TV screen. If a glitch is visible it is not catastrophic.
– hard real time • Time guarantee is absolute. Missing a timing deadline will lead to
catastrophic results. – e.g. Brake sytem of a car. If an event is delayed it may be catastrophic.
– Soft and hard real time? • soft real time systems are optimized for the average case
– More relaxed designed, cheaper, and easier to design • hard real time systems must guarantee worst case situations,
always. – Strict design, strict time
Computer Organization 11
Power and Energy
• Power and Energy – Energy provides the ability to work – Power is the amount of energy over an amount of
time • Watts = Joules / second
• Battery provides finite amount of energy – and power (i.e. depend on the maximum current
that it can output) • In mobile systems we mainly care about energy
– Budget energy to prolong battery life
Computer Organization 12
Power and Energy Reduction • Main power drain sources
– Computation – Wireless transmission – Sensors and actuators – Memory
• How to reduce power consumption – Circuit level
• Computational architecture, frequency and voltage reduction, turn off circuits, asynchronous circuits, different technologies, …
– Usually out of our control
– System level • Code, compiler, and OS energy awareness
– Scheduling, optimize memory access, reduce pipeline stalls, context switching, turning off when idle…
Computer Organization 13
Watchdog Timer • Watchdog timer
– Hardware timing device that triggers interruption • for system reset, alarm management, or similar operation
– after a predefined amount of time
– Can be a stand-alone hardware component or built into the processor itself.
– Allows for the systems to be put to sleep until next time event • embedded system software are many times in the form of endless
loops.
for(;;) { function(); sleep();}
Computer Organization 14
Interface with the User • Keyboard
– Embedded system composed by a built-in microcontroller to read the pressed keys; Communicates with the PC using USB.
• The whole keyboard is read by repetitively testing all lines, with a “fast” frequency (e.g.: 50Hz).
• Mouse – The light emitted by a LED/laser is reflected
on the table surface and acquired by a small camera
• The small (simple) camera acquires about 1500 images per second
– The controller circuit detects the pattern differences and determines the movement direction
Computer Organization 15
Touch-Screen Displays
• Most common technologies: – Resistive;
• Cheaper • Very resistant and durable • Very good resolution; • Not affected by cloths, such as gloves
– Capacitive; • Little visibility loss; • Not affected by dirt, fat or humidity.
Computer Organization 16
Microprocessor Varieties • Processing unit particularly suited to the control of
simple procedures or devices in embedded systems
• Processor families: – General Purpose Processors (GPP)
• transfer and data manipulation operations (MOVs); conditional execution operations (IF ... ELSE ...)
– Digital Signal Processors (DSP) • microprocessor optimized for digital signal processing
– Mathematical computation (mainly, multiplications)
– Microcontrollers • includes on-board memory and I/O devices (peripherals) to
interface with the outside world – Common applications: control, actuators, instrumentation, etc
Computer Organization 17
GPPs versus Microcontrollers • General Purpose Processors (GPPs)
– CPU, Memory and IO integrated on a set of chips, on a board or several boards
• Microcontrollers – CPU, Memory, IO and peripherals integrated in a single
chip
Computer Organization 18
GPPs versus Microcontrollers • General Purpose Processors (GPPs):
– High performance CPU, in an independent chip – Absence of any RAM, ROM and IO modules in the CPU chip
• The used memory space should be defined and adjusted according to each particular application
– Peripherals (timer, serial port, etc.) are external to the CPU chip
• Expansible, versatile and general purpose
Computer Organization 19
GPPs versus Microcontrollers • Microcontrollers:
– CPU with few resources (e.g.: 8-bits) – RAM, ROM and IO integrated within the CPU chip
• The available memory space is fixed
– Peripherals integrated within the CPU chip.
• Suitable for low-cost and constrained (power, HW, etc.) applications
Computer Organization 20
Microcontroller’s CPU and Peripherals
• Simple CPU, implemented with: – Single-cycle state machine – Control unit with a state machine – Micro-programmed control unit – Very simple pipeline
• On-chip peripherals: – I/O ports – RAM and ROM memories – Timer – Interrupt controller – USART – Parallel port; etc.
Computer Organization 21
Microcontrollers Families
• Most manufacturers offer a wide set of devices, with different performance levels
• Processing power: 4-bits, 8-bits, 16-bits, 32-bits – 8-bits microcontrollers are the most widely adopted
and used by the majority of the applications – 32-bits and 64-bits are only requested by very
specialized and reduced markets, with very specific requisites:
• Communications • Signal processing • Video processing • etc.
Computer Organization 22
Microcontrollers Families • Atmel
– AVR • ARM • Intel
– 8-bit • 8XC42 • MCS48 • MCS51 • 8xC251
– 16-bit • MCS96 • MXS296
• Microchip – 12-bit instruction PIC
• PIC12F508 – 14-bit instruction PIC
• PIC16F84 – 16-bit instruction PIC
• National Semiconductor – COP8
• NEC • Motorola
– 8-bit • 68HC05 • 68HC08 • 68HC11
– 16-bit • 68HC12 • 68HC16
– 32-bit • 683xx
• SGS/Thomson – ST62
• Texas Instruments – TMS370 – MSP430
• Zilog – Z8 – Z86E02
Computer Organization 23
Microcontrollers Market • Market:
– 8 and 16-bit microcontrollers satisfy more than 75% of the market needs!
• Dominant microcontrollers: – Microchip 16Fxx – Intel 8051 and derivatives – Motorola MC68HC05
Computer Organization 24
Microcontroller Packaging and Appearance
• From left to right: PIC 12F508, PIC 16F84A, PIC 16C72, Motorola 68HC05B16, PIC 16F877, Motorola 68000
Computer Organization 25
Example: Microchip Microcontrollers PIC Family
• Large microcontrollers (PIC) family – Advanced communication peripherals and protocols – Wide processing capacity offer
• 8, 16 or 32 bits
– Several (memory) addressing spaces available:
• RAM • ROM • EEPROM • Flash
Computer Organization 26
Example: Microchip Microcontrollers PIC Family
Vast set of peripherals and protocols: • Communication peripherals and protocols:
– RS232/RS485 – SPI – I2C – CAN – USB – TCP/IP – Ethernet
• Control and timer peripherals: – Acquisition and comparison – Pulse Width Modulation (PWM) – Counters and timers – Watchdogs
• Visual peripherals: – LED drivers – LCD drivers
• Analog peripherals: – A/D converters up to 12-
bits – D/A converters – Comparators and signal
amplifiers – Voltage detectors – Temperature sensors – Oscillators – Voltage references – Voltage regulators
Computer Organization 27
Example: Microchip Microcontrollers PIC Family
Computer Organization 28
Single Board Computers • F77B MINI2440 + 7 '‘
– 150€ (2015) – ARM9
• 400 MHz Samsung – S3C2440A ARM920T
– RAM • 64 MB sdram • 32 bits Bus
– Flash • 64 MB - 1 GB
– I/O: • Ethernet • 7” touch screen • SD-Card slot • 3,5 mm Stereo Jack • USB
– OS support • Windows CE 5 e 6 • Linux 2,6 • Android
• Many others: – raspberry pi, Intel NUC, …
Computer Organization 29
Smart-Cards • Appeared in the beginning of the 1970’s, but...
– Only by the beginning of the 1980’s were the supporting technologies developed
• Two types of cards: – Memory card (without CPU) – Card with microprocessor
Chip Plastic card
Computer Organization 30
Smart-Cards
• Applications – Information technology
• Secure access and user authentication • Storage of digital certificates and passwords • Encryption of critical data
– Cellular phones (GSM) • Subscriber authentication • Data storage
– e-Commerce • e-Banking and e-Payments • Identification and access control (tickets) • Parking • Phone credit (decrement of a credit counter)
Computer Organization 31
Smart-Cards
• Smart-Cards with microprocessor – Processor
• Usually, 16-bits @ 5-16 MHz • Cryptographic co-processors
– Memory • ROM (16 kBytes - 128 kBytes) for the operating system • EEPROM (4 kBytes - 64 kBytes) for persistent data • RAM (256 Bytes – 4k Bytes) for data • ROM size ≈ 4 × EEPROM size ≈ 16 × RAM size
– File system supported on the installed memory – Small silicon area (5mm2), due to space and energy
restrictions
Computer Organization 32
Smart-Cards • Communication
– Contact-based – Contact-less (transmission with an antenna)
• Serial protocol, 9600 bps
• Power-supply – With battery – Without battery
• the CPU is powered with an inductive circuit
Computer Organization 33
Smart-Cards: Infineon SLE66
Computer Organization 34
Conclusion • Microprocessors come in many varieties
– GPP – DSP – Microcontrollers – Smartcards
• A significant share of the market is targeted to embedded systems: – I/O – Small – Cheap – Application oriented – Energy restricted
Computer Organization 35
Next Class
• Multiprocessors – Programming overheads – Shared-Memory Multiprocessor
• UMA vs NUMA
– Memory coherence
Computer Organization
Embedded Systems
Wednesday 25 November 15
Computer Organization 37
Interface with the user
• LCD Display • Touch-Screen Displays
Computer Organization 38
GPPs versus Microcontrollers • Adopted architectures:
– Von Neumann architecture: • Single memory shared by program and data • The processor is interconnected by a data and an address bus
– Harvard architecture: • Separated memories for program and data • Independent data and address buses for each memory device
Computer Organization 39
Smart-Cards: Dallas’ iButton
• Applications: – Access control; – Each unit has an unique address;
• Interface: – Only two wires:
• Power + Data • Ground
– Serial communication: • 16kbps to 142kbps
• Available models: – Address-only (ID only); – Memory-only; – Real-time clock; – Authentication/encryption key; – Sensor (thermometer, hydrometer); – Data-logger.
Computer Organization 40
Computer Organization 41
Example: Intel MCS-51 Microcontrollers Family • 8-bits microcontroller • Introduced in the market by Intel (8051) by the end of the 1970’s • One of the most popular microcontrollers (about 40% of the market) • Today, it is produced by several manufacturers in different formats:
– Intel • 8751 microcontroller UV-EPROM
– Philips • 8051 AD, DA, extended I/O, and flash
– Atmel • AT89C51, Flash (erase before write)
– Dallas Semiconductor • DS5000 NV-RAM, RTC
Computer Organization 42
Example: Intel MCS-51 Microcontrollers Family
• Intel MCS-51 Family: – CPU, RAM, ROM, I/O, interrupt logic, timer, etc. in a single
chip – 8-bits data bus – 16-bits address bus
• can access 216 = 64 kB memory positions (RAM and ROM) – On-chip RAM: 128 bytes (“Data Memory”) – On-chip ROM: 4 kB (“Program Memory”) – 4-bytes bi-directional IO port – UART (serial port) – 2 × 16-bit counters/timers – Interrupt controller (2 priority levels) – Low-power mode
Computer Organization 43
Example: Intel MCS-51 Microcontrollers Family
Architecture:
Computer Organization 44
Example: Intel MCS-51 Microcontrollers Family
• Internal peripherals: – Parallel IO ports – Clock generator – Serial port – Timers – Interrupt controller
Computer Organization 45
• Parallel IO ports: – Each port can be configured either for input or output – The direction is defined by special registers
• Serial port: – Data is sent/received serially – The transmission rate (BAUD rate) and the transmission
mode are configured with specific registers (SFR)
Example: Intel MCS-51 Microcontrollers Family
Computer Organization 46
Example: Intel MCS-51 Microcontrollers Family
• 2 × internal timer: – Each timer increments the counter at each clock cycle – The count limit is configured using specific timer
registers (TH0, TL0, TH1, TL1) – The current count value can be read in registers TH0,
TL0, TH1, TL1 – At the end of the count:
• An interruption is generated • Dedicated bits at SFR register are activated
Computer Organization 47
Example: Intel MCS-51 Microcontrollers Family • Interrupt controller
– 5 types of interruption: • Timer 1 Overflow • Timer 2 Overflow • External interruption 1 • External interruption 2 • Serial port event (buffer full, buffer empty, etc.)
– Interruptions are activated/inhibited using the SFR register.
Computer Organization 48
Example: Microchip Microcontrollers PIC Family PIC Family Stack Size Instruction
Word Size No of
Instructions Interrupt Vectors
12CX/12FX 2 12- or 14-bit 33 None 16C5X/16F5X 2 12-bit 33 None
16CX/16FX 8 14-bit 35 1 17CX 16 16-bit 58 4
18CX/18FX 32 16-bit 75 2
Computer Organization 49
Example: TMS32010
Computer Organization 50
Example: Philips TriMedia-Processor
Computer Organization 51
Example: SH-MobileG1 chip System on a Chip (SoC)
Computer Organization 52
Smart-Cards
• Dedicated commands to support secure / cryptography protocols – Access control
• Examples: check key(), change key() – Authentication
• Examples: authenticate() – Encryption
• Examples: start encryption(), stop encryption() – Atomic operations
• Examples: exchange(), increment(), decrement()