Chapter 4 The Embedded Computing Platform 金仲達教授 清華大學資訊工程學系 (Slides are taken from the textbook slides)

Slides:



Advertisements
Similar presentations
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Bus-Based Computer Systems zBusses. zMemory devices. zI/O devices: yserial links ytimers.
Advertisements

Chapter 5 Internal Memory
Chapter 4: The Embedded Computing Platform
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
TM This document is strictly confidential and proprietary of SMIC. It must not be copied or used for any purpose other than for reference only, and SMIC.
CS-334: Computer Architecture
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
University College Cork IRELAND Hardware Concepts An understanding of computer hardware is a vital prerequisite for the study of operating systems.
ASPPRATECH.
Microcontroller based system design
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
CS-334: Computer Architecture
C.S. Choy95 COMPUTER ORGANIZATION Logic Design Skill to design digital components JAVA Language Skill to program a computer Computer Organization Skill.
MICROPROCESSOR INPUT/OUTPUT
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Top Level View of Computer Function and Interconnection.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
Chapter 5 Internal Memory. Semiconductor Memory Types.
Other Chapters From the text by Valvano: Introduction to Embedded Systems: Interfacing to the Freescale 9S12.
Memory and Storage Dr. Rebhi S. Baraka
© 2000 Morgan Kaufman Overheads for Computers as Components System components  Timing diagrams.  Memory.  Busses and interconnect.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
© 2000 Morgan Kaufman Overheads for Computers as Components I/O devices  I/O devices:  serial links  timers and counters  keyboards  displays  analog.
© 2000 Morgan Kaufman Overheads for Computers as Components The Embedded computing platform zCPU bus. zMemory. zI/O devices.
EEE440 Computer Architecture
© 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Bus-Based Computer Systems Example: alarm clock 1.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Computer Architecture Lecture 24 Fasih ur Rehman.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
© 2000 Morgan Kaufman Overheads for Computers as Components Host/target design  Use a host system to prepare software for target system: target system.
Semiconductor Memory Types
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
The embedded systems platform
COMP541 Memories II: DRAMs
بسم الله الرحمن الرحيم MEMORY AND I/O.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Computer Architecture Chapter (5): Internal Memory
The embedded systems platform
Chapter 5 Internal Memory
William Stallings Computer Organization and Architecture 7th Edition
EC6703 EMBEDDED AND REAL TIME SYSTEMS
William Stallings Computer Organization and Architecture 7th Edition
Bus-Based Computer Systems
William Stallings Computer Organization and Architecture 8th Edition
Introduction to Microprocessors and Microcontrollers
William Stallings Computer Organization and Architecture 7th Edition
William Stallings Computer Organization and Architecture 8th Edition
Bus-Based Computer Systems
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
William Stallings Computer Organization and Architecture 8th Edition
Chapter 13: I/O Systems.
Presentation transcript:

Chapter 4 The Embedded Computing Platform 金仲達教授 清華大學資訊工程學系 (Slides are taken from the textbook slides)

Computing Platform-1 Outline  CPU Bus and DMA  Memory and I/O Devices  Component Interfacing  Designing with Microprocessors  Development, Debugging, Testing  Design Example: Alarm Clock

Computing Platform-2 CPU bus  Connects CPU to memory and device  Bus protocol controls communication between entities decides who gets to use bus at any particular time governs length, style of communication  Four-cycle handshake: Basis of many bus protocols 2 wires: enq (enquiry) and ack (acknowledgment) dev1dev2 enq ack data

Computing Platform-3 Four-cycle example time enq ack data

Computing Platform-4 Typical bus signals  Clock  R/W’: true when bus is reading  Address: a-bit bundle  Data: n-bit bundle  Data ready’ CPU Device 1 Device 2 Memory Clock R/W’ Address Data ready’ Data

Computing Platform-5 Timing diagrams time A B C zero one rising falling stable changing 10 ns timing constraint

Computing Platform-6 Typical bus timing

Computing Platform-7 Transaction types  Wait state: state in a bus transaction to wait for acknowledgment  Disconnected transfer: bus is freed during wait state request and response are separate  Burst: multiple transfers need an extra line called burst’

Computing Platform-8

Computing Platform-9 CPU DMAC Device Memory bus request bus grant DMA  Direct Memory Access: a bus operation not controlled by CPU Controlled by DMA controller (a bus master)  2 additional wires Bus request & Bus grant

Computing Platform-10 DMA Operation  CPU controls DMA operation with 3 registers in DMAC Starting address register Length register Status register  DMAC operation mode: Burst mode: CPU stalls until I/O completes Cycle-stealing mode: DMAC releases bus after each unit of transfer

Computing Platform-11 System Bus Configuration  The bridge: A slave on the fast bus The master of the slow bus high-speed bus low-speed bus CPU Memory High-speed device Low-speed Device Bridge Low-speed Device

Computing Platform-12 ARM Bus ARM CPU High-speed I/O device Low-speed I/O device SRAM Bridge Low-speed I/O device External DRAM controller System-on-Chip AMBA high-performance bus (AHB) AMBA peripherals bus (APB)

Computing Platform-13 Outline  CPU Bus and DMA  Memory and I/O Devices  Component Interfacing  Designing with Microprocessors  Development, Debugging, Testing  Design Example: Alarm Clock

Computing Platform-14 CE’ R/W’ Adrs Data SRAM CE’ R/W’ Adrs Data DRAM RAS’ CAS’ CE’ R/W’ Adrs Data SDRAM RAS’ CAS’ Clock RAM: Random-Access Memory  SRAM (Static RAM) and DRAM (Dynamic RAM) DRAM: values must be periodically refreshed; addressed by row and column addresses Page mode, synchronous DRAM, video RAM

Computing Platform-15 Page mode

Computing Platform-16 ROM: Read-Only Memory  Factory-programmed ROM  Field-programmed ROM (with ROM burners) Antifuse-programmable ROM (programmed once) UV-erasble PROM (aka UV-EPROM) (multiple times)  Flash PROM: modern form of EPROM Old time: need to be removed from the system and must be erased in entirety Current time: can be upgraded inside the system and erased in blocks (aka boot-block flash)

Computing Platform-17 Timers and counters  Very similar: a timer is incremented by a periodic signal; a counter is incremented by an asynchronous, occasional signal.  Rollover causes interrupt  Watchdog timer: Periodically reset by system timer If is not reset, an interrupt to reset the host host CPU watchdog timer interrupt reset

Computing Platform-18 A/D and D/A converters  Analog/digital converter (ADC) Sampling the analog input before converting it to digital form Triggered by a control signal  Digital/analog converter (DAC) R 2R 4R 8R bnbn b n-1 b n-2 b n-3 V out encoder V in...

Computing Platform-19 Keyboards  An array of switches  Switch debouncing: A switch must be debounced to multiple contacts caused by eliminate mechanical bouncing

Computing Platform-20 Encoded keyboard  An array of switches is read by an encoder row address and column output used for encodong  N-key rollover remembers multiple key depressions. row scan

Computing Platform-21 LED current-limiting resistor LED digital logic  Must use resistor to limit current: An on LED has only 0.7V voltage drop

Computing Platform-22 7-segment LCD display  May use parallel or multiplexed input.

Computing Platform-23 Types of high-resolution display  Cathode ray tube (CRT)  Liquid crystal display (LCD)  Plasma, etc.

Computing Platform-24 Touchscreen  Includes input and output device.  Input device is a two-dimensional voltmeter for position sensing: ADC voltage

Computing Platform-25 Outline  CPU Bus and DMA  Memory and I/O Devices  Component Interfacing  Designing with Microprocessors  Development, Debugging, Testing  Design Example: Alarm Clock

Computing Platform-26 Example interfacing memory

Computing Platform-27 Example interfacing device

Computing Platform-28 Outline  CPU Bus and DMA  Memory and I/O Devices  Component Interfacing  Designing with Microprocessors  Development, Debugging, Testing  Design Example: Alarm Clock

Computing Platform-29 Designing with microprocessors  Architectures and components: software; hardware.  Debugging.  Manufacturing testing.

Computing Platform-30 Hardware platform architecture  There are several components in HW CPU bus memory I/O devices: networking, sensors, actuators, etc.  How to implement an embedded system using these components?

Computing Platform-31 Software architecture  Functional description must be broken into pieces – partitioning division among people conceptual organization performance testability maintenance  Software doesn’t run without hardware  How much hardware you need is determined by the software requirements speed memory

Computing Platform-32 Evaluation boards  Designed by CPU manufacturer or others  Includes CPU, memory, some I/O devices  May include prototyping section  CPU manufacturer often gives out evaluation board (e.g., EV board) can be used as starting point for your custom board design.

Computing Platform-33 Adding logic to a board  Programmable logic devices (PLDs) provide low/medium density logic  Field-programmable gate arrays (FPGAs) provide more logic and multi-level logic  Application-specific integrated circuits (ASICs) are manufactured for a single purpose

Computing Platform-34 The PC as a platform  Advantages: cheap and easy to get rich and familiar software environment  Disadvantages: requires a lot of hardware resources not well-adapted to real-time

Computing Platform-35 Typical PC hardware platform CPU CPU bus memory DMA controller timers bus interface bus interface high-speed bus low-speed bus device intr ctrl

Computing Platform-36 Typical PC busses  ISA (Industry Standard Architecture) original IBM PC bus, low-speed by today’s standard  PCI: standard for high-speed interfacing 33 or 66 MHz 264 MB/sec or 524 MB/sec  USB (Universal Serial Bus), Firewire, 1394 relatively low-cost serial interface with high speed

Computing Platform-37 Software elements  IBM PC uses BIOS (Basic I/O System) to implement low-level functions: boot-up; minimal device drivers.  BIOS has become a generic term for the lowest- level system software.

Computing Platform-38 Example: StrongARM SA-1100 (1/2)  StrongARM SA-1100 system includes: CPU chip (3.686 MHz clock) system control module ( kHz clock)  Real-time clock  operating system timer  general-purpose I/O  interrupt controller  power manager controller  reset controller

Computing Platform-39 Example: StrongARM SA-1100 (2/2) ARM CPU core System control module Bridge MHz clock kHz clock system bus peripheral bus

Computing Platform-40 Outline  CPU Bus and DMA  Memory and I/O Devices  Component Interfacing  Designing with Microprocessors  Development, Debugging, Testing  Design Example: Alarm Clock

Computing Platform-41 Host system Target system serial port CPU Host vs. Target  Host: a PC or workstation for development  Target: the HW on which the code will run  Cross-compiler: one that runs on host but generates code for target

Computing Platform-42 Debugging embedded systems  Challenges: target system may be hard to observe target may be hard to control may be hard to generate realistic inputs setup sequence may be complex

Computing Platform-43 Software debuggers  A monitor program residing on target provides basic debugger functions  Debugger should have a minimal footprint in memory  User program must be careful not to destroy debugger program, but, should be able to recover from some damage caused by user code

Computing Platform-44 Breakpoints  A breakpoint allows the user to stop execution, examine system state, and change state.  Replace the breakpointed instruction with a subroutine call to the monitor program.  Breakpoint handler actions: Save registers. Allow user to examine machine. Before returning, restore system state.  Safest way to execute the instruction is to replace it and execute in place.  Put another breakpoint after the replaced breakpoint to allow restoring the original breakpoint.

Computing Platform-45 ARM breakpoints 0x400 MUL r4,r6,r6 0x404 ADD r2,r2,r4 0x408 ADD r0,r0,#1 0x40c B loop uninstrumented code 0x400 MUL r4,r6,r6 0x404 ADD r2,r2,r4 0x408 ADD r0,r0,#1 0x40c BL bkpoint code with breakpoint

Computing Platform-46 In-circuit emulators (a.k.a. ICE)  A microprocessor in-circuit emulator is a specially- instrumented microprocessor Inside ICE, there is a special version of the microprocessor that allows its internal registers to be read out when stopped This special CPU provides as much debugging functionality as a debugger (SW) but does not take out any memory  Disadvantage: one ICE (expensive) is specific to one particular microprocessor (down to pinout)

Computing Platform-47 Logic analyzers  A logic analyzer is an array of low-grade oscilloscopes:

Computing Platform-48 Logic analyzer architecture UUT sample memory microprocessor controller system clock clock gen state or timing mode vector address display keypad

Computing Platform-49 Code verification  Instruction-level simulator a.k.a. CPU simulator down to the details in the programming model NOT simulate the actions of bus or I/O devices ARM and SHARC have such simulator  Cycle-level simulator To simulate HW operation of a computer  Hardware/software co-simulator Most common type of co-verification Consists of both HW and SW simulator

Computing Platform-50 How to exercise code  Run on host system.  Run on target system.  Run in instruction-level simulator.  Run on cycle-accurate simulator.  Run in hardware/software co-simulation environment.

Computing Platform-51 Manufacturing testing  Goal: ensure that manufacturing produces defect-free copies of the design.  Can test by comparing unit being tested to the expected behavior. But running tests is expensive.  Maximize confidence while minimizing testing cost.

Computing Platform-52 Testing concepts  Yield: proportion of manufactured systems that work. Proper manufacturing maximizes yield. Proper testing accurately estimates yield.  Field return: defective unit that leaves the factory.

Computing Platform-53 Faults  Manufacturing problems can be caused by many thing.  Fault model: model that predicts effects of a particular type of fault.  Fault coverage: proportion of possible faults found by a set of test. Having a fault model allows us to determine fault coverage.

Computing Platform-54 Software vs. hardware testing  When testing code, we have no fault model. We verify the implementation, not the manufacturing. Simple tests (e.g., ECC) work well to verify software manufacturing.  Hardware requires manufacturing tests in addition to implementation verification.

Computing Platform-55 Hardware fault models  Stuck-at 0/1 fault model: output of gate is always 0/

Computing Platform-56 Combinational testing  Every gate can be stuck-at-0, stuck-at-1.  Usually test for single stuck-at-faults. One fault at a time. Multiple faults can mask each other.  We can generate a test for a gate by: controlling the gate’s input; observing the gate’s output through other gates.

Computing Platform-57 Sequential testing  A state machine is combinational logic + registers.  Sequential testing is considerably harder. A single stuck-at fault affects the machine on every cycle. Fault behavior on one cycle can be masked by same fault on other cycles.

Computing Platform-58 Scan chains  A scannable register operates in two modes: normal; scan---forms an element in a shift register.  Using scan chains reduces sequential testing to combinational testing. Unloading/unloading scan chain is slow. May use partial scan.

Computing Platform-59 Test generation  Automatic test pattern generation (ATPG) programs: produce a set of tests given the logic structure.  Some faults may not be testable---redundant. Timeout on a fault may mean hard-to-test or untestable.

Computing Platform-60 Boundary scan  Simplifies testing of multiple chips on a board. Registers on pins can be configured as a scan chain.

Computing Platform-61 Outline  CPU Bus and DMA  Memory and I/O Devices  Component Interfacing  Designing with Microprocessors  Development, Debugging, Testing  Design Example: Alarm Clock

Computing Platform-62 Alarm clock interface Alarm on Alarm off Alarm ready set time set alarm hourminute light button PM buzzer

Computing Platform-63 Operations  Set time: hold set time, depress hour, minute.  Set alarm time: hold set alarm, depress hour, minute.  Turn alarm on/off: depress alarm on/off.

Computing Platform-64 Alarm clock requirements

Computing Platform-65 Alarm clock class diagram Lights*DisplayMechanism Buttons* Speaker*

Computing Platform-66 Alarm clock physical classes Lights* digit-val() digit-scan() alarm-on-light() PM-light() Buttons* set-time(): boolean set-alarm(): boolean alarm-on(): boolean alarm-off(): boolean minute(): boolean hour(): boolean Speaker* buzz()

Computing Platform-67 Display class Display time[4]: integer alarm-indicator: boolean PM-indicator: boolean set-time() alarm-light-on() alarm-light-off() PM-light-on() PM-light-off()

Computing Platform-68 Mechanism class Mechanism Seconds: integer PM: boolean tens-hours, ones-hours: boolean tens-minutes, ones-minutes: boolean alarm-ready: boolean alarm-tens-hours, alarm-ones-hours: boolean alarm-tens-minutes, alarm-ones-minutes: boolean scan-keyboard() update-time()

Computing Platform-69 Update-time behavior update seconds with rollover update hh:mm with rollover Rollover? T F PM=truePM=false AM->PM PM->AM display.set-time(current time) Time >= alarm and alarm-on? alarm.buzzer(true) T F

Computing Platform-70 Scan-keyboard behavior compute button activations alarm-ready= true alarm-ready= false alarm.buzzer(false) Increment time tens w. rollover and AM/PM Increment time ones w. rollover and AM/PM save button states Alarm-on Alarm-off Set-time and not set-alarm and hours Set-time and not set-alarm and minutes

Computing Platform-71 System architecture  Includes: periodic behavior (clock); aperiodic behavior (buttons, buzzer activation).  Two major software components: interrupt-driven routine updates time; foreground program deals with buttons, commands.

Computing Platform-72 Interrupt-driven routine  Timer probably can’t handle one-minute interrupt interval.  Use software variable to convert interrupt frequency to seconds.

Computing Platform-73 Foreground program  Operates as while loop: while (TRUE) { read_buttons(button_values); process_command(button_values); check_alarm(); }

Computing Platform-74 Testing  Component testing: test interrupt code on the platform; can test foreground program using a mock-up.  System testing: relatively few components to integrate; check clock accuracy; check recognition of buttons, buzzer, etc.