FORMAL VERIFICATION OF DIGITAL CIRCUITS USING SYMBOLIC MODEL CHECKING Aleš Časar, Zmago Brezočnik, Tatjana Kapus University of Maribor, Faculty of Electrical Engineering and Computer Science, Slovenia Keywords: electrotechnics, computer science, digital circuits, BDD, Binary Decision Diagrams, FSM, Final State Machines, transition relations, characteristic functions, reachable states, CTL, Computation Tree Logic, fairness constraints, formal verification, symbolic model checking, computer software, software packages, experimental results Abstract: This paper presents efficient algorithms for digital circuit verification. The algorithms are based on symbolic CTL (Computation Tree Logic) model checking. We also present an extension of ordinary CTL with fairness constraints. They enable verification of circuits with symbolic model checking regarding only fair paths in the computation tree. The model checking algorithms were implemented as part of a fully home-made program package for manipulating finite state machine descriptions of digital circuits, represented with Boolean functions. The package is also based on a fully home-made program package for manipulating Boolean functions, represented with binary decision diagrams. Formalna verifikacija digitalnih vezij s simboličnim preverjanjem modelov Ključne besede: elektrotehnika, računalništvo, vezja digitalna, BDD grafi odločitveni binarni, FSM stroji stanj končnih, relacije prehajalne, funkcije karakteristične, stanja dosegljiva, CTL logika drevesa izračunavanj, omejitve poštenostne, verifikacija formalna, preverjanje modelov simbolično, oprema programska računalniška, paketi opreme programske, rezultati eksperimentalni Povzetek: V članku predstavljamo učinkovite algoritme za verifikacijo digitalnih vezij. Algoritmi temeljijo na simboličnem preverjanju modelov z logiko drevesa izvajanj ("Computation Tree Logic" - CTL). Prav tako predstavljamo razširitev navadnega CTL s poštenostnimi omejitvami, ki omogočajo verifikacijo vezij samo vzdolž poštenih poti v drevesu izvajanj. Algoritmi za preverjanje modelov so implementirani kot del povsem domačega programskega paketa za obdelavo opisov digitalnih vezij s končnimi avtomati, predstavljenih z logičnimi funkcijami, ki temelji na prav tako povsem domačem paketu za obdelavo logičnih funkcij, predstavljenih z binarnimi odločitvenimi grafi. 1 Introduction The manipulation of finite state machines (FSMs) is very common nowadays in the areas of digital circuit design like formal verification, automatic synthesis, and testing [12], One of the main problems that must be solved is the verification of properties of FSMs representing digital circuits. The properties are often specified by computation tree logic (CTL) because with a properly written CTL formula it can automatically be verified if certain property is valid in a FSM or not. Everything, CTL formulas, the set of states of the FSM, and its transition relation can be uniquely represented as Boolean functions, which can be very efficiently represented with binary decision diagrams (BDDs). Using symbolic state space traversal and model checking, we can avoid combinatorial explosion, which is one of the main problems with enumeration-based methods. Unfortunately, it is impossible to specify all properties in CTL. A significant part of such properties are those that could be specified in CTL, but we want them to be verified only in a FSM constrained to normal (fair) paths in order to avoid singularities and similar things. The problem is solved by the introduction of fairness constraints, which constrain the FSM to fair paths, so that the properties can be verified in the usual way. The purpose of this paper is to present the model checking algorithms which we implemented within fully home-made program package for manipulating finite state machine descriptions of digital circuits, represented with Boolean functions. The algorithms have performed very well. In Section 2 we briefly review BDDs and show how to represent FSMs with them. Section 3 describes the methods of searching reachable states. The main part of the paper is Section 4 where we present algorithms for symbolic model checking in CTL. Algorithms for symbolic model checking using fairness constraints are described in Section 5. Experimental results for benchmark circuits are given in Section 6. We conclude with some discussion and plans for future work. 2 Preliminaries Binary decision diagrams (BDDs) are compact canonical representations of Boolean functions [2], Their size is closely related to the variable ordering. The manipulation of Boolean functions represented with BDDs is very efficient. Hence, BDDs have become widely used in various CAD applications, including state space traversal and model checking. BDDs can also be used for representing and manipulating sets if we represent sets by means of their characteristic functions. If is a subset of {0,l}", its characteristic function Xj ■ (O^l}' (Oj) 'S defined by Xj \-yeJ (1) Thus, set operations can be perfonned by Boolean operations over the corresponding characteristic functions (e.g., xjc = Xj • Xj^b X^^g - Xj ■ Xß)- shorter notation we will denote x_j by A in the rest of the paper. Since the characteristic functions are Boolean, we can efficiently manipulate them with BDDs. A detenninistic finite state machine (FSM) M is a sixtuple M = , where I is a finite set of input symbols, ^ a finite set of states, 0 a finite set of output symbols, 5 . S xY. S a state transition function, an output function, and ^^ e an initial state. If we want to realize a FSM by a digital circuit, we will have to encode the sets S, 2, and 0 by binary symbols (e.g., 0 and 1). States are encoded by state variables. At least n = S\ state vari- ables. m = logj E input variables, and I = logj 0 output variables of the circuit are needed. Let IJ, X, and .Z represent the set of state variables, the set of input variables, and the set of output variables, respectively. Once the states and the input symbols of the circuit are encoded, we denote a state transition function as 5 : (0,1)" x {0,l}'" ^ {O,!}". Then, next state variables are functions of present state variables and input variables. We denote next state variables by an added prime (') and write a transition function of a state variable y. as (2) for i - We rather introduce transition relations Namely, relations have much greater expressive power than functions [3]. With relations it is very easy to handle nondeterminism and to perfonn backward reachability search that is relatively difficult with functions. Transition relations T. can be combined by tal 2 are still true. In the same manner we could proceed, what leads us to fairness constraint OUT +OUT +... + OUT n-\ AX OUT -OUT, +... + OUT, (21) forO AX In Table 3 we collected the results obtained from the verification of the parametric bus arbiter.^ The columns from left to right represent the number of devices (»). the number of state variables (latches) of the circuit («), the number of CTL formulas being verified for each n (3/7 + 1), and the maximal number of BDD nodes whenever generated during symbolic model checking of a given circuit together with the CPU time in seconds both for the model checking using monolithic transition relation and partitioned transition relation. An overflow on BDD nodes is denoted by a dash '—'. We did not perform a lot of experiments with fairness constraints. Well, checking of CTL fomiulas (17) for /7 = 4 with fairness constraint (21) for k = 3 took less than of a second. 7 Conclusions We reviewed two different algorithms for searching of reachable states in FSMs, using either monolithic transition relation or partitioned transition relation. The introduction of partitioned transition relation may decrease the CPU times for large circuits dra- ^ Although an arbiter with n = I is a totally senseless circuit, it is Included in Table 3 for the sake of completeness. Anyway, a model checking algorithm does not care whether it handles useful or senseless circuits. Table 3: Checking of parametric arbiter in CTL # # monolithic TR J 1 partitioned TR dev. state CTL #BDD time #BDD time n var. form. nodes Is1 nodes M 1 2 4 18 0.00 11 0.00 2 4 7 174 0.00 76 0.00 3 6 10 947 0.01 298 0.01 4 8 13 4403 0.10 929 0,01 5 10 16 19171 0.64 2299 0,01 6 12 19 78044 4.63 7540 0.11 7 14 22 297614 38.37 15095 0.23 8 16 25 1214392 291.79 40247 0.98 S 18 28 4912359 2019.25 40301 1.77 10 20 31 — — 100861 9.09 11 22 34 — — 136629 15.55 12 24 37 — — 616346 100.33 13 26 40 — — 745319 184.85 14 28 43 — — 3827900 1534.16 15 30 45 — — 4303558 3603.01 maticaliy. Then, we showed methods for verifying synchronous sequential circuits by symbolic model checking [7][9]. Properties to be verified were expressed in CTL. We illustrated the usage of fairness constraints by verifying a parametric bus arbiter which selects the highest priority device from n devices. We checked if it is possible that some device requests a bus and the bus is never granted to it regarding different fairness constraints. All algorithms are realized as part of a homemade package for manipulating FSMs which is also based on a fully home-made very efficient package for manipulating Boolean functions represented by BDDs [10], Our future work will consist in the implementation of searching for counterexamples for false properties and then of automatic generation of testing sequences for digital circuits based on found counterexamples. 8 References /1/ Zmago Brezočnik, Aleš Časar, and Tatjana Kapus. Efficient Symbolic Traversal Algorithms using Partitioned Transition Relations, in Zmago Brezočnik and Tatjana Kapus, editors, Proceedings of the COST 247 International Workshop on Applied Formal Methods in System Design, pages 146-155, Maribor, Slovenia, June 1996. /2/ Randal E. Bryant. Graph-Based Algorithms for Boolean Function Manipulation. IEEE Transactions on Computers, C-35{8):677-691, August 1986. /3/ Jerry R. Burch, Edmund M. Clarke, David E. Long, Kenneth L. McMillan, and David L. Dill. Symbolic Model Checking for Sequential Circuit Verification, IEEE Transactions on Computer-aided Design of Integrated Circuits and Systems, 13(4):401-424, April 1994. /4/ E. M. Clarke, E. A. Emerson, and A. P. Sistla. Automatic Verification of Finite-State Concurrent Systems using Temporal Logic Specifications. ACM Transactions on Programming Languages and Systems, 8(2):244-263, April 1986. /5/ Aleš Časar. Verification of Finite State Machines with Symbolic Model Checking. Master's thesis. University of Maribor, Faculty of Electrical Engineering and Computer Science, Maribor, Slovenia, June 1998. in Slovene. /6/ Aleš Časar and Zmago Brezočnik. Symbolic State Space Traversal of Finite State Automata. In Franc Solina and Baldomir Zajc, editors. Proceedings of the Fourth Electrotechnical and Computer Science Conference ERK'95, volume A, pages 85-88, Portorož, Slovenia, September 1995. In Slovene. /7/ Aleš Časar, Zmago Brezočnik, and Tatjana Kapus, Exploiting Partitioned Transition Relations for Efficient Symbolic Model Checking in CTL, In Penny Storms, editor, Proceedings of the European Design & Test Conference ED&TC'96, pages 606-606, Paris, France, March 1996. IEEE Computer Society Press. /8/ Aleš Časar, Zmago Brezočnik, and Tatjana Kapus. Fairness Constraints in Symbolic CTL Model Checking. In Baldomir Zajc and Franc Solina, editors. Proceedings of the seventh Electrotechnical and Computer Science Conference ERK'98, volume B, pages 39-42, Portorož, Slovenia, September 1998, In Slovene, /9/ Aleš Časar, Zmago Brezočnik, and Tatjana Kapus, Symbolic Model Checking of Finite State Machines with CTL, In Baldomir Zajc and Franc Solina, editors. Proceedings of the fifth Electrotechnical and Computer Science Conference ERK'96, volume A, pages 51-54, Portorož, Slovenia. September 1996. In Slovene. Aleš Časar, Robert Meolic, Zmago Brezočnik, and Bogomir Horvat. Representation of Boolean Functions with ROBDDs, Electrotechnical Review, 59(5):299-307, December 1992, In Slovene, David Deharbe and Dominique Borrione. Symbolic Model Checking of VHDL Design Entities. Technical report, Atelier de Recherche sur les Techniques Mathematiques et Informatiques des Systemes, Grenoble, France, November 1993. Aarti Gupta. Formal Hardware Verification Methods: A survey. Formal Methods in System Design, 1(2/3):151-238, October 1992, /10/ /11/ /12/ mag. Aleš Časar, univ. dipl. inž. rač. izr. prof. dr Zmago Brezočnik, univ. dipl. inž. e/. izr. prof. dr. Tatjana Kapus, univ. dipl. inž. el. Univerza v Mariboru Fakulteta za elektrotehniko, računalništvo In informatiko Smetanova 17 2000 Maribor tel.: +386-2-22-07-211 fax: +386-2-25-11-178 email: (casar,brezočnik,kapus}@uni-mb.si Prispelo (Arrived): 10.5.00 Sprejeto (Accepted): 30.8.00