Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

BDDs and FSM Equivalence Checking and State Minimization, Study notes of Electrical and Electronics Engineering

The use of bdds (binary decision diagrams) for checking equivalence and minimizing states in finite state machines (fsms). The concepts of fsm equivalence and state equivalence, the product machine, and the procedures for solving fsm equivalence and state minimization problems using bdds. It also includes a pseudocode for the compatible projection operator.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-k3o
koofers-user-k3o 🇺🇸

10 documents

1 / 11

Toggle sidebar

Related documents


Partial preview of the text

Download BDDs and FSM Equivalence Checking and State Minimization and more Study notes Electrical and Electronics Engineering in PDF only on Docsity! 1 ECE 510 OCE BDDs and Their Applications Lecture 11. FSM Equivalence Checking and FSM State Minimization May 2, 2000 Alan Mishchenko May 2, 2000 ECE 510 OCE: BDDs and Their Applications 2 Overview • Equivalence for FSMs and FSM states • Product machine (PM) • Solving the problem of FSM equivalence – Derive transition and output relation of the PM – Perform reachability on the PM and verify property Output = 1 – Generate an error trace if the equivalence check has failed • Solving the problem of FSM state minimization – Derive transition and output relation of the PM – Perform reachability on the PM and derive the state equivalence relation – Transform the initial FSM’s transition and output relations • Compatible projection operator 2 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 3 FSM Equivalence • Definition. Two state machines are equivalent, if starting from their reset states, for any sequence of input vectors, they produce identical sequences of output vectors May 2, 2000 ECE 510 OCE: BDDs and Their Applications 4 FSM State Equivalence • Definition. Two states s1 and s2 of an FSM are equivalent, if for any sequence of input vectors, the FSM starting from state s1 produces the same sequence of output vectors as the FSM starting from state s2 5 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 9 Reachability Analysis Procedure bool VerifyPropertyUsingReachabilityAnalysis( FSM* pM, bdd Property ) { bdd InitState = FindBddCube( 0, pM->NBits, CSVars, 0 ); bdd Reached = InitState, From = InitState, New[MAXITERNUM]; int NIter = 0; do { bdd To= bdd_appex(pM->TransRel,From,bddop_and,AllCSVars); To = bdd_replace( To, pNS4CS ); New[ NIter ] = To - Reached; bdd Check = ( New[ NIter ] >> Property ); if ( Check != bddtrue ) return false; From = New[ NIter ]; Reached = Reached | New[ NIter ]; } while ( New[ NIter++ ] != bddfalse ); return true; } May 2, 2000 ECE 510 OCE: BDDs and Their Applications 10 FSM State Minimization • Find the transition relations and the output functions of M. Find the transition relation and output function of the PM created by two identical instances of M • Compute the state equivalence relation, describing the sets of all equivalent state pairs • Compute the equivalence class characterization relation, by selecting a representative state from each class of equivalence states • Compute the transformed transition relation and the transformed output relation 6 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 11 Product Machine (PM) M1 M2 EXOR a b O1 c O2 • Given FSM { I, O, S, δ, λ}, with k inputs, n states, m output, the product machine is { I, {0,1}, SxS, δ2, λ2} (the product machine has k inputs, 2n states, 1 output) May 2, 2000 ECE 510 OCE: BDDs and Their Applications 12 Equivalence/Distinquishability Relations • State equivalence relation is a boolean function E(s1, s2), which is true for codes s1 and s2 iff the corresponding states are equivalent • State distinquishability relation is a boolean function D(s1, s2), which is true for codes s1 and s2 iff the corresponding states are not equivalent 7 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 13 Properties of Equivalence Relation • Equivalence relation is reflexive, symmetric, and transitive • Suppose the equivalence classes are {(00,01),(11),(10)} 100010 010011 001101 001100 10110100 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 14 Computing Equivalence Relation • E(s1, s2) can be computed using the following procedure (iterated until Ej(s) = Ej+1(s) ) E0(s) = ∀i [ λPM(i,s) ] Ej+1(s) = Ej(s) & ∀i∃n [T( i,s,n ) & Ej(n)] where Ej(n) = R(s→n)[Ej(s)] and R(s→n) is the variable replacement operator 10 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 19 Compatible Projection Operator • Given an equivalence relation E(x1, x2) : {0,1}m x {0,1}m → {0,1}, the compatible projection is a boolean function F(x1, x2) = { (x1,x2) | (x1, x2)∈E, x2= SEL(x1) }, where SEL(x1) is a selection function that uniquely selects one representative from each equivalence class May 2, 2000 ECE 510 OCE: BDDs and Their Applications 20 Pseudocode of Compatible Projection function CProjection( E, α ) if ( α = 1 ) return E; if ( E = 0 ) return 0; if ( E = 1 ) return α; y1 is the top variable in α; if ( αy1= 0 ) α1 = x1’; else /*if ( αy1’= 0 )*/ α1 = x1; γ = ∃x1 Eα1; return α1 & CProjection( Eα1 , αα1 ) + γ’α1’ & CProjection( Eα1’ , αα1 ); 11 May 2, 2000 ECE 510 OCE: BDDs and Their Applications 21 Complete Source Code for CProjection bdd CProjection( bdd F, bdd Ref ) { assert( Ref != bddfalse ); if ( Ref == bddtrue ) return F; if ( F == bddfalse ) return bddfalse; if ( F == bddtrue ) return Ref; // check cache for ready-made results bdd NextRef, Literal; int CurVar = bdd_var( Ref ); if ( bdd_low( Ref ) == bddfalse ) { // the top var is positive NextRef = bdd_high( Ref ); Literal = bdd_ithvar(CurVar); } else if ( bdd_high( Ref ) == bddfalse ) { // the top var is negative NextRef = bdd_low( Ref ); Literal =!bdd_ithvar(CurVar); } else // Ref is not a cube! assert( 0 ); // cofactors of F with respect to this literal bdd PosCofF = bdd_restrict( F, Literal ); bdd NegCofF = bdd_restrict( F, !Literal ); // the domain where projection does exist bdd Domain = bdd_exist( PosCofF, AllAVars0 ); bdd PosPart = CProjection( PosCofF, NextRef ); bdd NegPart = !Domain & CProjection( NegCofF, NextRef ); bdd Result = bdd_ite( Literal, PosPart, NegPart ); // insert the result into cache return Result; } May 2, 2000 ECE 510 OCE: BDDs and Their Applications 22 Homework: A Study of Random FSMs • Generate transition relations of random FSMs with N states and K transitions in each state • Perform reachability analysis using the generated transition relations and determine the number of reachable states and the number of iterations in the FSM traversal • Assume, N = 10000, K = {1,2,…,10}. Draw a graph visualizing the number of reachable states, the number of iterations, and the time needed to complete the reachability analysis as a function of K.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved