230 likes | 493 Views
Models of Computation: FSM Model. Reading: L. Lavagno , A.S. Vincentelli and E. Sentovich , “Models of computation for Embedded System Design”. Our Design Approach. Start design process before hw-sw partitioning Sequence of steps are vital
E N D
Models of Computation: FSM Model Reading: L. Lavagno, A.S. Vincentelli and E. Sentovich, “Models of computation for Embedded System Design”
Our Design Approach • Start design process before hw-sw partitioning • Sequence of steps are vital • system specification unbiased to implementation • describe system behavior at high level • Initial functional design • verification • mapping to target architecture • Thus, function-architecture codesign is key approach Mahapatra-Texas A&M
Proposed design strategy • Taken from Ref. Of reading assignment. Functional Level Architecture Libraries Behaviorial Library Capture Behavior Behavioral Library Capture Architecture Verify architecture Capture behavior Verify behavior Mapping Level Map behavior to Architecture Verify performance Performance Back Annotation Refine HW/SW micro-architect Architecture Level Link to micro- arch verification Link to HW/SW implementation Mahapatra-Texas A&M
Design conception to design description • At functional level, behavior of a system to be implemented is selected and analyzed against a set of specifications • Specifications vs.. behavior? • Specs:I/O relation, set of constraints, system goals • behavior: algorithm to realize the function -Specs: algorithm itself! (another view) • Purists view: Algorithm is the result of implementation decision Mahapatra-Texas A&M
Examples • Example1: Let f(x) = 0 is a system to be implemented. It is a design decision to use either Newton-Raphson or Gauss-SeidelS relaxation algorithm! • Example2: MPEG Encoder design Spec: Encoding of compressed stream of data. Any implementation that creates it from the stream is correct. Here the design decision is already there. Mahapatra-Texas A&M
Algorithm Design and Analysis • Algorithm development: Key aspect of system design at functional level • Little work has been done on selection of algorithm based on specifications • Requiresstrong correctness properties in critical operations • Algorithm analysis is more general concept than simulation • Important to decide on mathematical model for designer that will support algorithm analysis Mahapatra-Texas A&M
Algorithm Implementation • Need of intermediate step: transform an algorithm to a set of tractable functional components • The functional components are to be formally defined to capture the algorithm’s properties • MoC is key answer to the above! • Selection of MoC is to be done carefully. (FSM, DF, DES, Comm Seq. Process) Mahapatra-Texas A&M
MoCsBasic Concepts • MoC is composed of a description mechanism (syntax) and rules for computation of behavior given the syntax (semantics) • It is chosen for its suitability: compactness, ability to synthesize, optimize the behavior of implementation • Most MoCs Permit distributed system of description ( a collection of communicating modules), and gives rules of computation of each module (function), and how they communicate. Mahapatra-Texas A&M
MoC Primitives • Functions: combination of Boolean functions and synchronous state machines • Communications: queues, buffers, and schedulers Mahapatra-Texas A&M
Finite State Machine (FSM) Mahapatra-Texas A&M
FSM • Finite‐State Machine (FSM) -A way to describe desired behavior of Sequential circuit –Akin to Boolean equations for • Combinational behavior –List states, and transitions among states Mahapatra-Texas A&M
Outputs : x clk ^ x=0 x=1 Lo Hi clk ^ Hi Lo Lo Hi Hi Hi Lo Lo cycle 1 cycle 2 cycle 3 cycle 4 clk state Lo Hi Lo Hi Outputs : x Capturing Sequential Circuit Behavior as FSM • Toggle switch example: • List states, and transitions among states • Example: Toggle x every clock cycle • Two states: “Lo” (x=0), and “Hi” (x=1) • Transition from Lo to Hi, or Hi to Lo, on rising clock edge (clk^) • Arrow points to initial state (when circuit first starts) Depicting multi-bit or other info in a timing diagram a
clk Off On1 On2 On3 Off On1 On2 On3 Off State Outputs : x FSM Example: Three Cycles High System • Want 0, 1, 1, 1, 0, 1, 1, 1, ... • For one clock cycle each • Capture as FSM • Four states: 0, first 1, second 1, third 1 • Transition on rising clock edge to next state Outputs : x clk ^ clk ^ clk ^ x=0 x=1 x=1 x=1 Off On1 On2 On3 a ^ clk a
clk Inputs : b State Off Off Off Off Off On1 On2 On3 Off Outputs : x Three-Cycles High System with Button Input Inputs: b Outputs: x x=0 clk ^ • Four states • Wait in “Off” while b is 0 (b’*clk^) • When b is 1 (b*clk^), transition to On1 • Sets x=1 • Next two clock edges, transition to On2, then On3 • So x=1 for three cycles after button pressed Off b'*clk ^ b*clk ^ clk ^ clk ^ x=1 x=1 x=1 On1 On2 On3
Inputs: b; Outputs: x x=0 clk ^ O ff ^ b’ *clk b *clk ^ clk clk ^ ^ x=1 x=1 x=1 On1 On2 On3 Inputs: b; Outputs: x x=0 Off b ’ b x=1 x=1 x=1 On1 On2 On3 FSM Simplification: Rising Clock Edges Implicit • Every edge ANDed with rising clock edge • What if we wanted a transition without a rising edge • We don’t consider such asynchronous FSMs – less common, and advanced topic • Only consider synchronous FSMs – rising edge on every transition a Note: Transition with no associated condition thus transistions to next state on next clock cycle
Inputs: b; Outputs: x x=0 Off b ’ b x=1 x=1 x=1 On1 On2 On3 FSM Definition • FSM consists of • Set of states • Ex: {Off, On1, On2, On3} • Set of inputs, set of outputs • Ex: Inputs: {b}, Outputs: {x} • Initial state • Ex: “Off” • Set of transitions • Each with condition • Describes next states • Ex: Has 5 transitions • Set of actions • Sets outputs in each state • Ex: x=0, x=1, x=1, and x=1 We often draw FSM graphically, known as state diagram Can also use table (state table), or textual languages
Modeling & Testing FSM • Example of “Three Cycle High Laser Controller” • Impl. the FSM in Verilog (High level IP) • Test using VerilogTestbench for functional verification • Use of tools to create FSM and generate Verilog Module Mahapatra-Texas A&M
Assignment 1(practice problem) “Three Cycle High Laser Controller” • Use Fizzim tool editor to create FSM from a given specification. (manual process) • Use Fizzim to generate high-level IP written in Verilog HDL. • Write testbench to verify functionality of the module. Use ModelSim for verification. • Ref. Laser Controller Tutorial. Mahapatra-Texas A&M
Assignment 1 (Things to do) • Consider Interrupt Handler (IH) problem. • Ref: Tutorial on Interrupt Handler • Specify the requirements/steps at high level • Create FSM, and generate Verilog IH-IP module using Fizzim tools. • Verify IH-IP module using ModelSim. • Modelsim.com student version free Mahapatra-Texas A&M
Administration • Group of two students with ECE and CS backgrounds • Credits after successful demonstration. • You may have choice to pick up another controller problem but with advanced notice to the instructor. • Will show the valid results during demonstration. Mahapatra-Texas A&M
Last slide • Questions? Mahapatra-Texas A&M