2-Hardware Design of Embedded Processors (cont.)

Slides:



Advertisements
Similar presentations
Embedded System, A Brief Introduction
Advertisements

2-Hardware Design of Embedded Processors (cont.) Advanced Approaches.
SpecC and SpecCharts Reviewed and Presented by Heemin Park and Eric Kwan EE202A - Fall 2001 Professor Mani Srivastava.
5-High-Performance Embedded Systems using Concurrent Process
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 8: State Machine and Concurrent Process Model.
1 Homework Turn in HW2 at start of next class. Starting Chapter 2 K&R. Read ahead. HW3 is on line. –Due: class 9, but a lot to do! –You may want to get.
C Lecture Notes 1 Program Control (Cont...). C Lecture Notes 2 4.8The do / while Repetition Structure The do / while repetition structure –Similar to.
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Joshua GarrettUniversity of California, Berkeley SpecCharts: A VHDL Front-End for Embedded Systems.
Advanced Behavioral Modeling
FunctionsFunctions Systems Programming Concepts. Functions   Simple Function Example   Function Prototype and Declaration   Math Library Functions.
Fundamentals of Python: From First Programs Through Data Structures
Ch.2 Part A: Requirements, State Charts EECE **** Embedded System Design.
CMP502 – Embedded Systems Models of Computation.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 8: State Machine and Concurrent Process Model.
Chapter 9 Finite-State Machines
1 5-High-Performance Embedded Systems using Concurrent Process (cont.)
From requirements to specification Specification is a refinement of requirements Can be included together as Software Requirements Specifications (SRS)
CprE 588 Embedded Computer Systems Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #3 – Models of.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 State Machine and Concurrent Process Model.
CMSC 104, Lecture 171 More Loops Topics l Counter-Controlled (Definite) Repetition l Event-Controlled (Indefinite) Repetition l for Loops l do-while Loops.
Control Structures - Selections - Repetitions/iterations (part 2) 1 -Based on slides from Deitel & Associates, Inc. - Revised by T. A. Yang.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CMSC 104, Version 9/011 More Loops Topics Counter-Controlled (Definite) Repetition Event-Controlled (Indefinite) Repetition for Loops do-while Loops Choosing.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Embedded Programming B. Furman 09MAY2011. Learning Objectives Distinguish between procedural programming and embedded programming Explain the Events and.
CS244-Introduction to Embedded Systems and Ubiquitous Computing
1 5-High-Performance Embedded Systems using Concurrent Process (cont.)
2-Hardware Design of Embedded Processors (cont.) Advanced Approaches.
1 5-High-Performance Embedded Systems using Concurrent Process (cont.)
Winter-Spring 2001Codesign of Embedded Systems1 Essential Issues in Codesign: Models Part of HW/SW Codesign of Embedded Systems Course (CE )
EECE 320 L8: Combinational Logic design Principles 1Chehab, AUB, 2003 EECE 320 Digital Systems Design Lecture 8: Combinational Logic Design Principles.
From requirements to specification Specification is a refinement of requirements Can be included together as Software Requirements Specifications (SRS)
Elevator Example. Problem GSU schedules to upgrade all the campus elevators in 6 months. Due to incompatibility with the new hardware, the current software.
State Machine Diagram.
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
5-High-Performance Embedded Systems using Concurrent Process
Timing Model Start Simulation Delay Update Signals Execute Processes
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Chapter 8: State Machine and Concurrent Process Model
2008/10/22: Lecture 12 CMSC 104, Section 0101 John Y. Park
5-High-Performance Embedded Systems using Concurrent Process (cont.)
Loop Control Structure.
“White box” or “glass box” tests
Verilog for Digital Design
2008/10/22: Lecture 12 CMSC 104, Section 0101 John Y. Park
Instructions to get MAX PLUS running
Coding Concepts (Basics)
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
UMBC CMSC 104 – Section 01, Fall 2016
Chapter 8: State Machine and Concurrent Process Model
More Loops Topics Counter-Controlled (Definite) Repetition
More Loops Topics Counter-Controlled (Definite) Repetition
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
More Loops Topics Counter-Controlled (Definite) Repetition
More Loops Topics Counter-Controlled (Definite) Repetition
More Loops Topics Counter-Controlled (Definite) Repetition
UML Diagrams: StateCharts The Dynamic Analysis Model
Essential Issues in Codesign: Models
Digital Designs – What does it take
STATE MACHINE AND CONCURRENT PROCESS MODEL
State Machine and Concurrent Process Model
STATE MACHINE AND CONCURRENT
Finite State Machine Continued
More Loops Topics Counter-Controlled (Definite) Repetition
More Loops Topics Counter-Controlled (Definite) Repetition
Presentation transcript:

2-Hardware Design of Embedded Processors (cont.) Alternative Approaches

Example: An elevator controller “Move the elevator either up or down to reach the requested floor. Once at the requested floor, open the door for at least 10 seconds, and keep it open until the requested floor changes. Ensure the door is never open while moving. Don’t change directions unless there are no higher requests when moving up or no lower requests when moving down…” Partial English description buttons inside elevator Unit Control b1 down open floor ... Request Resolver up/down buttons on each b2 bN up1 up2 dn2 dnN req up System interface up3 dn3 Simple elevator controller Request Resolver resolves various floor requests into single requested floor Unit Control moves elevator to this requested floor Try capturing in C...

Elevator controller using a sequential program model buttons inside elevator Unit Control b1 down open floor ... Request Resolver up/down buttons on each b2 bN up1 up2 dn2 dnN req up System interface up3 dn3 Sequential program model void UnitControl() { up = down = 0; open = 1; while (1) { while (req == floor); open = 0; if (req > floor) { up = 1;} else {down = 1;} while (req != floor); up = down = 0; open = 1; delay(10); } void RequestResolver() while (1) ... req = ... void main() Call concurrently: UnitControl() and RequestResolver() Inputs: int floor; bit b1..bN; up1..upN-1; dn2..dnN; Outputs: bit up, down, open; Global variables: int req; “Move the elevator either up or down to reach the requested floor. Once at the requested floor, open the door for at least 10 seconds, and keep it open until the requested floor changes. Ensure the door is never open while moving. Don’t change directions unless there are no higher requests when moving up or no lower requests when moving down…” Partial English description You might have come up with something having even more if statements.

Finite-state machine (FSM) model Trying to capture this behavior as sequential program is a bit awkward Instead, we might consider an FSM model, describing the system as: Possible states E.g., Idle, GoingUp, GoingDn, DoorOpen Possible transitions from one state to another based on input E.g., req > floor Actions that occur in each state E.g., In the GoingUp state, u,d,o,t = 1,0,0,0 (up = 1, down, open, and timer_start = 0) Try it...

Finite-state machine (FSM) model Idle GoingUp req > floor req < floor !(req > floor) !(timer < 10) DoorOpen GoingDn u,d,o, t = 1,0,0,0 u,d,o,t = 0,0,1,0 u,d,o,t = 0,1,0,0 u,d,o,t = 0,0,1,1 u is up, d is down, o is open req == floor !(req<floor) timer < 10 t is timer_start UnitControl process using a state machine

HCFSM and the Statecharts language Hierarchical/concurrent state machine model (HCFSM) Extension to state machine model to support hierarchy and concurrency States can be decomposed into another state machine With hierarchy has identical functionality as Without hierarchy, but has one less transition (z) Known as OR-decomposition States can execute concurrently Known as AND-decomposition Statecharts Graphical language to capture HCFSM timeout: transition with time limit as condition history: remember last substate OR-decomposed state A was in before transitioning to another state B Return to saved substate of A when returning from B instead of initial state A1 z B A2 x y w Without hierarchy A1 z B A2 x y A w With hierarchy C1 C2 x y C B D1 D2 u v D Concurrency

UnitControl with FireMode req>floor UnitControl FireMode When fire is true, move elevator to 1st floor and open door u,d,o = 1,0,0 GoingUp fire !(req>floor) req>floor u,d,o = 0,0,1 Idle timeout(10) w/o hierarchy: Getting messy! DoorOpen u,d,o = 0,0,1 req==floor !fire w/ hierarchy: Simple! req<floor !(req<floor) u,d,o = 0,1,0 GoingDn FireGoingDn floor>1 u,d,o = 0,1,0 FireDrOpen floor==1 fire u,d,o = 0,0,1 req<floor With hierarchy Idle GoingUp req>floor req<floor !(req>floor) timeout(10) DoorOpen GoingDn u,d,o = 1,0,0 u,d,o = 0,0,1 u,d,o = 0,1,0 req==floor NormalMode UnitControl Without hierarchy NormalMode FireMode fire !fire UnitControl ElevatorController RequestResolver ... With concurrent RequestResolver fire !fire FireGoingDn floor>1 u,d,o = 0,1,0 FireDrOpen floor==1 fire FireMode u,d,o = 0,0,1

Program-state machine model (PSM): HCFSM plus sequential program model up = down = 0; open = 1; while (1) { while (req == floor); open = 0; if (req > floor) { up = 1;} else {down = 1;} while (req != floor); open = 1; delay(10); } NormalMode FireMode up = 0; down = 1; open = 0; while (floor > 1); up = 0; down = 0; open = 1; fire !fire UnitControl ElevatorController RequestResolver ... req = ... int req; Program-state’s actions can be FSM or sequential program Designer can choose most appropriate Stricter hierarchy than HCFSM used in Statecharts transition between sibling states only, single entry Program-state may “complete” Reaches end of sequential program code, OR FSM transition to special complete substate PSM has 2 types of transitions Transition-immediately (TI): taken regardless of source program-state Transition-on-completion (TOC): taken only if condition is true AND source program-state is complete SpecCharts: extension of VHDL to capture PSM model SpecC: extension of C to capture PSM model NormalMode and FireMode described as sequential programs Black square originating within FireMode indicates !fire is a TOC transition Transition from FireMode to NormalMode only after FireMode completed

Capturing state machines in sequential programming language Despite benefits of state machine model, most popular development tools use sequential programming language C, C++, Java, Ada, VHDL, Verilog, etc. Development tools are complex and expensive, therefore not easy to adapt or replace Must protect investment Two approaches to capturing state machine model with sequential programming language Front-end tool approach Additional tool installed to support state machine language Graphical and/or textual state machine languages May support graphical simulation Automatically generate code in sequential programming language that is input to main development tool Drawback: must support additional tool (licensing costs, upgrades, training, etc.) Language subset approach E.g. using C...

Language subset approach Follow rules (template) for capturing state machine constructs in equivalent sequential language constructs Used with software (e.g.,C). Similar in hardware languages (e.g.,VHDL or Verilog) Capturing UnitControl state machine in C Enumerate all states (#define) Declare state variable initialized to initial state (IDLE) Single switch statement branches to current state’s case switch (state) case idle: …; break; case …: … Each case has actions up, down, open, timer_start Each case checks transition conditions to determine next state if(…) {state = …;} #define IDLE 0 #define GOINGUP 1 #define GOINGDN 2 #define DOOROPEN 3 void UnitControl() { int state = IDLE; while (1) { switch (state) { case IDLE: up=0; down=0; open=1; timer_start=0; if (req==floor) {state = IDLE;} if (req > floor) {state = GOINGUP;} if (req < floor) {state = GOINGDN;} break; case GOINGUP: up=1; down=0; open=0; timer_start=0; if (!(req>floor)) {state = DOOROPEN;} case GOINGDN: up=1; down=0; open=0; timer_start=0; if (!(req<floor)) {state = DOOROPEN;} case DOOROPEN: up=0; down=0; open=1; timer_start=1; if (timer < 10) {state = DOOROPEN;} if (!(timer<10)){state = IDLE;} }//end switch (state) }// end while (1) }//end UnitControl UnitControl state machine in sequential programming language

General template #define S0 0 #define S1 1 ... #define SN N void StateMachine() { int state = S0; // or whatever is the initial state. while (1) { switch (state) { case S0: // Insert S0’s actions here & Insert transitions Ti leaving S0: if( T0’s condition is true ) {state = T0’s next state; /*actions*/ } if( T1’s condition is true ) {state = T1’s next state; /*actions*/ } if( Tm’s condition is true ) {state = Tm’s next state; /*actions*/ } break; case S1: // Insert S1’s actions here // Insert transitions Ti leaving S1 case SN: // Insert SN’s actions here // Insert transitions Ti leaving SN }