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

This page cannot be seen from the preview

Don't miss anything!

bg1
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
pf3
pf4
pf5
pf8
pf9
pfa

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!

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

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 s 1 and s 2 of an FSM are equivalent, if for any sequence of input vectors, the FSM starting from state s 1 produces the same sequence of output vectors as the FSM starting from state s 2

May 2, 2000 ECE 510 OCE: BDDs and Their Applications 7

FSM Equivalence Checking

  • Find the transition relations and output functions of M 1 and M 2. Find the transition relation and output function of the PM
  • Perform reachability for the PM, while checking its output
  • If the output of the product machine is 1 for all reachable states, M 1 and M 2 are equivalent; otherwise, generate an error trace (It is possible to define equivalence relative to anysubset of inputs and outputs of the FSM)

May 2, 2000 ECE 510 OCE: BDDs and Their Applications 8

Equivalence Checking Formulas

  • Property expresses equivalence of M 1 and M 2 in states s 1 and s 2 which constitute state s of PM

P(s) = ∀∀∀∀i [ λPM (i,s) ]

  • Machines M 1 and M 2 are equivalent iff

∀∀∀∀s [ AR(s) => P(s) ] = 1

where AR(s) is the set of reachable states of the PM and P(s) is the property that expresses equivalence of M 1 and M 2 in the product state s

  • Alternatively, M 1 and M 2 arenot equivalent iff

∃∃^ ∃∃s [ AR(s) & ( P(s) )’ ] = 0

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

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)}

May 2, 2000 ECE 510 OCE: BDDs and Their Applications 14

Computing Equivalence Relation

  • E(s 1 , s 2 ) can be computed using the

following procedure (iterated until

E j(s) = E j+1 (s) )

E 0 (s) = ∀∀∀∀i [ λPM(i,s) ]

E j+1 (s) = E j(s) & ∀∀∀∀i∃∃∃∃n [T( i,s,n ) & E j(n)]

where E j (n) = R(s→n)[E j(s)] and R(s→n)

is the variable replacement operator

May 2, 2000 ECE 510 OCE: BDDs and Their Applications 15

Computing Distinquishability Relation

  • D(s 1 , s 2 ) can be computed using the

following procedure (iterated until

D j(s) = Dj+1 (s) )

D 0 (s) = ∃i [ λPM(i,s)’ ]

D j+1 (s) = Dj (s) + ∃∃∃∃i∃∃∃∃n [ T( i,s,n ) & D j(n) ]

where D j(n) = R(s→n)[D j (s)] and R(s→n)

is the variable replacement operator

May 2, 2000 ECE 510 OCE: BDDs and Their Applications 16

Deriving E(s 1 , s 2 ) from D(s 1 , s 2 )

  • AR(s 1 ) is the set of reachable states

AR(s 1 ) = ∃∃∃∃s2 [E(s 1 ,s 2 )] or

AR(s 1 ) = ∃∃∃∃s2 [D(s 1 ,s 2 )]

  • The equivalence relation is derived as follows E(s 1 ,s 2 ) = [D(s 1 ,s 2 )]’ & AR(s 1 ) & AR(s 2 )
  • Similarly, for the distinquishability relation D(s 1 ,s 2 ) = [E(s 1 ,s 2 )]’ & AR(s 1 ) & AR(s 2 )

May 2, 2000 ECE 510 OCE: BDDs and Their Applications 19

Compatible Projection Operator

  • Given an equivalence relation E(x 1 , x 2 ) : {0,1} m^ x {0,1} m^ → {0,1}, the compatible projection is a boolean function F(x 1 , x 2 ) = { (x 1 ,x 2 ) | (x 1 , x 2 )∈E, x 2 = SEL(x 1 ) }, where SEL(x 1 ) 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 α; y 1 is the top variable in α; if ( αy1 = 0 ) α 1 = x 1 ’; else /if ( αy1’= 0 )/ α 1 = x 1 ;

γ = ∃∃∃∃x1 Eα 1 ;

return α 1 & CProjection( Eα 1 , αα 1 ) + γ’α 1 ’ & CProjection( Eα1’ , α (^) α 1 );

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.