## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Graphs

**Department of Computer S
ien
e and Engineering
**

Indian Institute of Te
hnology, Kharagpur

QUERYING CIRCUITS AND OTHER LABELLED GRAPHS

By

Jayanta Majumder

**SUBMITTED IN PARTIAL FULFILLMENT OF THE
**

REQUIREMENTS FOR THE DEGREE OF

MASTER OF SCIENCE

AT

INDIAN INSTITUTE OF TECHNOLOGY, KHARAGPUR

WEST BENGAL, INDIA

DECEMBER 2004

Copyright by Jayanta Majumder, 2004

**INDIAN INSTITUTE OF TECHNOLOGY, KHARAGPUR
**

DEPARTMENT OF

COMPUTER SCIENCE AND ENGINEERING

The undersigned hereby
ertify that they have read and re
ommend

to the Fa
ulty of Graduate Studies for a
eptan
e a thesis entitled

\Querying Cir
uits and other Labelled Graphs" by Jayanta Majumder

in partial fulllment of the requirements for the degree of Master of S
ien
e.

**Dated: De
ember 2004
**

Supervisors:

Prof. Partha Pratim Chakrabarti

Dr. Chittaranjan Mandal

Reader:

Dr. Amit Patra

ii

INDIAN INSTITUTE OF TECHNOLOGY, KHARAGPUR

**Date: De
ember 2004
**

Author:

Jayanta Majumder

Title:

Querying Cir
uits and other Labelled Graphs

Department: Computer S
ien
e and Engineering

Degree: M.S.

Convo
ation: June

Year: 2005

Permission is herewith granted to Indian Institute of Te
hnology, Kharagpur to

ir
ulate and to have
opied for non-
ommer
ial purposes, at its dis
retion, the above

title upon the request of individuals or institutions.

Signature of Author

THE AUTHOR RESERVES OTHER PUBLICATION RIGHTS, AND NEITHER

THE

THESIS

NOR

EXTENSIVE

EXTRACTS

FROM

IT

MAY

BE

PRINTED

OR

**OTHERWISE REPRODUCED WITHOUT THE AUTHOR'S WRITTEN PERMISSION.
**

THE AUTHOR ATTESTS THAT PERMISSION HAS BEEN OBTAINED FOR THE

USE OF ANY COPYRIGHTED MATERIAL APPEARING IN THIS THESIS (OTHER

THAN BRIEF EXCERPTS

REQUIRING ONLY PROPER ACKNOWLEDGEMENT IN

SCHOLARLY WRITING) AND THAT ALL SUCH USE IS CLEARLY ACKNOWLEDGED.

iii

To Human Con iousness.

iv

Table of Contents

Table of Contents

vi

List of Tables

vii

List of Figures

viii

1 Introdu tion

**1.1 A PR-style Introdu
tion . . . . . . . . . . . . . . . .
**

1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . .

1.2.1 Debugging and Verifying Netlists . . . . . . .

1.2.2 Debugging and Verifying Sequential Systems

1.2.3 Analyzing Engineering Drawings . . . . . . .

1.2.4 Feature Re
ognition in Solid Models . . . . .

1.2.5 Opti
al Shape/Chara
ter Re
ognition . . . .

1.3 Data Model for SQUARE . . . . . . . . . . . . . . .

1.4 Qui
k Overview . . . . . . . . . . . . . . . . . . . . .

1.5 Layout of the Thesis . . . . . . . . . . . . . . . . . .

2 Mathemati al Tools and Notations

2.1

2.2

2.3

2.4

2.5

2.6

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

**Stru
tures : Sets, Tuples, Strings, Relations and Fun
tions .
**

Propositional Predi
ate Logi
. . . . . . . . . . . . . . . . .

Graphs : Basi
Denitions . . . . . . . . . . . . . . . . . . .

Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Des
ribing Semanti
s of Languages . . . . . . . . . . . . . .

Relational Cal
ulus using Binary De
ision Diagrams . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

1

5

6

7

8

9

9

10

10

12

14

17

17

22

24

25

26

26

3 The SQUARE Language

27

4 Integrating Appli ations with SQUARE

32

5 Stru tural Query on Cir uits

33

5.1 Ba
kground . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.2 Reasoning about Netlists . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

v

33

38

5.2.1 Netlists . . . . . . . . . . . . . . . . . . . . . . . . . .

5.2.2 Types of Netlists . . . . . . . . . . . . . . . . . . . . .

5.2.3 Reasoning Problems in Netlist . . . . . . . . . . . . .

5.2.4 Representation of Netlists . . . . . . . . . . . . . . . .

5.3 Overview of the Netlist Management System . . . . . . . . .

5.3.1 The Netlist Information Model and its Representation

5.3.2 Integration of SQUARE with the NMS . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

38

39

41

44

46

46

49

6 The Implementation of SQUARE

52

7 Results

60

8 Con lusion and S ope for Future Work

61

Bibliography

62

**6.0.3 Algorithmi
s and Ar
hite
ture . . . . . . . . . . . . . . . . . . . . .
**

6.1 Evaluation of the all-paths Query . . . . . . . . . . . . . . . . . . . . . . . .

6.2 Evaluation of the Exists-Path Query . . . . . . . . . . . . . . . . . . . . . .

vi

53

55

58

List of Tables

vii

List of Figures

1.1 Two graphs (A) representing lo
ations and transport links, labelled with

transport modes (B) representing a part of the aquati
food
hain . . . . .

1.2 A NAND gate implementation in CMOS. . . . . . . . . . . . . . . . . . . .

1.3 Some Graph Models in Real World Appli
ations . . . . . . . . . . . . . . .

1.4 Some Typi
al Regular Expression Patterns . . . . . . . . . . . . . . . . . .

2.1 Truth table for NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.2 Common Propositional Binary Operators . . . . . . . . . . . . . . . . . . .

2.3 Truth Table for Common Propositional Binary Operators . . . . . . . . . .

3.1 A Labelled Graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.2 A simple exists-path query . . . . . . . . . . . . . . . . . . . . . . . . . .

3.3 Results of the query in gure 3.2 . . . . . . . . . . . . . . . . . . . . . . . .

3.4 A query involving two exists-path sub-expressions under logi
al
onjun
tion, and its exe
ution result . . . . . . . . . . . . . . . . . . . . . . . . . .

3.5 A query involving the all-paths expression and its exe
ution result . . . .

5.1 A Typi
al CAD Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.2 Two Netlists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.3 Dierent Kinds of Netlists . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.4 Overview of the NMS System . . . . . . . . . . . . . . . . . . . . . . . . . .

5.5 Query to print all nets belonging to a
y
li
path not passing through a
ip-
op.

5.6 Query to print all the internal nets in a netlist. . . . . . . . . . . . . . . . .

5.7 Query to print all su
h nets that are not rea
hable from a given net through

FET
hannels in a transistor netlist. . . . . . . . . . . . . . . . . . . . . . .

6.1 A graph
ontext
onstru
ted for CNF-sat. . . . . . . . . . . . . . . . . . . .

6.2 An NFA interpreted from a CNF expression. . . . . . . . . . . . . . . . . .

viii

2

4

15

16

23

23

24

28

28

29

30

31

35

39

40

47

50

51

51

55

56

Chapter 1

Introdu
tion

Here we present a study on and a tool for querying and lo
ating patterns in labelled graphs.

It may be useful in appli
ations where (1) labelled graph stru
tures
an be asso
iated with

or inferred from the domain of appli
ation and (2) it makes sense to be able to lo
ate and

manipulate interesting portions of those graphs. For the unfamiliar readers, a graph is

an network-like stru
ture that represents some kind of
onne
tivity between some entities

of interest. Many real life situations
an be
onveniently expressed by network diagrams.

For example, in trying to work out a travel plan we
an represent lo
ations (eg.
ities)

by points and join
ertain pairs of those points by lines representing dire
t transport links

(Fig. 1.1(A)). We may annotate the lines with the transport modes available, and possibly

with a lot of other details like distan
e,
ost et
. As another example, in modelling a food

hain, we may represent ea
h
onsidered spe
ies as a point and join pairs of points with

arrow-headed lines su
h that the spe
ies represented by the point at the arrow-head is a

food to the spe
ies represented by the point at the arrow-tail (Fig. 1.1(B)). Mathemati
al

abstra
tion of su
h diagrammati
representations are
alled graphs. In su
h point and line

diagrams, a
on
eptional point is
alled
alled a vertex and a line is
alled an edge. We will

ome to their formal denitions in an abstra
t setting later. Graphs
an represent a very

wide range of situations and are
ommonly used in the design and analysis of engineering

systems. When a graph represents a large entity, nding and fo
ussing on a small and interesting part of the graph is often useful. For example when the graph represents a designed

artefa
t like an ele
troni
ir
uit or a program, lo
ating or even testing the presen
e of a

spe
ied pattern in it
an help in navigating, verifying or possibly debugging the design.

This tool borrows ideas from some household unix tools like awk,sed and lex, and we intend

to provide a similar level of usability as these great forerunners, but unfortunately it
an

not be introdu
ed very readily. In the book dening awk, The Awk Programming Language,

by Alfred Aho, Brian Kernighan and Peter Weinberger [41℄ , the authors start the rst

1

2

Figure 1.1: Two graphs (A) representing lo
ations and transport links, labelled with transport modes (B) representing a part of the aquati
food
hain

se
tion with examples. It was possible be
ause the information model that awk a
ts upon

is a stream of
hara
ters or a
ommon text le, whi
h is so familiar to the target audien
e

that it requires little introdu
tion. In our
ase, even if we expe
t the target audien
e to be

familiar with graphs, there exists no su
h
ommon representation of graphs (unlike text)

that we
an readily use in an introdu
tory example. Indeed graphs
an be asso
iated with

many
ommon databases and information models, but to introdu
e a fully running example,

some detailed explanation is required about
onguring the tool for the appli
ation, whi
h

we will
ome to at a later stage. So a fully working example is not possible at this stage.

Instead we shall provide a few high level examples, without bothering about the details of

how the example will be integrated with the appli
ation data. As a rst example, let us

assume that we have somehow plugged our graph query mat
hing tool into the transport

links graph (Fig. 1.1(A)) and want to pose the following query : whi
h pairs of lo
ations

are
onne
ted by one or more aeroplane
ights and also by a
ombination of heli
opter and

ferry rides. This translates to the following pattern spe
i
ation (the leftmost
olumn is a

line number and not a part of the query).

1: (and

2:

(exists-path (x y) (aeroplane +))

3:

(exists-path (x y) ([heli
opter ferry℄ + ) )

In the query, the symbols x and y in lines 2 and 3 represent

**two variables about whi
h
**

the query spe
ies some
onstraints. There are two
onstraints about x and y in lines 2

and 3; the rst one says that there exists a path from x to y whose label sequen
e satises

the regular expression (aeroplane + ), i.e. is
omposed of one or more edges with an

3

label. The + is the positive
losure symbol of usual regular expressions. In the

se
ond
onstraint we state that there exists a path from x to y whose label sequen
e satises

the regular expression ([heli
opter ferry℄ + ), i.e. the path is
omposed of one or more

edges labelled with either heli
opter or ferry. The square bra
ket [heli
opter ferry℄

has similar sense as
hara
ter
lasses of usual regular expressions. The "and" in line 1 is a

logi
al
onne
tive that further enfor
es that the
onstraints in lines 2 and 3 must both hold

for x and y.

As another example, for a food
hain (like in Fig. 1.1(B)) let us pose a query to identify

ompeting spe
ies - i.e. the ones who share a prey.

aeroplane

1: (exists (z)

2:

(and

3:

(exists-path (x z) (true))

4:

(exists-path (y z) (true))

5:

(not-equal (x y)) ))

In this
ase, the regular expression (true) is used, in whi
h the label true is a spe
ial

one and holds on any edge, by denition. Here the regular expressions are trivial - any

single edge satises the expression (true). This query, when applied on the food
hain

graph,
onstrains the variables x and y in su
h a way that for some spe
ies z, both x and y

must be a dire
t predator to z, and also x and y are dierent. With a slight modi
ation

(by inserting line 6 in the following) we
ould ask as to whi
h pairs of spe
ies
ompete (i.e.

share a prey) yet one preys on the other.

1: (exists (z)

2:

(and

3:

(exists-path (x z) (true))

4:

(exists-path (y z) (true))

5:

(not-equal (x y))

6:

(exists-path (x y) (true)) ))

**Please note that we use the logi
al
onne
tives like "and", "or" et
. in prex syntax
**

(unlike their inx usage in the literature and algol family languages), we do this to prevent

unne
essary ambiguity (as is usually resolved by pre
eden
e spe
i
ations) and for e
onomy

of expression.

Another
onvenient aspe
t of the design is that it allows user dened predi
ates involving

any number of variables. These may be seen as hyper-edges in the graph. We will illustrate

this feature with an example. Consider an appli
ation s
enario where the user denes two

4

**Figure 1.2: A NAND gate implementation in CMOS.
**

predi
ates pmos and nmos over the nets in a transistor
ir
uit database, where the predi
ate

pmos, in the notation (upred pmos (x y z)), is true for the three nets x,y and z, that

ontain the gate, drain, and sour
e terminals respe
tively of a pmos eld ee
t transistor.

Similarly dened is the nmos predi
ate for nmos transistors. Following is a query that

mat
hes instan
es of the sub
ir
uit in gure 1.2. Here the keyword upred signies that it

is a user-dened predi
ate.

1: (and

2:

(upred nmos (x1 mid gnd))

3:

(upred nmos (x2 mid out))

4:

(upred pmos (x1 out vdd))

5:

(upred pmos (x2 out vdd))

6:

(all-distin
t (x1 x2 out mid gnd vdd) ))

**The above query's resemblan
e of a textual netlist des
ription formats is noteworthy. This
**

entails that a textual netlist des
ription
an be easily transformed into a query using minor

text transformations. As yet another example, the following query mat
hes all instan
es of

omplete graphs of size 4 in a graph.

1: (and

2:

(exists-undire
ted-edge

3:

(exists-undire
ted-edge

4:

(exists-undire
ted-edge

4:

(exists-undire
ted-edge

(x1

(x1

(x1

(x2

x2))

x3))

x4))

x3))

5

5:

6:

7:

**(exists-undire
ted-edge (x2 x4))
**

(exists-undire
ted-edge (x3 x4))

(all-distin
t (x1 x2 x3 x4)))

It should also be noted that for lo
ating a subgraph of interest, it is not always ne
essary to pose an fully unambiguous query. This is similar to the
ase with nding mat
hes in

a text where, for example, sear
hing for the pattern "namb" is enough for lo
ating the word

"unambiguous". Su
h pragmati
tri
ks may often help redu
e the
osts of query exe
ution.

We imagine that this kind of a system will be quite useful in lo
ating interesting or ex
eptional patterns in
ir
uits and system des
riptions.

The syntax and semanti
s of the input language for the tool will be elaborated later on in

this thesis. In a mi
ro-gist, the language in
ludes the following.

1. Constru
ts for interfa
ing a database with this query framework

2. Constru
ts for spe
ifying the semanti
s of the basi
propositions or labels (eg. aeroplane

or heli
opter in an aforementioned example)

3. The query proper with (a) logi
al
onne
tives (eg. and, or, not, exists, forall

et
.) and (b) base predi
ates (eg. exists-path, not-equal, exists-edge et
.).

It is quite
onvenient to name anything that we must refer to several times, so we name

this tool and the language as SQUARE (whether standing for Stru
tural QUery And

REasoning or not). In the following se
tion we
ontinue with a PR or mass-media style

general introdu
tion to the work, it is not te
hni
ally informative but may have a slight

amusement value.

**1.1 A PR-style Introdu
tion
**

A pattern is a
ompa
t des
ription of a set of obje
ts or observations. When we try to relate

some disparate observations, we often look for a
ompa
t des
ription of all of them. This

is
alled the a
t of nding a pattern. Almost all animals exhibit the behavior of nding

patterns in their observations and a
ting a
ordingly. Perhaps the simplest pattern is an

ante
edent-subsequent pair, whi
h brie
y des
ribes several observation instan
es in whi
h

an instan
e of the subsequent follows an instan
e of the ante
edent. When patterns inferred from noted observations apply to new and future observations, it's predi
tive power

an be of great advantage. For example, re
ognition of the patterns of predator advan
e,

prey proximity, mating possibilities, weather phenomena et
. are
ru
ial to the survival

6

in most animals. Learning and intelligent behavior manifests as nding, remembering and

appli
ation of patterns. Human beings are good at it. For example we have found a single

ompa
t des
ription (or pattern) for apparently widely disparate phenomena like falling of

a fruit and the motion of the planets. In summary, nding patterns is extremely important.

We do it for our survival.

There is yet another a
tivity that has set us ahead of other fellow life forms - that of building

and using tools. Starting with
rude hunting bludgeons we have
ome to the point of hoping

to build tools that will relieve us from all work ex
ept the ones done for sheer pleasure.

The sophisti
ation of the tools we use, be it thought tools or physi
al tools, has been ever

in
reasing and this aspe
t is what sets us widely apart from our primates and an
estors.

Having understood the fundamental importan
e of pattern nding and tool making, it be
omes obvious that developing a tool that aids in nding patterns, is a noble undertaking.

We have tried to do exa
tly that for some time, and this thesis is an attempt at disseminating the design and ndings.

Pattern dis
overy is a
reative pro
ess, and we have not had mu
h su
ess in me
hanizing

it, but it is easy to me
hanize the a
t of
he
king whether a hypothesized pattern o
urs

in a set of observations or obje
ts. We present a tool that enables us to nd or lo
ate the

o
urren
e of a spe
ial kind of patterns in a spe
ial kind of obje
ts. Neither the kind of

pattern, nor the kind of obje
ts we deal with, is novel, but there is some novelty in the

pra
ti
al details of usability and extensibility of the tool.

1.2 Motivation

A very naturalisti
approa
h to design or des
ribe obje
ts is to view them in terms of their

parts and the relationships between parts. Su
h a des
ription is referred to as stru
tural. A

lass of problems asso
iated with stru
tural des
riptions is to lo
ate or possibly just dete
t

presen
e of
ertain patterns within stru
tures. For the purposes of this thesis we
all this

lass of problems stru
tural reasoning or stru
tural querying.

The stru
tural des
riptions
an very often be represented by attributed relational graphs, in

whi
h the elementary entities are represented by verti
es, and the relationships between su
h

entities, by the edges of the graph. Unary features asso
iated with ea
h entity are modelled

by vertex attributes and binary features asso
iated with relationships are modelled by the

edge attributes. Su
h attributed graph stru
tures are en
ountered in several engineering

domains and appli
ations, and in many
ases it helps to be able to query them or reason

about them very well. The following subse
tions show how helpful su
h reasoning
an be.

7

1.2.1

Debugging and Verifying Netlists

Cir
uits, when des
ribed in terms of
onne
tions between stru
tural
omponents, are
alled

netlists. In the
ontemporary te
hnology of very large s
ale integration (VLSI) of
ir
uits,

netlists are most often
ompiled (i.e. generated) me
hani
ally from higher level abstra
tions

by software tools popularly known as sili
on
ompilers. Corre
tness of thus generated

netlists (with respe
t to spe
i
ation) may be assumed if the
ompilation pro
ess is assumed

orre
t, whi
h is arguably not yet the
ase with the
urrent level of maturity of sili
on

ompilers. Moreover as we are moving
lose to the physi
al limits of the devi
e te
hnologies

the engineers are using more and more
ustom optimization (manual pla
ement et
.) to

get the most out of the available devi
e te
hnologies. What transpires of this is that the

utting edge designs are usually
omplex assemblies of hand
rafted designs, standard
ells,

ma
ro
ells and
ells generated by sili
on
ompilers. Moreover, the
o-existen
e of analog

and digital
ells on single
hips (typi
al in systems on
hip), requires
ustom hand
rafting

thereby invalidating the assumption of
orre
tness by me
hanized
ompilation.

Thus veri
ation and debugging of
ir
uits remains to be an important a
tivity in ele
troni

ir
uit design pro
esses. A signi
ant
omponent of stru
tural debugging and veri
ation

a
tivity involves spe
ifying and mat
hing interesting patterns in netlists. We illustrate some

ontexts where stru
tural queries on nelists
an be quite useful.

**A dynami
CMOS te
hnique named NORA [48℄ requires that there should be no path
**

through stati
CMOS gates from the outputs of a -C2MOS gate to the inputs of a

-n-dynami
or a -p-dynami
blo
k.

Some design styles disallow PMOS transistor hannels onne ted to VSS or NMOS

hannels
onne
ted to VDD. In a netlist extra
ted from layout a violating
onguration may
onne
t an NMOS
hannel to VDD through a resistive path, whi
h needs

to be dete
ted.

Be ause of the layout pra ti e of transistor folding, a single transistor in a s hemati

**an be implemented as several parallel transistors in a layout, and the extra
tor may
**

infer additional passive devi
es between parallel transistors. For a layout vs s
hemati

(LVS) veri
ation to su
eed, su
h variations need to be lo
ated and reasoned about.

It is a violation of CMOS design rules to use a net that does not have a path to VDD

**through PMOSFET
hannels, as input to any gate. Possibility of its violation may be
**

ruled out in a design involving library
ells but in hand
rafted layouts it is possible

to o
ur as a result of erroneous design.

8

**Combinational
y
les are prohibited in most design styles. It is often of interest to
**

he
k a gate level netlist for
y
les that don't pass through
ip-
ops.

**In testing, it is often of interest to determine the input
one of a net, i.e. the
olle
tion
**

of nets that have signal paths to that net.

Sometimes improper hold violation onstraints make the synthesis tool introdu e long

**serial
hains of buers and/or inverters in the netlist to introdu
e large delays. All
**

onstraints get satised that way and it is impossible to lo
ate them by looking at the

s
hemati
but they slow down the
ir
uit unne
essarily. Custom stru
tural reasoning

an help lo
ating them.

For larger designs it's virtually impossible to run analog simulation. Event based and

**y
le a
urate fun
tional simulators (like Verilog, Cy
lone VHDL, IRSIM et
.) are
**

fast enough but work only for digital abstra
tions. Nominally digital
hips may have

analog sub
ir
uits like sense ampliers that
an not be handled by digital simulators.

But if the sense amplier blo
ks
an be lo
ated and repla
ed by inverters (or other

digital gates equivalent for the purpose of digital simulation) then the
ir
uit
an

be handled by digital simulators, while preserving the fun
tional properties. This

requires stru
tural reasoning about netlists.

The netlist stru
ture is quite amenable to be represented as attributed graphs and problems

similar to the above are very well addressed by querying su
h graphs, as will be elaborated

later in this thesis.

1.2.2

Debugging and Verifying Sequential Systems

**Behavior of sequential systems is very often des
ribed in terms of a nite state ma
hine
**

(FSM), whi
h is an abstra
t model
onsisting of a nite set of states and a transition

relation between states[9℄. Contemporary VLSI systems are
ommonly designed at this

level of abstra
tion. Design of large sequential systems, as typi
al of VLSI systems, is a

omplex task and is liable to human errors, but the e
onomi
s and the safety
riti
ality

of the appli
ations di
tate that the
ost of su
h errors
an be extremely high. In order

to redu
e the
han
es of su
h errors' appearing in the nal produ
ts, it is ne
essary, as is

observed in
ommer
ial design pro
esses, that a major eort is made towards verifying the

designs before they are mass produ
ed or deployed. The predominant veri
ation method

is that of simulation, in whi
h the system is simulated and the simulation tra
e is
he
ked

for
orre
tness against some spe
i
ations. For non-trivial systems, the
omplete spa
e of

behaviors is so large that any reasonable amount of simulation
an
over only a small part

9

of the spa
e, hen
e this method
an not make any hard guarantees of
orre
tness. Alongside

simulation, there is another approa
h to veri
ation whi
h is
lassied as formal veri
ation

and is aimed at providing hard guarantees or proofs of
orre
tness. Among the many formal

veri
ation methods, Model Che
king, is gaining popularity due to its s
alability to fairly

large designs. In this approa
h the
omplete system tra
e is formally veried against some

stru
tural spe
i
ations. There are some tiny languages for spe
ifying patterns of trees,

paths and subgraphs that
an be mat
hed in some way on labelled graphs inferred from

FSM des
riptions. CTL, QCTL, WQCTL, CTL*, LTL and regular expression are to name

a few su
h languages [6, 7, 11, 10, 12, 26, 28℄. The FSM is abstra
ted as a labelled graph

and the desired properties are modelled as patterns in those little pattern languages so that

mat
hing the patterns with the graph is equivalent to
he
king the properties. This is yet

another example s
enario where good ways of querying attributed graphs
an be helpful to

mankind.

1.2.3

Analyzing Engineering Drawings

**An important problem is that of extra
tion of fun
tional information from engineering
**

drawings automati
ally. There is a huge lega
y of engineering drawings that are stored

as ve
tor graphi
s data (typi
ally as a set of line segments and text) but devoid of any

fun
tional or semanti
annotation. Su
h drawings have traditionally been meant for human

interpretation. Many re
ent appli
ations need more stru
tured and annotated des
riptions

of obje
ts represented by su
h drawings. Su
h stru
tured des
ription
an be inferred or

extra
ted from the the geometri
data in the drawings through stru
tural reasoning.

The interse
tion points and end points of the line segments in the drawings
an be viewed as

verti
es, and the segments themselves
an be viewed as edges of an indu
ed stru
tural graph.

Their geometri
properties
an lead to a ri
h set of attributes. Alternatively a
onstrained

DeLaunay triangulation of the drawing (with the original segments as
onstraints) may

be
onstru
ted, for whi
h ea
h triangular
ell may indu
e a vertex and the
ell adja
en
y

relation may indu
e the edges of a graph. This stru
ture too is ri
h in geometri
attributes

that
an be used in pattern spe
i
ation and re
ognition.

1.2.4

Feature Re ognition in Solid Models

**The boundary representation of solid models have an inherent graph stru
ture
onsisting
**

of its fa
e elements whi
h
an be viewed as verti
es, and the adja
en
y relation among fa
e

elements whi
h
an be viewed as edges. Many interesting attributes
an be asso
iated with

10

this graph. Several elementary geometri
properties like edge length, fa
e area, edge
onvexity, edge angle, number of
onvex-
on
ave transitions along a fa
e boundary et
. are some

interesting primitive attributes and
onstitute a ri
h alphabet for des
ribing features. Feature re
ognition is important be
ause a mere boundary represented solid des
ription does

not dire
tly provide the information required in many appli
ations. For example, manufa
turing pro
ess design would require identi
ation of lo
al protrusions and depressions

whi
h
an in prin
iple be inferred from the boundary representation but through feature

re
ognition.

1.2.5

Opti al Shape/Chara ter Re ognition

**Low level features
an be extra
ted from an image through edge dete
tion and ve
torization.
**

These low level features
onstitute the elementary obje
ts (or verti
es) and a neighborhood

relationship gives rise to the edges of a graph stru
ture. The properties of the feature obje
ts and their neighborhood relationship dene the set of primitive attributes of the graph

elements. The problem of re
ognition of
hara
ters or shapes in the original image may thus

be redu
ed to identi
ation of subgraphs of the extra
ted attributed graph that
onforms

with some designed stru
tural spe
i
ation (possibly expressed as a grammar).

The number of appli
ations of stru
tural querying has been growing steadily over the

past few de
ades through identi
ation of new areas, through in
reases in viability and

s
alability with the in
rease in
omputing power and through algorithmi
improvements.

The following are to name a few more (1) ngerprint re
ognition (2) spee
h re
ognition (3)

remotely sensed data analysis (4) biomedi
al data analysis in
hromosome images,
artoid

pulse waves, EEG signals et
. (5) texture analysis (5) spark
hamber pi
ture analysis and

(6) geophysi
al seismi
signal analysis.

Graph based modelling is one of the main modes in whi
h dis
rete mathemati
s has been

applied to real world problems. A multitude problem domains have been mapped to labelled

graph models and and several of them
an benet from this ni
e query tool. Figure 1.3 is

a table of many su
h instan
es of graph based modelling (ex
eprted from [62℄).

**1.3 Data Model for SQUARE
**

The SQUARE framework is primarily about querying labelled graphs. Querying graphs is

an industrially important problem and therefore has re
eived plenty of resear
h attention.

[17, 16, 19℄ present several pie
es of work along dierent dire
tions towards this problem.

On similar lines, this work proposes a new tool and approa
h for querying labelled graphs,

11

whi
h will hopefully be useful in several
omputing appli
ations.

To query is a transitive verb and the obje
t of querying is broadly
alled its data model,

at least for our purposes here. Query languages have a taxonomy not only based on the

data model they a
t upon, but there is also a diversity of style and power. For example, the

languages for querying text do
uments range from spe
ifying some words to sear
h for, to

advan
ed sear
h options like boolean expressions over words, to regular expressions over the

hara
ter set, to parsing a do
ument for re
ognizing its stru
ture. Su
h is the diversity for

just one parti
ular data model, that of text, that simply
omprises a sequen
e of symbols.

There are a number of abstra
t data models with their own kindred query languages. Of

spe
ial importan
e among them is that of the relational data model whi
h is very su
essful

and
ommer
ially ubiquitous. Mu
h of its su
ess
an be attributed to its simpli
ity whi
h

has ultimately led to mass
omprehension and a
eptan
e, further promoted by the presen
e

of a simple non-pro
edural query language. Sin
e its in
eption, the relational data model

has had two main query languages of equivalent expressive power - relational
al
ulus and

relational algebra. Expressive power is loosely a measure of the extent of query semanti
s

that is supported by the language. There is no formal metri
for measuring expressive

power but there is a partial order - if a language L1
an express the semanti
s of all queries

expressible in another language L2 , then L1 is said to be at least as expressive as L2 . For

example, for the symbol stream data model, the regular expression language is at least as

expressive as substring and glob pattern query languages, but not the vi
e versa. For the

relational model any query language that is at least as expressive as relational algebra or

relational
al
ulus is said to be relationally
omplete. Relational
ompleteness is adequate

expressive power for several appli
ations but not for all. For example, relational
al
ulus or

algebra does not support any form of re
ursive query. Several appli
ations of the relational

data model
all for more expressive query languages, thereby
alling for either ad ho

pro
edural programming solutions or formal ones like Datalog[18℄.

The SQUARE language has primary fo
us on the graph data model, whi
h is a subset of

the relational data model in the sense that a graph is equivalent to a homogeneous binary

relation. However, the result of a SQUARE expression has the denotational semanti
s

of an n-ary homogeneous relation. There is also provision for user dened predi
ates of

several parameters, whi
h in turn may indu
e relations of any arity in the query expressions.

Thus the data model that
an be queried using SQUARE is that of arbitrary homogeneous

relations, not just graphs.

12

**Indeed all relations in any obje
t database
an be seen as homogeneous if all the
**

obje
ts are treated as instan
es of a fundamental super-type, and type spe
ializations

appear as spe
ial predi
ates. Thus the homogeneous qualier of SQUARE's data model

is not restri
tive and SQUARE
an a
tually be used to query any obje
t database.

However its
apability is best utilized when the database has graph like semanti
s.

We use an approa
h in whi
h the query language is fairly independent of the underlying

data, i.e. the spe
i
s of the underlying data is handled by
ode generated from the query

and by the appli
ation spe
i
interfa
e
ode provided by the user.

1.4 Qui
k Overview

The SQUARE framework is a system (i) whi
h enables ee
tive stru
tural querying of

attributed graphs, (ii) whi
h is easily
ustomizable to various appli
ations, and (iv) s
ales

well to very large problem sizes. It in
ludes the design of a query language and its evaluator.

The system has some predisposition towards appli
ations of querying
ir
uits and nite

state ma
hines, however the
ore semanti
model of the query language
omprises simple

orthogonal
on
epts with no ontologi
al
ommitment to any spe
i
domain. Appli
ation

spe
i
ustomizations are done through embedded
ode, in a way similar to the use of the

C-
ode generating unix tools like lex and ya
. It is hoped that this tool will nd more

appli
ations than
on
eived now.

Let us get down to business through some examples for a qui
k overview of what is in it for

you.

A basi
set of query expressions are based on mat
hing paths in a labelled graph, satisfying

a given regular expression. The alphabet of the regular expressions are propositions over the

edges of the graph. The
on
ept of propositions or labels is slightly dierent from that of

the attributes mentioned in the pre
eding se
tions. In the pre
eding se
tions we mentioned

attributed graphs, for whi
h attributes are of dierent data types. Labels are attributes of

boolean type, i.e. labels or propositions are either true or false. For example if length is

an attribute of type real number, longerT han12 (length > 12) is a label. When we say

that an edge is labelled with a proposition, we mean that the proposition evaluates to true

on that edge.

The propositions are atomi
labels on the edges, possibly dened in terms of edge attributes

or attributes of the sour
e and sink verti
es of the edge. The propositions are referen
ed in

the query expressions by their name. A query is a
omposition of several primitive query

13

expressions, ea
h of whi
h may
ontain some variables. Ea
h query expression is a predi
ate

over its variables and denotes the bindings of its variables for whi
h the predi
ate evaluates

to true. For example, the following primitive subexpression indi
ates bindings of all su
h

pairs of nets (in a netlist) to the variables x and y, for whi
h there exists a path in the

ir
uit graph satisfying the regular expression (drain to sour
e * sink is vdd). Here

drain to sour
e and sink is vdd are atomi
propositions, and '*' is the usual Kleene

losure operator of regular expressions [9℄.

(exists-path (x y) (drain_to_sour
e * sink_is_vdd))

**As another example, the following expression involving just one variable x denotes all su
h
**

bindings to x that has a self rea
hable path through edges from input pins to output pins,

(relevant in a gate level netlist). The '+' in the expression is the positive
losure operator of

regular expressions [9℄. A non-empty resulting set of bindings obtained on a netlist for the

following expression will indi
ate the presen
e of a
ombinational loop.

(exists-path (x x) (in_to_out +))

**The proposition in to out is so dened that only the edges from input to output pins
**

are labelled with it. The regular expression part
an be very expressive in spe
ifying path

patterns. Some typi
al patterns that may be very useful are listed in Figure 1.4.

The query subexpressions, as has been illustrated,
ontains variables. A
omplete query is

a
omposition of several basi
subexpressions
onne
ted by relational
al
ulus
onne
tives

like logi
al operators AND,OR,NOT et
. and quantiers over variables in subexpressions.

For example,

(and <subexpression 1 involving variables x y z>

<subexpression 2 involving variables w v x>

<subexpression 3 involving variables u y z> )

indu
es all bindings of variables u,v,w,x,y and z for whi
h all predi
ates in the subexpressions 1,2 and 3 evaluate to true.

If the
onne
ting operator in the above expression was or instead of and, then the indu
ed

bindings would be su
h that at least one subexpression is true.

The semanti
s of quanti
ation is identi
al to that in the domain relational
al
ulus and

rst order logi
. The variables that are quantied are said to be bound and do not generate

bindings in the overall expression. A variable that is not bound, i.e. whose o
urren
e is

not within the s
ope of a quantier that quanties it, is
alled
alled a free variable.

For example the expression

(exists (x) <subexpression involving x,y and z>)

14

has only y and z as its free variables, and the semanti
s of quanti
ation eliminates the

s
ope of the bound variable x in any outer expression, of whi
h the above expression is

a subexpression. The same variable symbol may appear in any outer expression but it

is treated as a dierent variable from that inside the quantifying subexpression. In the

above, we mentioned a query primitive whi
h
omputes whether there exists a path between

two given verti
es, with the string of edge labels satisfying a given regular expression.

Complementary to this, there is another query operator that
omputes whether all possible

paths between two given verti
es satisfy a given regular expression. SQUARE in
ludes

primitive expressions of
omputational tree logi
(CTL), for whi
h the queried graph is

interpreted as a Kripke Stru
ture, whi
h is a nite folded model of an innite tree (to be

elaborated in a subsequent
hapter). Finally, for ea
h query, one
an spe
ify some a
tion to

be performed for ea
h satisfying assignment of the free variables. This aspe
t is similar to

that of awk. There are three a
tion
ode blo
ks, one is
alled at the beginning of the mat
h

pro
ess, another is
alled on ea
h satisfying assignment of the query, and the nal one is

alled after all the satisfying assignments have been traversed.

**1.5 Layout of the Thesis
**

Chapter 2 presents some mathemati
al notation and denitions that will help in expressing

the remaining thesis. Chapter 3 presents the SQUARE language in detail.

Chapter 4 presents the interfa
e of SQUARE as require for integrating appli
ations.

Chapter 5 des
ribes a full blown appli
ation of SQUARE to query and manipulation of

netlists.

Chapter 6 des
ribes the implementation of square in
luding the algorithms used and their

omplexity analysis.

Chapter 7 presents some performan
e data about SQUARE.

Chapter 8
on
ludes the thesis with a dis
ussion on the pros and
ons of the presented work

and outlines the s
ope for future work.

15

**Subje
t Area and Appli
ation
**

omputer programming

ow
harts

so
ial organization

so
ial networks

ivil engineering

road networks

operations resear
h

s
heduling

so
iology

hierar
hi
al dominan
e

omputer programming

subprogram
alling diagram

e
ology

food webs

operations resear
h

s
heduling

genealogy

family trees

probabilisti
analysis

Markov models

traÆ
ontrol

assigning one-way streets

omputer engineering

ommuni
ations networks

operations resear
h

transportation networks

postal delivery routing

Chinese Postman Problem

information theory

Gray
odes

radio broad
asting

assignment of frequen
ies

hemistry

preventing explosions

artography

map-
oloring

ele
tri
al network boards

avoiding insulation

VLSI
omputer
hips

minimizing layering

omputer operating systems

priority trees

physi
al
hemistry

ounting isomers

Human resour
es management

personnel assignment

**Meaning of Verti
es and Edges
**

vertex labels are program steps

edge dire
tions show
ow

verti
es are persons

edges represent intera
tions

verti
es are road interse
tions

edges are roads

verti
es are a
tivities

edges show operational pre
eden
e

verti
es are individuals

edges show who reports to whom

verti
es are subprograms

edges show
alling dire
tion

verti
es are spe
ies

edges show who eats whom

verti
es are a
tivities to be s
heduled

edges are a
tivity
on
i
ts

verti
es are family members

edges show parenthood

verti
es are pro
ess states

edges are state transitions

verti
es are interse
tion

edges are streets

verti
es are
omputational nodes

edges are
ommuni
ations links

verti
es are supply and demand nodes

edges are supply lines

verti
es are street interse
tions

edges are streets

verti
es are binary strings

edges are single-bit
hanges

verti
es are broad
ast stations

edges are potential interferen
e

verti
es are
hemi
als

edges are
o-
ombustibility

regions are
ountries

edges are borders

verti
es are
ir
uit
omponents

edges are wires

verti
es are
ir
uit
omponents

edges are wires

verti
es are prioritized jobs

edges are priority relations

verti
es are atoms

edges are mole
ular bonds

verti
es are people and jobs

edges are job-
apabilities

Figure 1.3: Some Graph Models in Real World Appli ations

16

Expression

Informal Meaning

p is true on all the edges of the path.

(((:r *) or [:p r℄ * ) p true *)

**p holds on some edge on the path.
**

before r holds.

p is true on all edges of the path after

q holds.

p is true on some edge of the path.

(p *)

( (:q *) (q (p *)) ?)

( (:p) * p true *)

**path
ontaining 3
onse
utive edges
**

with label p.

(:p * p p)

the rst o
urren
e of p-edge on the

path is followed by another p-edge.

is inv :is inv * is inv) * )

the path
ontains an even

number of inverters

Figure 1.4: Some Typi
al Regular Expression Patterns

(true * p p p true *)

( (:is inv *

Chapter 2

**Mathemati
al Tools and Notations
**

The semanti
s of SQUARE is based on a number of ideas borrowed from dis
rete mathemati
s and theoreti
al
omputer s
ien
e. These ideas are best expressed through a set of

spe
ially dened terms and
on
epts. This
hapter attempts to outline the denitions of

several su
h terms that will help in the subsequent dis
ourse. These notations will be useful

in expressing the express the subsequent se
tions ee
tively.

**2.1 Stru
tures : Sets, Tuples, Strings, Relations and Fun
tions
**

The
on
epts of set theory are so fundamental that it forms the basis language for most

bran
hes of s
ien
e. Readers totally unfamiliar with set theory are advised to look up a

textbook on the subje
t. Intuitively, a set is any well-dened list or
olle
tion of obje
ts.

The obje
ts
omprising the set are
alled its elements or members. The statement x is an element of a set S or, equivalently, x belongs to S is denoted by x 2 S .

The negation of x 2 S is written x 2= A, whi
h reads x is not an element of S . Sets

are represented in several ways. These representations
an be broadly
lassied into two enumerative and non-enumerative. In the enumerative way, one lists all the members

of the set. For example, S1 = f2; 5; 7g is an enumerative spe
i
ation of a set whose

members are the numbers 2, 5 and 7. In an enumerative representation, all the elements

are listed, en
losed in bra
es fg and separated by
omma. The non-enumerative way of

des
ribing is to state some properties whi
h
hara
terize the elements in the set. For

example, S2 = fxjx is a prime number and x < 10g whi
h reads S is the set of all x su
h

that x is a prime number and x is less than than 10, is su
h a spe
i
ation. Non enumerative

des
ription allows spe
i
ation of large and innite sets. When ea
h of the elements of a

set S1 belongs to another set S2 we say that S1 is a subset of S2 (or equivalently that

17

18

S2 is a superset of S1 ) and denote this statement by S1 S2 or S2 S2 . When two

sets have the same members (i.e. S1 S2 and S2 S1 ) then the two sets are said to be

equal (denoted by S1 = S2 ). The symbol for negation of () is * (+) and reads - not

a subset (superset) of. The number of elements of a set S is
alled its
ardinality and

is denoted by jS j. A null set (denoted as ;) is a set with no element, i.e. with
ardinality

**zero. A number of meaningful operations have been dened over sets. The most basi
ones
**

are that of union, interse
tion, dieren
e and
omplement. The union of two sets S1 and

S2 is dened as the set fxjx 2 S1 or x 2 S2 g, and is denoted by S1 [ S2 . The interse
tion

of two sets S1 and S2 is dened as the set fxjx 2 S1 and x 2 S2 g, and is denoted by

S1 \ S2 . Set dieren
e between S1 and S2 is fxjx 2 S1 and x 2= S2 g and is denoted by

S1 S2 . Denition of the
omplement operator requires the assumption of an universe of

dis
ourse - whi
h is the
omplete set of possible values that the elements of the sets under

onsideration
an have. We denote the universe of dis
ourse by U. The the
omplement of

a set S is U S and is denoted as S 0 . There is yet another operator
alled the symmetri

dieren
e, whi
h for two sets S1 and S2 is dened as (S1 S2 ) [ (S2 S1 ) and denoted by

S1 ./ S2 . The power set of a set S is the set of all its subsets and is denoted by 2S . This

notation arises from the fa
t that the power set of S has a
ardinality of 2jS j. Two sets are

said to be disjoint if their interse
tion is the empty set.

A few sets are so
ommon in usage that there are spe
ial symbols for them. Following are

a few su
h sets that will be en
ountered in this thesis.

**N : The set of natural numbers.
**

Z : The set of integers.

Z+0 : The set of all non-negative integers.

R : The set of all real numbers.

R+0 : The set of all non-negative real numbers.

A set does not have any implied order on its elements. Two set enumerations that dier

only in the order of appearan
e of the elements spe
ify two equal sets. Also there is no su
h

thing as multipli
ity of membership i.e. a set written as f1; 2; 3; 3; 4g is a
tually the set

f1; 2; 3; 4g. Diering espe
ially on these aspe
ts of ontology, is another mathemati
al entity

alled a tuple. A tuple too is a
on
eptional
olle
tion of obje
ts, but it has an implied

ordering on the members. Tuples are usually spe
ied in enumerated form. A tuple is an

ordered list of its members, and an obje
t may appear more than on
e in a tuple in dierent

19

positions. The set operations mentioned above are not normally appli
able on tuples. Similar to
ardinality of sets is the arity of a tuple, whi
h is the number of its elements. A tuple

with n elements is said to be of arity n or n-ary (as spe
ial
ases, 1-ary is
alled unary, 2ary is
alled binary, 3-ary is
alled ternary). A binary tuple is also
alled an ordered pair.

An n-ary tuple is often
onveniently
alled n-tuple. The parentheses (), is used for en
losing

the elements of a tuple (unlike the bra
es fg for sets). Ea
h member in a tuple has a xed

position. To refer to an element of a tuple, we may use an ordinal name of its position

(1st ; 2nd ; 3rd ; : : : ; nth et
.). For example, in a tuple (; ;
; Æ), its 4th element is Æ. Sometimes we asso
iate a s
hema with a tuple. A s
hema of a tuple is a meta-des
ription of the

tuple. A s
hema of an n-tuple T is another n-tuple whose kth element is a referring name

for the kth element of T . We illustrate this with an example. If H = (name, age, gender) is

the s
hema for two tuples T1 = (Peter Parker; 26; M) and T2 = (Mary Jane Watson; 25; F),

one
an refer to the elements of T1 and T2 by the element in the same position in H , eg.

age of T1 is 25, name of T2 is Mary Jane Watson et
. (a
ording to s
hema H, whi
h is

assumed by
ontext). A tuple that has an asso
iated s
hema is often
alled a re
ord, as

ommonly en
ountered in the parlan
e of databases.

Another
losely related
olle
tion obje
t is a sequen
e. A sequen
e is a tuple (i.e. an

ordered
olle
tion) , ex
ept that (1) we never view a sequen
e as a re
ord (i.e. there

is no s
hema), (2) their elements are in some sense similar and (3) we dene an additional operator on strings
alled
on
atenation. We use the angle bra
kets hi in the

notation to en
lose the elements of a sequen
e. If 1 = ha1 ; a2 ; a3 ; : : : ; am i and 2 =

hb1 ; b2 ; b3 ; : : : ; bn i are two sequen
es, their
on
atenation, denoted by 1 + 2 is the sequen
e

ha1 ; a2 ; a3 ; : : : ; am ; b1 ; b2 ; b3 ; : : : ; bn i. Analogous to
ardinality of sets and arity of tuples, is

the length of a sequen
e whi
h is the number of its elements. A sequen
e is often spe
ied

by a generating fun
tion, and is represented by a notation of the form hf (i) : i = 1 : : : ni.

Here the rst element of the sequen
e is f (1), the se
ond element is f (2) and so on till the

nth element. In this notation one
an spe
ify innite sequen
es too (eg. hi2 : i = 1 : : : 1i).

Next we dene another very important operation on sets whi
h
ould be dened only after

we have introdu
ed tuples. It's the
artesian produ
t of two sets. The
artesian produ
t

S1 S2 of two sets S1 and S2 is dened as:

S1 S2 = f(x1 ; x2 )jx1 2 S1 and x2 2 S2 g

**i.e. it is the set of all su
h binary tuples (ordered pairs) whose 1st element belongs to the
**

left operand S1 and whose se
ond element belongs to S2 . When we
ompute multi-produ
ts

by su
essive appli
ation of
artesian produ
t we get tuples of tuples in the produ
t set.

20

For example by denition of binary
artesian produ
t we have

(S1 S2 ) S3 = f((x1 ; x2 ); x3 )jx1 2 S1 and x2 2 S2 and x3 2 S3 g

In order to dene an asso
iative
artesian produ
t we
an
atten the the tuples in the

multi-produ
t (eg. write the 3-tuple (x1 ; x2 ; x3 ) instead of the tuple of tuples ((x1 ; x2 ); x3 )).

Thus a multi-produ
t of sets S1 S2 : : : Sn is dened to be

**f(x1 ; x2 ; : : : ; xn)jx1 2 S1 and x2 2 S2 : : : and xn 2 Sng
**

There is a spe
ial notation for
artesian produ
t of a set with itself - S S is written as

S 2 , S S S as S 3 and so on.

A relation between several sets S1 ; S2 ; : : : ; Sn is a subset of their
artesian produ
t S1

S2 : : : Sn . We refer to a relation by its name. For example if N is the set of all natural

numbers, one
an dene a binary relation named relatively-prime of N to itself as follows

**f(x; y)jx 2 N and y 2 N and x has no positive integer fa
tor other than 1
ommon with yg
**

This
learly is a subset of N N . For a tuple whi
h is a member of S1 S2 : : : Sn

to be a member of a relation R, its elements must satisfy some additional
onstraint that

denes the relation. When a tuple (x1 ; x2 ; : : : ; xn ) is a member of a relation R, we write

R(x1 ; x2 ; : : : ; xn ), or (x1 ; x2 ; : : : ; xn ) 2 R. For binary relations we often use a spe
ial inx

notation x1 Rx2 . The binary relation is espe
ially important to this work and we delve a

bit deeper into its notations and properties. Here we list a few qualiers for binary relations

of a set S to itself.

**A binary relation R is said to be re
exive - if (x; y) 2 R whenever x = y.
**

A binary relation R is said to be symmetri
if (x; y) 2 R implies that (y; x) 2 R.

A relation is
alled antisymmetri
if (x; y) 2 R and (y; x) 2 R implies that x = y

A binary relation is said to be transitive if (x; y) 2 R and (y; z ) 2 R implies that

(x; z ) 2 R.

If a binary relation is re exive, symmetri and transitive it is said to be an equivalen e.

**If a binary relation is re
exive, transitive and antisymmetri
, it is
alled a partial
**

order

21

**A binary relation R is
alled a total order if it is a partial order and for every tuple
**

(x; y) in S S , one of the three must hold (1) (x; y) 2 R, (2) (y; x) 2 R or (3) x = y.

Next we
ome to the nal major
on
ept of this se
tion - the fun
tion. A fun
tion may be

thought of as a spe
ial kind of binary relation. A fun
tion f is a binary relation between

two sets S and T su
h that for a member x of S there is exa
tly one entry (x; y) in f .

The two asso
iated sets S and T of the fun
tion f are
alled its domain and
o-domain

respe
tively, and the notation for writing that is f : S ! T . If (x; y) 2 f , y is
alled the

image of x under the fun
tion f . A fun
tion assigns exa
tly one image to every element of

its domain. If we slightly loosen this restri
tion by saying that some elements of the domain

may not have an image (i.e. for ea
h element x in S , if there is at most one entry (x; y) in

S ) then su
h a relation is
alled a partial fun
tion. When (x; y) 2 f , we use the notation

y = f (x). The set fyjy = f (x) and x 2 S g is
alled the range of the fun
tion f , whi
h

is a subset of its
o-domain (T ) and is denoted by the f (S ). Fun
tions have the following

ommon qualiers.

**A fun
tion f is surje
tive or onto if f (S ) = T . That is to say, for every y 2 T there
**

is at least one (x; y) 2 f .

A fun
tion is inje
tive or one-one if no two elements of S have the same image, i.e.

if f (x1 ) = f (x2 ), then x1 = x2 .

**A fun
tion f that is both inje
tive and surje
tive is
alled bije
tive.
**

For a set S1 whi
h is a subset of the domain S of a fun
tion f : S ! T , f (S1 ) denotes the

set fyjy = f (x) and x 2 S1 g and is
alled the image of S1 under f . Conversely, for a set T1

whi
h is a subset of the
o-domain T of f , f 1 (T1 ) denotes the set fxjf (x) 2 T1 and x 2 S g

**and is
alled the inverse image of T1 under f .
**

One may dene arity of a fun
tion depending on the
omposition of its domain. If the

domain set is a
tually an n-ary relation, then we
all the fun
tion to be n-ary. For a tuple

(x; y) belonging to a fun
tion f , we
all x the argument to f and
all y the returned

value of f . One parti
ular
lass of fun
tions is spe
ially important - it
onsists of the

ones for whi
h the domain is S n and the
o-domain is S for some set S . Su
h a fun
tion

f : S n ! S is
alled an operator of arity n (or n-ary operator) over the set S . We did

mention operator earlier in this se
tion, eg. while introdu
ing [, \, 0, ./ et
. of sets, well

before we
ame to dene it. In doing so, we bumped into the following
ir
ular denition.

Cartesian produ
t () is like an operator over the set of all sets (speaking stri
tly, the

set of all sets has some inherent
ontradi
tions and is assumed not to exist, but it doesn't

22

hurt to have the intuition of it). Then we
ame to dene relations as subsets of
artesian

produ
ts. Then fun
tion was dened as a spe
ial kind of relations, and nally operator is

a spe
ial
lass of fun
tions. In the former appearan
e of the
on
ept operator I pretended

the presen
e of the intuition that an operator is some gizmo that produ
es something out

of something (in those
ases it produ
es new sets out of sets.). The same intuition prevails

even after the formal denition. I hope a more
areful and rigorous des
ription
an avoid

this
ir
ular denition but I am ignoring it here as the
on
epts appear intuitively
lear.

Moreover indu
tive (re
ursive) denitions are perfe
tly alright in mathemati
s, but I don't

know whether this
ir
ular denition falls in that
ategory. It is quite intuitive to view a

fun
tion as a devi
e that a
ts upon the elements of its domain set and produ
es elements

of its
o-domain set, and for a given domain element, its appli
ation always produ
es the

same
o-domain element. The same intuition does well for operators ex
ept that operators

are more restri
ted in the
hoi
e of domain and
o-domain sets, in that the two have to be

the same set.

A fun
tion, by denition is a spe
ial
ase of a relation but is as expressive a stru
ture

as a relation. Any relation may represented by a fun
tion. For example, if R 2 A B C

is a relation and if a fun
tion f : A B C ! fT; F g is dened as f (z ) = T if z 2

R and otherwise f (z ) = F , then the fun
tion f expresses the same information as the

relation R. This shows that fun
tions and relations are expressively equivalent. This idea

will be used subsequently in en
oding relations as fun
tions (propositional fun
tions, to

be pre
ise)and symboli
ally manipulating a spe
ial representation (
alled binary de
ision

diagram) of the fun
tions to perform impli
it operations over relations. This
an be

elaborated further only after introdu
ing propositional fun
tions and binary de
ision

diagrams. The following se
tions will introdu
e these requisite
on
epts.

**2.2 Propositional Predi
ate Logi
**

Logi
deals with de
iding what
an inferred from a given set of fa
ts. Propositional logi
is

a mathemati
al stru
ture meant for study and manipulation of logi
al
onne
tions between

elementary fa
ts or statements. Elementary statements are expressions that are either true

or false but not both. Truth and falsehood may be seen as two arbitrary values represented

by symbols T and F that are dierent from one another, intuitively representing our everyday
onnotation of truth and falsehood respe
tively. Any statement in propositional logi

has exa
tly one truth value from the set B = fT; F g asso
iated with it. This set B is

alled the set of Boolean values. A few operators dened on the set B
onstitute logi
al

23

onne
tives for
omposing elementary statements into
ompound statements. Coming to

pin down the denitions, any statement that has an asso
iated truth value from the set B

is
alled a proposition. Propositions are either atomi
or
omposite. The truth or falsehood of an atomi
proposition is its intrinsi
property and is not subje
t to reasoning i.e. atomi
propositions are those statements that we do not analyze or de
ompose further

in propositional logi
. A
omposite proposition is made out of atomi
propositions and

logi
al
onne
tives, whi
h in turn are a few operators dened on the set B . We denote

atomi
propositions by arbitrary symbols (eg. P,Q,"Mars is red", "sky is green"). There

are a few operators dened on B whi
h are applied on propositions as if propositions are

variables representing their truth values. The most
ommon operators are AND (denoted

by ^), OR (denoted by _) and NOT (denoted by :). AND and OR are binary and NOT

is unary (1-ary). The domain set for the operators are so small that the operators
an be

spe
ied enumeratively yet
on
isely. Please note that by
onvention most authors use the

inx notation in whi
h the binary operator symbol is written between the two operands.

However in the syntax of SQUARE we shall use the prex notation in whi
h the operator

symbol pre
edes the operands. The unary NOT or negate (whi
h is an operator over B )

of a proposition p, is usually represented by one of the notations: :p, p, p0 , p or (NOT p).

The denition goes that :p is (or has a truth value) T if p is F , and is F when p is T . This

is usually written in the truth table from as in gure 2.1. The
ommon binary
onne
tives

p

:p

T F

F T

Figure 2.1: Truth table for NOT

are named in gure 2.2 and their fun
tional mappings given in gure 2.3.

operator

prex notation inx notation

meaning

onjun
tion

(AND p q)

p^q

both p and q are T

disjun
tion

(OR p q)

p_q

at least one of p and q is T

onditional (IMPLIES p q)

p)q

p implies q

bi
onditional (EQUIV p q)

p,q

p and q imply ea
h other

ex
lusive or (EXOR p q)

pq

exa
tly one of p and q is T

Figure 2.2: Common Propositional Binary Operators

24

p q p_q p^q p)q p,q pq

T T T

T

T

T

F

T F T

F

F

F

T

F T T

F

T

F

T

F F F

F

T

T

F

Figure 2.3: Truth Table for Common Propositional Binary Operators

TODO: Dene propositional variables, (boolean) fun
tions of variables, their representations (normal forms) and de
ision problems, introdu
e INF and BDD brie
y,

without going into algorithms. Viewing (BDD based) SAT solver as a powerful abstra
t

ma
hine.

**2.3 Graphs : Basi
Denitions
**

A binary relation may be represented by a boolean fun
tion of two variables. The assignments to the variables for whi
h the value of the fun
tion is true, are said to be members

of the relation. Binary relations are ni
ely representable by what are known as relational

diagrams. In a relational diagram there are two point sets, ea
h of whi
h represents elements of M. If an element x is related to an element y then an arrow is pointed from the

point representing the element x in the rst point set to that representing the element y

in the se
ond point set. This representation is espe
ially useful when the relation is not

homogeneous, i.e. a subset of
artesian produ
t of two dierent sets. In this
ase the two

point sets represent the elements of dierent sets. When the relation is homogeneous we

may spe
ially
ondense the relational diagram - instead of having two point sets we
an

have just one set of points, ea
h representing an element of M, and have an arrow from x to

y whenever x and y are related by the given relation. This representation of a homogeneous

binary relation has the stru
ture of a graph. A graph is dened as a pair G = (V; E ), where

V is the set of verti
es and E ( V V ) is the set of edges. An edge e = (u; v) is a member

of the edge set, where u and v are members of V . If the graph is dire
ted then edges are

ordered pairs of verti
es, if the graph is not dire
ted, an edge (u; v) is identied with the

edge (v; u). Verti
es u and v are
alled respe
tively the head and the tail vertex of the

edge (u; v). Two edges are said to be
onne
ted if the tail vertex of one edge is the same

as the head vertex of the other. A path is a sequen
e of edges in whi
h every
onse
utive

25

pair of edges is
onne
ted.

TODO: Dene Transitive Closure, Conne
ted Components, Explain why edge labelling is at least as expressive as vertex labelling in terms of modelling power.

2.4 Languages

The basi
obje
t in the study of languages is a string. A string is a sequen
e of symbols. For example, all the english words are sequen
es of letter symbols and therefore are

strings. The entire language is a set of su
h strings. In formulating a formal stru
ture

of languages, we need to x the set of symbols that
an appear in the strings. Su
h a

nite set of symbols is
alled the alphabet, let's
all it V . If s1 = hu1 ; u2 ; u3 ; : : : ; um i

and s2 = hv1 ; v2 ; v3 ; : : : ; vn i are two strings, their
on
atenation, denoted as s1 :s2 , is the

sequen
e hu1 ; u2 ; u3 ; : : : ; um ; v1 ; v2 ; v3 ; : : : ; vn i. An empty string hi is denoted by " and is the

identity element under
on
atenation. It may be noted that the operator of
on
atenation

is asso
iative and would form a semigroup over a set of strings that is dened to be
losed

under
on
atenation. The free monoid V generated by an alphabet V is the stru
ture

whose domain is the set of all strings
omposable from the symbols in V, with the semigroup

operation of string
on
atenation.

A language over an alphabet V is a subset L of its free monoid V .

The
on
atenation of two languages L1 and L2 is the set fxy : x 2 L1 ; y 2 L2 g, and is

denoted by L1 L2 .

The ith power of a language L is denoted as Li and dened re
ursively by the rule L0 = fg

and Li = Li 1 L; i 0.

The union of two languages L1 and L2 is the usual set theoreti
union of the two sets of

strings that
onstitute ea
h language, and is denoted as L1 [ L2 . Similarly the interse
tion

of two languages L1 and L2 is denoted as L1 \ L2 and is the usual set theoreti
interse
tion.

The
omplement of a language L over an alphabet V is the set theoreti
omplement

language L, where where the free monoid V is taken as the universe of dis
ourse for the

omplementation. The Kleene
losure (or Kleene star) of a language L is denoted as

S

L and is dened as the union i0 Li .

The positive
losure (or Kleene plus) of a language L is denoted as L+ and is dened

S

as the union i1 Li .

A language L is regular if it is one of the following and nothing else.

The empty set ;.

26

**The empty string f"g.
**

A single symbol string fhaig where a is an alphabet symbol.

It
an be obtained from the above three kinds of languages by nitely many appli
ations of
on
atenation, union and Kleene
losure.

**TODO: Dene generative representations of languages - grammars, regular expression,
**

Chomsky hierar
hy, and de
ision pro
edures for language
ontainment testing (automata

in parti
ular)

**2.5 Des
ribing Semanti
s of Languages
**

TODO:Lambda notation, denotational notation, a small example of denotational denition

**2.6 Relational Cal
ulus using Binary De
ision Diagrams
**

TODO : Dene relational
al
ulus, des
ribe how relations and relational operators
an

be represented by boolean fun
tions. How BDD
an solve relational
al
ulus queries.

Mention
omplexities of BDD operations.

Chapter 3

**The SQUARE Language
**

The SQUARE language has a high resemblan
e of the awk programming language. Its

basi
usage paradigm is that of a pattern-a
tion pair; when a spe
ied pattern is found in a

graph, a user dened a
tion is invoked on the mat
h. The pattern spe
i
ation
ontains one

or more variables, and in the a
tion the same variables are bound to values
orresponding

to the mat
h. We will gradually introdu
e the language in this se
tion, but we need to

dene some notation rst.

The
on
ept of atomi
propositions has been dened in
hapter 2. Given a set of atomi

propositions A and a graph G = (V; E ), we
an dene a propositional truth assignment

fun
tion : E A ! B, su
h that for an edge e 2 E and a proposition a 2 A, if (e; a) =

T rue then we say that the edge e is labelled with the proposition a. The set of labels on

an edge e may thus be written as fp : (e; p) = T rueg and is denoted by L(e). The negate

of a proposition a is represented by a and has the property that (e;a) = :((u; v); a).

Thus, if a proposition a is relevant to a graph and a query, for any edge e, either a2 L(e)

or a2 L(e). While listing the labels of an edge, we shall not usually write the negated

propositional labels and the absen
e of a parti
ular proposition symbol among the labels of

an edge would imply that the edge is a
tually labelled with its negate, i.e. the absen
e of a

label a on an edge e would signify that (e; a) is F alse (i.e (e; a) is T rue). We
all this

positive form of labelling, and this is done merely for
onvenien
e of notation, but the

sense remains as though the negate labels are present. Two edges are said to be
onne
ted

if the head vertex of one edge is the same one as the tail vertex of the other. A sequen
e

of edges where every two su
essive edges are
onne
ted edges is
alled a path. Given a

path he1 ; e2 ; : : : en i, a label string for the path is a sequen
e of labels ha1 ; a2 ; a3 ; : : : ; an i

su
h that a1 2 L(e1 ), a2 2 L(e2 ), : : :, an 2 L(en ). The tail vertex of the kth edge (i.e. of

ek in the path he1 ; e2 ; : : : ; ek ; : : : ; en i) is
alled the kth vertex of the path (starting with

the name rst vertex for k = 1, se
ond vertex for k = 2 and so forth). The head

27

28

vertex of the last edge en of the path he1 ; e2 ; : : : ; ek ; : : : ; en i is
alled its last vertex. We

informally
all a path to be from its rst vertex and to its last vertex. The path queries

in SQUARE involves de
iding whether for a path there is a label string that is a
epted

by a given regular expression. We illustrate this using an example. Consider the graph

given in gure 3.1 (Please note that the labels on the edges are written in positive form, i.e.

absen
e of a label symbol implies presen
e of its negate). When the following query is posed

a

b,c

n1

a

a,b

n3

b,c

n2

b

a

a

n8

b

n6

a

b

n7

n10

n5

a

n4

a

n9

**Figure 3.1: A Labelled Graph.
**

on the graph of gure 3.1 , we intend to mat
h all su
h pairs of verti
es (x,y) for whi
h

there is a path from x to y (i.e. a path with x as its rst and y as its last vertex) whose

label sequen
e satises the regular expression (a (a b) +), whi
h means that it has a label

string belonging to the set fha,b,ai,ha,b,a,b,ai,hb,a,b,a,b,ai,...g i.e. the set of all

strings starting with an a and followed by one or more repetitions of the sequen
e ha,bi.

The exe
ution of this query would print the result as in gure 3.3. To ask for pairs of nodes

(square

:vars

:query

:begin

:a
tion

:end

)

(x y)

(exists-path (x y) (a (b a) +))

"int
nt=0;
out<<\"beginning to mat
h\"<<endl;"

"
out<<x->getName()<<\"->\"<<y->getName()<<endl;++
nt;"

"
out<<endl<<\"found \"<<
nt<<\" mat
h(es) \";"

**Figure 3.2: A simple exists-path query
**

su
h that y is rea
hable from x through path(s) satisfying the regular expressions

and (a (b a) +) (but it need not be the same path that satises both the regular

expressions), we need to modify the query of gure 3.2 to pose the query as in gure 3.4.

The regular expressions used in square have some synta
ti
dieren
e from the familiar

(x,y)

(
*)

29

beginning to mat
h

n1->n8

n1->n6

n1->n9

n1->n4

n1->n5

n2->n6

n2->n9

n2->n4

n2->n5

n7->n9

n7->n4

n7->n5

found 12 mat
h(es)

**Figure 3.3: Results of the query in gure 3.2
**

ones of grep, awk et
. The dieren
e mainly stems from the fa
t that here the alphabet

symbols are names of propositions and
an be several
hara
ters long. Thus su
essive

symbols in the expressions are separated by spa
e. Parenthesis is used for grouping, for

example in the expression (a (b
d) *), it is the subexpression (b
d) that goes under

the Kleene
losure. The symbol or is spe
ial in a regular expression and spe
ies alternative

subsequen
es. For example, the expression (a (b
) or d e) would mat
h paths with

label strings ha,b,
,ei or ha,d,ei. As should be
lear from this example, the or applies

to the symbol or group immediately to the left and right of the or symbol and spe
ies

the alternative subsequen
es hb,
i and hdi. One
an also spe
ify the boolean negate of

a proposition symbol in a regular expression, whi
h is denoted by an immediate prex

(tilde) with the proposition symbol. For example, if a is a proposition symbol, a is its

negate.

Another interesting query operator related to paths in graphs is that of all-paths. Using

an all-paths query expression, one spe
ies a
onstraint on two verti
es - that all the paths

between the two verti
es have a label string a
epted by a spe
ied regular expression. We

illustrate this with an example. Consider the query in gure 3.5 as being posed on the

graph of gure 3.1.

30

Query:

(square

:vars (x y)

:query (and

(exists-path (x y) (
*))

(exists-path (x y) (a (b a) +))

)

:begin "int
nt=0;
out<<\"beginning to mat
h\"<<endl;"

:a
tion "
out<<x->getName()<<\"->\"<<y->getName()<<endl;++
nt;"

:end

"
out<<endl<<\"found \"<<
nt<<\" mat
hes \";"

)

Result:

beginning to mat
h

n1->n6

found 1 mat
h(es)

**Figure 3.4: A query involving two exists-path sub-expressions under logi
al
onjun
tion,
**

and its exe
ution result

The query expression (all-paths (x y) ((a b) +) ) spe
ies the
onstraint that all

the paths with x as rst vertex and y as last vertex has a label string mat
hing the regular

expression ((a b) +). But what if there is no path from x to y ? In order to understand,

we have to take a
loser look at the semanti
s of the subexpression. This subexpression

holds for all su
h assignments of the variables x and y ranging over the verti
es, for whi
h

there is no path from x to y that does not satisfy the regular expression ((a b) +), and

in parti
ular when there is no path at all from x to y then it naturally holds for that pair.

Not that it
ould not be dened otherwise for this spe
ial
ase but this denition is more

aestheti
ally pleasing. This is somewhat similar to the denition of logi
al impli
ation of

propositional logi
where A ) B is true irrespe
tive of B when A is false.

Thus, posing merely the expression (all-paths (x y) ((a b) +) ) as a query would yield

several su
h assignments of x and y for whi
h there is no path from x to y (e.g (x=n2,y=n1),

(x=n3,y=n1) et
. in gure 3.1). The
omplete query (gure 3.5) ex
ludes su
h pairs by

additionally
onstraining the variables x and y by the subexpression (exists-path (x y)

(true *)), whi
h states that there must exist a path from x to y, hen
e the result
onsists

of the few assignments for whi
h there indeed exists a path (or more) from x to y and all

31

Query:

(square

:vars (x y)

:query (and

(all-paths (x y) ((a b) +) )

(exists-path (x y) (true *)))

:begin "int
nt=0;
out<<\"beginning to mat
h\"<<endl;"

:a
tion "
out<<x->getName()<<\"->\"<<y->getName()<<endl;++
nt;"

:end

"
out<<endl<<\"found \"<<
nt<<\" mat
h(es) \";")

Result:

beginning to mat
h

n2->n7

n2->n10

found 2 mat
h(es)

**Figure 3.5: A query involving the all-paths expression and its exe
ution result
**

of them have a label string satisfying ((a

b) +).

Chapter 4

**Integrating Appli
ations with
**

SQUARE

4.1 Appli
ation Integration Manual

4.2 An Appli
ation : Querying Graphs Spe
ied in DOT

4.3 An Appli
ation : Grep using SQUARE

32

Chapter 5

**Stru
tural Query on Cir
uits
**

5.1 Ba
kground

The art of ele
troni
s is largely based on harnessing
ertain phenomena of ele
troni
ow,

ele
tromagneti
elds and waves. It is very wonderful to note that our physi
al universe

oers su
h ni
e fa
ilities and also that it has been possible for human
ons
iousness to

per
eive them, understand their behavior and utilize them. Our utilization of ele
troni
s

has re
ently been very proli
. There has been some desire, eort and progress towards

building
omputing ma
hinery sin
e the 19th Century but the ele
troni
s te
hnology breakthroughs in the late 20th
entury has brought about su
h dramati
progress that was simply

unimaginable in the past. Although some of us des
ribe our times as the spa
e age, it is the

ontemporary ele
troni
s revolution that has made by far mu
h bigger impa
t on and penetration into human life on the whole. Ele
troni
s is still a very happening area. Dynami

as the eld is, the rate of obsoles
en
e of knowledge is immense too. The aggressiveness of

the ele
troni
s industry about innovation has no mat
h in history. The digital paradigm in

ele
troni
s, whi
h is based on pro
essing two well separated levels of signal value thereby

ensuring wide toleran
e to physi
al deviations, makes physi
al realizations robust and reliable. This makes the physi
al swit
hing devi
es a
t as ideal swit
hing devi
es for two-level

signals, thereby posing little physi
ally based limitation to physi
al implementation of dis
rete mathemati
al operators. Combinations of swit
hing elements in digital ele
troni
s

give rise to a variety of logi
elements whi
h in turn are physi
al implementations of some

operations of mathemati
al logi
. The ideal nature of this realization has implied a largely

dedu
tive and imaginative synthesis, as opposed to observational synthesis in the
ase of

largely empiri
al s
ien
es. This property of digital ele
troni
s has opened the slui
e gate of

human imagination, dis
ipline and endeavor and has fa
ilitated the revolutionary progress

in
omputation,
ommuni
ation and automation. One of the main indi
ators of this progress

33

34

is the s
ale of integration of ele
troni
ir
uits, whi
h is a measure of the size and
omplexity

of the systems realized through them. The ele
troni
s industry has termed the
urrent (as

of 2004) stage of integration VLSI, an a
ronym for Very Large S
ale Integration, sporting

hips with hundreds of millions of swit
hing elements, with personal
omputers possessing

billions of bytes of memory and performing billions of operations per se
ond.

The s
ale of
ir
uit integration has
ome a very long way within a few de
ades sin
e the

in
eption of this te
hnology. The rate of improvement of this s
ale has been ee
tively exponential, roughly obeying Moore's law - a prophe
y by Gordon Moore, one of the founders

of Intel Corporation, who envisioned that the number of transistors per
hip will
ontinue

to double every eighteen months. A major enabling fa
tor for this enormous growth has

been the breakthroughs in semi
ondu
tor devi
e te
hnology that make it possible to
reate

swit
hing elements of very small (deep submi
ron) dimensions. Another signi
ant enabling

fa
tor has been the appli
ation of
omputers in improving the ele
troni
design methodology, popularly known as
omputer aided design (CAD). Although the advan
es in pro
ess

and devi
e te
hnologies have arguably made more drasti
dieren
e in VLSI performan
e

and s
ale, it is through the extensive use of CAD te
hnology that designers tame the enormous
omplexity of the design task and translate devi
e te
hnologies into appli
ations that

make the big dieren
e in everyday life.

Contemporary VLSI CAD te
hnologies, espe
ially in the domain of digital design, have

progressed to a level where a typi
al design initiates as a high level spe
i
ation of the system's behavior and then CAD tools pretty mu
h take over the rest of the task. Simulators

render the high level spe
i
ations into exe
utable models, design
ompilers
ompile these

spe
i
ations into stru
tural forms that are
onse
utively
loser and
loser to the sili
on implementation and various types of analyzers extra
t relevant properties of a design thereby

helping in evaluating various aspe
ts of it.

The holy grail of the emerging dis
ipline of ele
troni
design automation (EDA) is
omplete

automation in the design work
ow, that requires minimal designers' intervention in the design pro
ess. Some
ommer
ial EDA eorts are a
tually
lose to it but not quite there yet.

Mu
h of its
ause
an be attributed to the fa
t that
utting edge of design is always trying

to venture into hitherto unexplored territories thereby raising multitudes of new issues that

are not taken
are of by existing do-it-all EDA solutions. Thus the industrial strength VLSI

CAD
ows remain to be multi stage pro
esses as shown in Figure 5.1 and requires designers'

attention at ea
h stage.

Several kinds of spe
ialized software tools are deployed in a CAD
ow. The fun
tionalities

of the CAD tools may be
ategorized as follows.

35

2

1

Behavioral Description

Behavior to RTL Compilation

7

Register Transfer Level

Properties

(Temporal,

Causal)

Equivalence Checking

3

FSM Verification

Logic Synthesis

8

4

**Gate and Standard Cell Level
**

(Netlist)

Structural & Timing

Verification

Physical Synthesis

Physical Synthesis

6

5

Extraction

Placement

Device

Layout Level

Layout Vs Schematic(LVS)

Figure 5.1: A Typi al CAD Flow

Level

Equivalence Checking

Timing &

Structural

Constraints

36

Modelling: Constru
tion of
omputational models that
apture the behavior or stru
ture of the

design. Modelling a
tivities range from physi
ally based
hara
terization of semi
ondu
tor devi
es to high level des
ription of large VLSI systems. Computational

modelling aids in
lude textual and graphi
al languages and notations for des
ription

of models. There are numerous modelling formalisms for
apturing the des
ription

of dierent abstra
tions of VLSI systems. The hardware des
ription languages like

Verilog [57, 58, 59℄ and VHDL [60, 61℄ are large and multiparadigm languages and

support several system modelling methods. The abstra
tions of modelling formalisms

in
lude behavioral, data
ow, register transfer level (RTL), gate level, boolean expressions, state ma
hine, transistor level and physi
al layout level. Figure 5.1 shows some

of these abstra
tions in the
ontext of a typi
al CAD
ow.

Simulation: Dynami
exe
ution of a
omputational model that is equivalent to the exe
ution of the

design. Simulations are equivalent to the real systems in the aspe
ts of interest and not

in totality. Simulation, in the
ontext of VLSI, is done at dierent levels of abstra
tion

and with dierent requirements of a
ura
y. Usually a trade o is made between

a
ura
y and performan
e. At one extreme there are pro
ess based simulators that

simulate the physi
s of semi
ondu
tor ele
troni
s of devi
es and at the other extreme

are behavioral simulators that exe
ute the high level spe
i
ations of a system as a

whole. Between the extremes there are devi
e level analog simulators like SPICE [42℄

and Spe
tre (by Caden
e In
.), symboli
simulators like SIRSIM[43℄, event driven (eg.

IRSIM [39℄, I
arus Verilog et
.) and
y
le a
urate simulators (like Cy
lone VHDL and

Verilog Compiled Simulator (VCS) by Synopsys In
.,
f. http://www.synopsys.
om)

for gate level and register transfer level models, all
atering to dierent aspe
ts and

abstra
tions of a design.

Synthesis: Derivation of an implementation from a spe
i
ation. The goal of ele
troni
design automation (EDA) is to tape out
omplete and
orre
t
hips from high level

spe
i
ations. This end is a
hieved by several stages of synthesis, ea
h of whi
h

pushes the designs
loser to their nal realization. Synthesis is done at many levels of abstra
tion. High up in the synthesis gamut is what is known as behavioral

synthesis involving issues like operation s
heduling, formation of fun
tional units, designing storage
onguration and inter
onne
ting the storage and fun
tional units

[45, 46℄. Lower down the rungs is physi
al synthesis involving translation of netlists

into foundry-ready layout. Two
ommonly used holisti
digital synthesis tools are Synopsys Design CompilerTM (
.f.r. http://www.synopsys.
om) and Caden
e AmbitTM

37

(
.f.r. http://www.
aden
e.
om) suite.

Analysis: Reasoning about and/or extra
ting
hara
teristi
s of a design. Despite eorts, a purely

feed-forward VLSI design pipeline is not yet in pla
e. Validation and testing
ontinues

to
onsume the major timeshare in a VLSI design
y
le. Analysis is a major
omponent (besides simulation) of the pro
ess of validation. Analysis is a very broad term

en
ompassing a large number of a
tivities like fun
tional veri
ation, timing veri
ation, fun
tion extra
tion,
he
king of ele
tri
al and geometri
onstraints et
.

Formal veri
ation of VLSI systems is an area in analysis where many new results

have been reported re
ently. The two main approa
hes adopted in this area are as

follows.

{ Symboli
ally prove theorems on some algebrai
des
ription of the system. For

example in [44℄ an appli
ative language is used to model the data-
ow implementation of the system and its behavioral abstra
tion and the axioms inherent

in the appli
ative language are used in proving equivalen
e of the two.

{ Model
he
k the system. There are some tiny languages for spe
ifying patterns

of trees, paths and subgraphs that
an be mat
hed on labelled graphs. CTL,

QCTL, WQCTL, CTL*, LTL and regular expression are to name a few su
h

languages [6, 7, 11, 10, 12, 26, 28℄. The system is abstra
ted as a labelled graph

and the desired properties are modelled as patterns in those pattern languages

so that mat
hing the patterns with the system graph is equivalent to
he
king

the properties.

The results of analysis are typi
ally fed ba
k to a sear
h pro
ess that adjusts the parameters of the design spa
e, and the sear
h pro
eeds as iterations of design adjustments and

evaluations. This is the quintessential stru
ture of a VLSI design
ow in whi
h analysis

plays the role of an evaluation fun
tion of a sear
h pro
ess.

There are many su
h feedba
k loop steps in the design
ow, in
luding steps with the human

designer in the loop to make design adjustments or
hanges vis a vis the analyzers' results.

The dashed lines in Figure 5.1 show the role of analyzers whose outputs are fed ba
k to the

human-in-the-loop steps in a typi
al modern VLSI CAD
ow. The most general solutions

of many analysis problems are
omputationally hard and pra
ti
al solutions are based on

simplifying assumptions. These assumptions
ontinue to get violated in the most aggressive

design eorts and hen
e new analyzers be
ome ne
essary to a
ommodate the broken assumptions. One more s
ope for analysis tools is the
ontemporary s
enario in whi
h neither

the initial design nor synthesis tools
an be fully trusted, yet it is extremely important to

38

guarantee
orre
tness as any error
an be immensely expensive. To that end it is
ustomary to write redundant spe
i
ations that are dedu
ible from the design intent or the initial

spe
i
ation and verify the designs against them. The analysis tools
over a wide spe
trum

of design evaluation requirements and
omprise timing analzers, noise analyzers, symboli

theorem provers, equivalen
e
he
kers, model
he
kers, ele
tri
al rule
he
kers, geometri

rule
he
kers, physi
al layout to netlist extra
tors, transistor logi
extra
tors and so on.

The design abstra
tion between the RTL and the nal physi
al level lies in the regime of

netlists. The netlists represent undire
ted ele
tri
al
onne
tivity between
ells and devi
es

in a
ir
uit. Quite a lot of analysis and attention is required in the netlist level and a number of analysis tools are deployed on this abstra
tion to validate several properties of the

system. The
ow ar
hite
ture is generally so designed that the tools
ommuni
ate among

themselves by annotating and pro
essing annotations of the netlist representation. The

annotation of netlists by tools makes this abstra
tion a knowledge ri
h representation. A

lot of useful validation
an be done by reasoning about a ri
hly annotated netlist stru
ture.

This thesis presents a ni
e formalism and tool to this end. The stru
tural reasoning engine

proposed through this thesis intends to serve the EDA world as an analysis tool to enable

he
king a wide range of stru
tural properties of netlists. The engine is designed to sport

an expressive de
larative language that
an be used to query and manipulate netlists.

**5.2 Reasoning about Netlists
**

5.2.1

Netlists

**Netlist is an abstra
tion of VLSI systems whi
h represents the stru
ture of inter
onne
tions
**

between the
onstituent
omponents of the system. The netlist is essentially a topologi
al

model albeit potentially annotated with geometri
, ele
tri
al, fun
tional or other semanti

properties of the
onstituents. Stru
tural inter
onne
tions represent the way the
omponents move signals ba
k and forth a
ross
ondu
ting paths or wires. A netlist, as the name

suggests, is represented by a
olle
tion of what are
alled nets, and nets are
on
eptional

olle
tions of pins or ports of
omponents that are ele
tri
ally
onne
ted.

The most important idea in a
ir
uit
onne
tivity representation is that of nets. A net is a

single ele
tri
al path in a
ir
uit that has the same signal value at all its points. The pins

on
omponents that are ele
tri
ally
onne
ted to
arry the same signal are said to belong

to the same net.

Figure 5.2 shows two netlists with nets shown as thi
k lines and named as n1 ; n2 ; : : : et
.

The red
ir
les in Fig. 5.2 denote the pins of the devi
es and gates. The
on
ept of a net

is important in many steps of design and analysis. Designers often want to see an entire

39

VDD

n1

n2

n6

n1

n2

n3

n4

n3

n5

(A)

(B)

**Figure 5.2: Two Netlists.
**

net so that they
an see the path of a given signal. This path will then identify the origin

of the signal and those
omponents that use the signal as an input. Some design styles

enfor
e that only one
omponent may output to a net, while there are many in whi
h multiple
omponents may output to a single net. In some
ases, the multiple outputs
ombine

logi
ally to produ
e a
omposite net signal (
alled a wired-or or a wired-and, depending

on how the sour
es
ombine). In other
ases, the
ir
uit timing is planned so that only

one
omponent will output to the net at any given time, and the other
omponents will

have ina
tive outputs. The ability to visualize a
ir
uit by nets is therefore important in

understanding the paths between
omponents.

Nets are used in simulation be
ause, viewed abstra
tly, a
ir
uit is merely a
olle
tion of

gating
omponents and their
onne
tions. For an event based simulator a net is identied

with a signal node. Ea
h gating
omponent when a
tivated by a
hange in their input signals (on input nets), in turn generate an event that
hanges the signal value on its output

nets after the proper gating delay. For a low level simulator like SPICE, ea
h net in a
ir
uit

orresponds to a nodal variable and a nodal equation.

Thus the nets, being the most important element in the netlist model, will play a
entral

role in the netlist reasoning engine to be presented through this thesis.

5.2.2

Types of Netlists

**Designers typi
ally identify several dierent kinds of netlists that arise in dierent phases
**

in the design
ow. The highest level among them are the ones that are either the result

of logi
synthesis or manual logi
design or a
ombination of the two. This type of netlists

40

may be referred to as sour
e netlists. Sin
e in a digital
ow su
h netlists are in terms of

logi
gates and
ip-
ops they are also
alled gate level netlists. In
ase of
ustom manual

design they may
ontain bare transistors too. In the sour
e netlists the library
ells are

treated as primitive
omponents. For the sake of detailed
hara
terization of properties of

library
ells, devi
e level equivalent netlists are extra
ted from library
ells' isolated layouts.

Sour
e netlists, when expanded in terms of these library
hara
terized netlists are referred

to as
hara
terized netlists. The lowest level of netlists of a design are the ones obtained by

extra
tion from the
omplete layout of a design to extra
t all instan
es of transistors and

passive devi
es. Su
h netlists are
alled extra
ted netlists. Figure 5.3 shows some of the

situations where the dierent kinds of netlists appear in a VLSI design
ow.

Interesting and
hallenging problems arise when we analyze dierent types of netlists in

Schematic

Capture

HDL

Library Cells

Synthesis

Source Netlist

Custom

manual entries

and modifications

Linking to

charactarized

library cells

Characterized Netlist

Extracted Netlist

Passive RLC Networks

Layout, floorplanning

Parasitic Extraction

Interconnect Extraction

Layout

**Figure 5.3: Dierent Kinds of Netlists
**

isolation or together. One big
hallenge is that of the sheer size of these netlists that run into

several gigabytes of data. Among other
hallenges is to make their representation amenable

to dierent kinds of pro
essing as required for dierent analysis methods.

41

5.2.3

Reasoning Problems in Netlist

**Among the possible aspe
ts of interest in the analysis of VLSI netlists, it's the fun
tional
**

behavior that has been re
eiving the maximum attention. Fun
tional reasoning is usually

about fun
tional veri
ation but it is also used in other analyses like
he
king sensitizability

of of paths in the netlists.

Re
ently the s
alability of fun
tional analysis has re
eived a major boost with the deployment of ordered binary de
ision diagrams (or OBDDs) [5℄, a
anoni
al representation

of boolean expressions. Some fun
tional reasoning solutions use the
anoni
al nature of

OBDDs to
he
k fun
tional
orre
tness of
ir
uits (for example whether a given net in a

transistor netlist outputs a given boolean expression).

Currently fun
tional reasoning is at a stage of development where several new ideas are

oming up from the a
ademia of whi
h quite a few are nding pla
e in
ommer
ial veri
ation/debugging steps of design
ows. On the other hand, stru
tural reasoning about

netlists, despite being an old idea[38℄, has not re
eived as mu
h attention from the VLSI

CAD
ommunity.

The main dieren
e between stru
tural and fun
tional aspe
ts is that the stru
tural view

of netlists strongly depends on the te
hnology library used in the synthesis and
an not

be derived merely (te
hnology independently) from the abstra
t spe
i
ation of the system

while the fun
tional view is meant to be equivalent to its spe
i
ation irrespe
tive of the

devi
e te
hnology involved.

Consequently stru
tural reasoning is not done with mu
h regard to spe
i
ations of individual systems or designs and is done spe
i
ally for te
hnologies and design styles. Thus

it is
ommon to nd stru
tural reasoning appear as hard
oded in CAD tools.

The obje
tives of stru
tural reasoning on netlists reported so far may be
ategorized as

follows.

Stru tural omparison to establish that two netlists are stru turally identi al [21, 23℄.

Stru tural debugging and veri ation to sear h or isolate patterns in a ir uit [38, 47℄.

Sub ir uit mat hing to lo ate the o urren es of given sub ir uits in a stru tural netlist

[20℄.

Graph grammar mat hing to establish onforman e with design styles spe ied by the

grammar [24℄.

42

De larative um pro edural query and manipulation of netlists [22, 49℄.

Among the above, most of the stru
tural
omparison and sub
ir
uit mat
hing problems are

NP-hard, yet the reported results [21, 23, 20℄
laim of fast performing implementations for

pra
ti
al
ir
uits. They do nd good appli
ations in
omparing layouts with transistor level

s
hemati
s and appear as hard
oded implementations spe
ializing in mat
hing netlists in

the Layout Vs S
hemati
(LVS) tools.

On the other hand, the obje
tives of graph grammar mat
hing, stru
tural debugging and

de
larative query/manipulation require relatively generi
reasoning and an expressive interfa
e. Towards an expressive interfa
e, [38℄ introdu
es a language, LEXTOC (Language for

EXpressing TOpologi
al Constraints), [24℄ uses a graphi
al language for expressing graph

grammars, [47℄ presents a de
larative topology oriented language (dubbed VETO-LISP)

and [22℄ uses a small language inspired by AWK [41℄ to express sub
ir
uit patterns and

a
tions to be invoked on mat
hing sub
ir
uits. The language interfa
e is the key to their

generi
ity and power whi
h enables diverse reasoning without resorting to general purpose

programming languages. These languages are so
lose to their problem domain - i.e. querying netlists in some form or the other, that reasoning tasks
an be written using them very

su
in
tly.

As regards their relevan
e, the generi
stru
tural debuggers (let us
all them
ustom reasoning engines as opposed to standard hardwired ones like netlist
omparators) are more

relevant now than ever before. Corre
tness of netlists by
onstru
tion may be assumed

only in
ase of netlists generated by sili
on
ompilers in an ideal situation. Maybe that

situation will arrive on
e sili
on
ompilers gain a high level of maturity and when design

pro
esses will stop tweaking the outputs of sili
on
ompilers. But as we are moving
lose

to the physi
al limits of the devi
e te
hnologies the
ommer
ial designs are using more and

more
ustom optimization (manual pla
ement et
.) to get the most out of the available

devi
e te
hnologies. What transpires of this is that the
utting edge designs are usually

omplex assemblies of hand
rafted designs, standard
ells, ma
ro
ells and
ells generated

by sili
on
ompilers. Moreover, the
oexisten
e of analog and digital
ells on single
hips

(typi
al in SOCs) requires
ustom hand
rafting thereby leaving no room for the assumption

of
orre
tness by
onstru
tion.

Thus it remains to be an important problem to reason about the netlist abstra
tion of

ir
uits. Some
ontexts where stru
tural reasoning problems about netlists arise are listed

as follows.

**A dynami
CMOS te
hnique named NORA [48℄ requires that there should be no path
**

through stati
CMOS gates from the outputs of a -C2MOS gate to the inputs of a

43

-n-dynami
or a -p-dynami
blo
k.

Some design styles disallow PMOS transistor hannels onne ted to VSS or NMOS

hannels
onne
ted to VDD. In a netlist extra
ted from layout a violating
onguration may
onne
t an NMOS
hannel to VDD through a resistive path, whi
h needs

to be dete
ted.

Be ause of the layout pra ti e of transistor folding, a single transistor in a s hemati

**an be implemented as several parallel transistors in a layout, and the extra
tor may
**

infer additional passive devi
es between parallel transistors. For an LVS to su
eed,

this variation has to be stru
turally reasoned about.

It is a violation of CMOS design rules to use a net that does not have a path to VDD

**through PMOSFET
hannels, as input to any gate. Possibility of its violation may be
**

ruled out in a design involving library
ells but in hand
rafted layouts it is not very

unlikely to appear.

**Combinational
y
les are prohibited in most design styles. It is often of interest to
**

he
k a gate level netlist for
y
les that don't pass through
ip-
ops.

**In testing, it is often of interest to determine the input
one of a net, i.e. the
olle
tion
**

of nets that have signal paths to that net.

Sometimes improper hold violation onstraints make the synthesis tool introdu e long

**serial
hains of buers and/or inverters in the netlist to introdu
e large delays. All
**

onstraints get satised that way and it is impossible to lo
ate them by looking at the

s
hemati
but they slow down the
ir
uit unne
essarily. Custom stru
tural reasoning

an help lo
ating them.

For larger designs it's virtually impossible to run analog simulation. Event based and

**y
le a
urate fun
tional simulators (like Verilog, Cy
lone VHDL, IRSIM et
.) are
**

fast enough but work only for digital abstra
tions. Nominally digital
hips may have

analog sub
ir
uits like sense ampliers that
an not be handled by digital simulators.

But if the sense amplier blo
ks
an be lo
ated and repla
ed by inverters then the

ir
uit
an be handled by digital simulators, while preserving the fun
tional properties.

This requires stru
tural reasoning about netlists.

The existing approa
hes and tools for netlist reasoning do handle some reasoning problems but with limited s
alability and domain of appli
ability. Firstly, most of them (ex
ept

[24℄) applies only to transistor level netlists, and [24℄'s approa
h using graph grammars

44

ould not be applied to
ommon reasoning problems. [38℄ and [47℄ are expressive but are

reportedly slow for larger transistor netlists. [49℄ is simple and powerful but exa
ts high

reativity on the part of the user. [22℄ is re
ent and
omprehensive but is appli
able only

to transistor level netlists.

None of the above reasoning approa
hes deploy any of the re
ent symboli
methods (OBDDs [5℄ in parti
ular) that have boosted the s
alability in reasoning about fun
tional tra
es

of VLSI systems. In this s
enario it appears extremely important to to formulate a new

approa
h that is more expressive, appli
able to all
lasses of netlists, eÆ
ient, and leverages

s
alability from symboli
omputing methods. This is the gap that is attempted to be

bridged by the work present through this thesis.

5.2.4

Representation of Netlists

**A
omputer model of netlists is a prerequisite for representing, storing, manipulating and
**

reasoning about netlists. This is usually done using a netlist database. Although the resear
h
ontent of the presented work fo
usses on stru
tural reasoning about netlists, the

omplete work goes signi
antly beyond that, presenting a system that may be used as a

substratum for netlist level EDA appli
ations. This may oer a middle ground between

developing from s
rat
h and using o the shelf appli
ations. Wel
ome to what we
all the

Netlist Management System (NMS), a tool and a software
omponent that addresses the

problem of netlist data representation, management and last but
ertainly not the least stru
tural reasoning about them. It in
ludes a number of powerful features like - an eÆ
ient

representation of netlists, interfa
e to
ommon netlist formats, an intuitive programming

and extension interfa
e, a netlist reasoning engine and a s
ripting interfa
e.

The overall obje
tive of the netlist management system is to provide a holisti
platform

software for netlists, not just an implementation of the reasoning engine to prove the point.

The EDA appli
ations developed on the top of it, besides the ones reported in this thesis are

an inter
onne
t delay
al
ulator [54℄, a gate level timing analyzer [55℄ and a
ombinational

equivalen
e
he
ker [56℄.

EDA data management produ
ts and solutions, in
luding those for netlist level data, are

available
ommer
ially - Synopsys' MilkyWay (http://www.synopsys.
om) and InterraEDA's

Netlist Obje
t Model (NOM) (www.interraeda.
om) being two well known ones. Sili
on Integration Initiative (SI2)'s open sour
e design database - OpenA
ess (www.openeda.
om)

is a
omprehensive representation of many abstra
tions of VLSI design in
luding netlists.

Its li
ensing terms disallowing sour
e redistribution and interfa
e modi
ation makes it an

inappropriate substratum for this a
ademi
resear
h undertaking, else its use would have

45

signi
antly redu
ed the development task.

With a very little eort the SQUARE framework
an be interfa
ed to any of the above

netlist representations.

The following are the requirements that had driven the spe
i
obje
tives of the NMS.

As has already been indi ated, the main s ienti ontent of the work is the formula-

**tion of a reasoning framework for netlists. The engine should fa
ilitate the following.
**

{ Isolation of ex
eptional sub-
ir
uits.

{ Examining the presen
e of ex
eptional paths and
ir
uit patterns.

{ Enfor
ing that the netlist does not
ontain patterns designated as illegal for a

**parti
ular design methodology.
**

{ Substitution or manipulation of spe
ied paths or sub-
ir
uits.

The reasoning requires a representation to a t upon, thus a suitable netlist repre-

**sentation is required. A main-memory data stru
ture is required as the mode of its
**

implementation for the sake of eÆ
ien
y.

**For populating the representation with available netlists, a read/write interfa
e for
**

the
ommon netlist formats is required.

Moreover the reasoning will be more ee tive if it an a ess annotations made by

**other EDA tools. Hen
e a ni
e API of the representation is desirable that may instigate
**

development of more EDA tools around it, thereby fa
ilitating more annotation of its

populated instan
es.

Appli ation development may be further eased by an extension interfa e like s hema

des ription language from whi h the netlist representation database an be generated.

The bottomline of EDA is automation, and nothing automates like a s ripting inter-

**fa
e. Thus su
h a s
ripting interfa
e is required that
an a
ess the
omplete NMS
**

API and its appli
ations or servi
es.

**The ar
hite
tural
ornerstones of NMS, as derived from the aforementioned requirements
**

are as follows.

**The Netlist Database : the
ore representation.
**

Database Generator : an interfa
e to generate the database
ode automati
ally from

the s hema.

46

A Stru tural Query And Reasoning Engine (with a ronym - SQUARE): onsisting of

An Automati ally Generated S ripting Interfa e : using the T l [50℄ extension lan-

Netlist Readers and Writers : for Verilog, CDL and SPEF.

**a query language and a C++
ode generating
ompiler for reasoning about stru
tural
**

des
riptions.

guage.

**Figure 5.4 shows the various
omponents of the netlist management system. The design of
**

the query language (SQUARE) is inspired and in
uen
ed by the interfa
es of the existing

netlist reasoning tools [38, 47, 22℄, some temporal logi
s [26, 28, 7℄, regular expressions

[9℄, some existing graph query languages (eg. Graphlog[17℄, GOQL[16℄ and G+ [19℄) and

relational
al
ulus [33, 34℄. If we disregard the temporal and
ausal
onnotations of some

temporal logi
s, they
an be viewed as tiny pattern des
ription languages to mat
h path,

tree and subgraph patterns on dire
ted graphs. This view has been used in reasoning about

labelled graphs abstra
ted from netlists.

The subsequent se
tions present the netlist management system and its underlying
on
epts

in greater detail.

**5.3 Overview of the Netlist Management System
**

The software implementation of the NMS is fairly well pa
kaged and reusable. The software

design is introdu
ed brie
y in the following se
tions.

5.3.1

The Netlist Information Model and its Representation

Most of the VLSI design tools need to deal with some or other forms of netlist representation. Some representations
losely follow the syntax of the stru
tural hardware des
ription

languages. In the others they are some kind of abstra
t models like graphs and hypergraphs

(a.k.a. relations) as suited for the appli
ations.

Representation is a very important problem in the design of any CAD system. A good

representation allows the system to be
onveniently stored, a
essed and manipulated while

a bad representation is wasteful and non-s
alable.

The primary a
tivity in formulating an information model is
hara
terizing the entities of

the domain and relationships between them. The main entities of the domain of netlists are

nets,
ells, devi
es, pins, ports et
. The most important relation in a netlist representation

is that of
onne
tivity, whi
h is a binary relation on the union of the sets of pins and ports.

47

SQUARE

Query

NDDL

Schema

NDDL Compiler

SQUARE Compiler

**Query Intermediate Representation
**

FSA

Meta−Objects

AST

NMS Shell

1111111111111

0000000000000

0000000000000

1111111111111

Compiled square

0000000000000

1111111111111

Queries

0000000000000

1111111111111

0000000000000

1111111111111

1111111111111111111111111111

0000000000000000000000000000

NMS Database API

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

NMS

00000000000000000

11111111111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

The

NMS

Core

00000000000000000

11111111111111111

Schema

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

00000000000000000

11111111111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

A Netlist Representation

Extensions

00000000000000000

11111111111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

00000000000000000

11111111111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

00000000000000000

11111111111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000

1111111111

0000000000000000000000000000

1111111111111111111111111111

0000000000000000000000000000

1111111111111111111111111111

1111111111111

0000000000000

0000000000000

1111111111111

User Applications

0000000000000

1111111111111

0000000000000

1111111111111

0000000000000

1111111111111

1111111111111

0000000000000

User Applications

0000000000000

1111111111111

0000000000000

1111111111111

0000000000000

1111111111111

Figure 5.4: Overview of the NMS System

111111111111111

000000000000000

000000000000000

111111111111111

Scripting

000000000000000

111111111111111

Interface

000000000000000

111111111111111

000000000000000

111111111111111

Netlist Readers/Writers

11111111111111

00000000000000

00000000000000

11111111111111

Verilog,CDL,SPEF etc.

00000000000000

11111111111111

00000000000000

11111111111111

00000000000000

11111111111111

48

The semanti
s of ele
tri
al
onne
tivity implies symmetry, transitivity and re
exivity of

this relation, thereby indu
ing equivalen
e partitions in the set of pins, ea
h partition
orresponding to a net. There is yet another partition of the set of pins as indu
ed by the

binary relation of two pins' belonging to the same
ell or devi
e. The netlist representation

of NMS re
e
ts this formalized stru
ture in the information model.

The pragmati
advantage of this formalization is that it lends itself to mapping onto labelled

abstra
t graph stru
tures that are suited for formal reasoning. The graph mapping follows

very naturally. Ea
h equivalen
e partition may either indu
e a vertex in the graph mapping

or ea
h ordered pair of pins in the partition may indu
e a dire
ted edge in the graph. The

labels of the edges arise from propositions based on
ir
uit semanti
s. This stru
ture
an

be queried by SQUARE to fa
ilitate lo
ation and testing the presen
e of a wide range of

ir
uit patterns.

On a dierent note, an extremely desirable feature of a netlist representation is its power

and
exibility. In VLSI design, the need for new analysis methods leads to development

of more and more tools. All these tools manipulate dierent information, whi
h must be

represented. Therefore the representation must be
exible enough to in
orporate new information wherever and whenever needed. Generi
ally speaking, every obje
t in the netlist

database is a re
ord that
ontains data items. These items are attributes that have names,

values, and often spe
i
types asso
iated with them. For example a transistor may have

as attributes its length, width, type, orientation, position et
. A parasiti
resistor may

have as its attributes its
onne
tions and its resistan
e. In pra
ti
e, there is a never-ending

set of attributes that must be represented,
aused by the never-ending set of synthesis and

analysis tools. Ea
h tool is used to manipulate a dierent aspe
t of the obje
t, so ea
h

introdu
es new attributes. Given that a representation should pla
e no limits on the design a
tivity, it is ne
essary that the
reation of obje
t attributes be
exible. Sin
e it is

impossible to determine in advan
e exa
tly whi
h data entries are going to be needed when

planning a re
ord organization, the program must be able to
reate new attribute entries

during design. A good s
heme to ensure this is to have a run-time evolving meta-stru
ture

underlying the database that allows the obje
t s
hemas to evolve dynami
ally (for example by using
ommon lisp obje
t system (CLOS) [52, 53℄, with its meta-obje
t proto
ol

(MOP) [51℄ or even XML as the basis of the database). Another possible s
heme is to use

linked list of attributes and their values asso
iated with ea
h obje
t. In su
h a s
heme,

ea
h netlist obje
t
onsists of a list head that links its attribute/value pair re
ords. It has

the disadvantage of making the system very slow be
ause traversal of a list is required to

nd an obje
t's attribute values. To speed up attribute a
ess, a hashing table or even a

balan
ed sear
h tree of attribute/value pairs
an be stored in the obje
ts. These dynami

49

solutions ensure
exibility but
auses heavy spa
e and time overheads. No matter how we

store the attribute/value pairs a worst
ase logarithmi
time sear
h is unavoidable, let alone

the spa
e overheads.

To solve this problem NMS provides
ompile time extensibility in whi
h the users or appli
ation developers
an spe
ify the required attributes in a tiny s
hema spe
i
ation language

(
alled the netlist database des
ription language (NDDL) ) and the database s
hema

hanges are a
ordingly generated from it.

5.3.2

Integration of SQUARE with the NMS

**The SQUARE language is a small language for expressing queries on labelled dire
ted
**

graphs, and serves as the basis for netlist stru
tural reasoning in NMS. The SQUARE

ompiler generates a C++
ode from the query, whi
h in turn evaluates the query. A

labelled graph is inferred from the netlist, in whi
h the nets are mapped to verti
es and

ea
h of the
omponents (
ells) indu
e several edges
orresponding to ea
h possible pair of its

pins. The mapping
an be the other way round too, i.e.
ells indu
e verti
es and nets indu
e

edges, but in pra
ti
e the former mapping was found more useful to reasoning problems.

There are quite a few basi
query expressions in SQUARE that are
omposed using a

relational
al
ulus, whi
h applies orthogonally to the basi
expressions as will be explained

subsequently.

A basi
set of query expressions are based on mat
hing paths in a
ir
uit graph, satisfying a

given regular expression. The regular expressions are quite expressive and are parti
ularly

amenable to mat
hing paths in a labelled graph. The alphabet of the regular expressions are

propositions on the edges of the graph. In SQUARE, the propositions are dened separately

from the queries and there is a small built-in utility library of propositions related to the

NMS semanti
s. The propositions are referen
ed by name in the query expressions.

For example, the following query subexpression indi
ates bindings of all su
h pairs of nets

(in the netlist being queried) to the variables x and y, for whi
h there exists a path in the

ir
uit graph satisfying the regular expression (drain to sour
e * sink is vdd). Here

drain to sour
e and sink is vdd are atomi
propositions, and '*' is the usual Kleene

losure operator of regular expressions [9℄.

(exists-path (x y) (drain_to_sour
e * sink_is_vdd))

**As another example, the following expression involving just one variable x indi
ates all su
h
**

bindings to x that has a self rea
hable path through edges from input pins to output pins,

(relevant in a gate level netlist). The '+' in the expression is the positive
losure operator of

50

regular expressions [9℄. A non-empty resulting set of bindings obtained on a netlist for the

following expression will indi
ate the presen
e of a
ombinational loop.

(exists-path (x x) (in_to_out +))

**The fa
t that we mat
h paths through edges from input pins to output pins of
omponents
**

is en
oded in the implementation of the edge predi
ate in to out.

The
ompiled query evaluator, whi
h is a pie
e of C++
ode, is generated by the query

ompiler for ea
h query. The invo
ation of the runtime evaluator is done through a
all to

an interpreter
ommand.

A query is essentially des
ribed as a pattern-a
tion pair. The a
tion is a blo
k of C++

ode that is exe
uted in an environment that lexi
ally has a
ess to ea
h of the bindings of

the free variables in the query. After
omputation of all the bindings of the variables, the

a
tion
ode is repeatedly exe
uted over ea
h of the bindings (i.e ea
h satisfying assignment

of the variables). The order of traversal of the assignments is arbitrary.

For better performan
e, users
an spe
ify relationships like
ontainment or disjointness

among propositions to help the SQUARE
ompiler to generate a better
ompiled evaluator.

Three examples of queries are presented in Figures 5.5, 5.6 and 5.7, with semanti
s stated

in the respe
tive
aptions. In parti
ular, the query in Fig. 5.7, when invoked with the name

of the VDD net as its argument will print all the input nets of the transistor level netlist.

(square
omb
y
le :args ()

:vars (v1)

:filter-edge (through_ff)

:query

(exists-path (V1 V1) (in_to_out +))

:a
tion "
out<<V1->getName()<<endl;"

)

Figure 5.5: Query to print all nets belonging to a y li path not passing through a ip- op.

51

**(square internalnode :args ()
**

:vars (V1 V2 V3)

:query

(and

(exists (V1)

(exists-path (V1 V2) (in_to_out +))

)

(exists (V3)

(exists-path (V2 V3) (in_to_out +))

)

)

:a
tion "
out<<V2->getName()<<\" \";"

)

Figure 5.6: Query to print all the internal nets in a netlist.

**(square
hannel_unrea
hable :args (("string" "netname1"))
**

:vars (V1 V2)

:query

(and (upred net_with_name (V1) "netname1" )

(not (exists-path (V1 V2) (along_
hannel +))))

:a
tion "
out<<V3->getName()<<\" \";"

)

Figure 5.7: Query to print all su
h nets that are not rea
hable from a given net through

FET
hannels in a transistor netlist.

Chapter 6

**The Implementation of SQUARE
**

The semanti
s of the regular path expressions in SQUARE deviates from the usual regular

expressions on
hara
ter streams in that the alphabet elements (propositions) for SQUARE

expressions are not disjoint. This introdu
es some additional
omplexity in evaluating

the all-paths subexpressions of an SQUARE query. If all the NFA states
onstituting

a DFA state has outgoing transitions on symbols (p1 ; p2 ; : : : ; pn ) then the DFA state will

have 2n outgoing transitions with ea
h label as logi
al
onjun
tion of the elements of a

subset of fp1 ; p2 ; : : : ; pn g. Here, the absen
e of pk a
tually means falsehood of pk in the

orresponding
onjun
tive form. For example, for three propositions fp1 ; p2 ; p3 g the subsets

will be (:p1 ^:p2 ^:p3), (:p1 ^:p2 ^ p3 ), (:p1 ^ p2 ^:p3), (:p1 ^ p2 ^ p3), (p1 ^:p2 ^:p3),

(p1 ^ :p2 ^ p3 ), (p1 ^ p2 ^ :p3 ) and (p1 ^ p2 ^ p3 ).

Some of these subsets may be ruled out by some apriori knowledge about the propositions. If some relationships among propositions are stated in the query spe
i
ation then

the SQUARE
ompiler attempts to optimize the evaluation by eliminating some subsets

des
ribed above. SQUARE supports spe
i
ation of two su
h relationships in the atomi

propositions - that of mutual ex
lusion (saying that the said propositions don't simultaneously hold) and that of
ontainment (truth of one proposition implies the truth of another).

Even one of these two
onstru
ts, when
oupled with the
onstru
t of negation of propositions, would have suÆ
ed to spe
ify any boolean
onstraint among propositions but both

of them are supported by SQUARE for the sake of intuitiveness.

In parti
ular, true and :true are two spe
ial propositions in SQUARE that evaluates to

true and false respe
tively on all edges of a
ir
uit graph.

52

53

6.0.3

Algorithmi s and Ar hite ture

**Most of the nontrivial graph queries are NP-
omplete or harder problems. The sizes of the
**

ir
uits are large enough not to let us dream of running an algorithm super-polynomial in

their size. There however are
ases when NP
omplete queries may still be answered. These

are the
ases in whi
h the query evaluation is NP
omplete but if we keep the query xed

(i.e. the query is
onsidered a part of the problem des
ription and not an input) then the

ost of the evaluation algorithms would be polynomial in the size of the
ir
uit. We
all

su
h queries
ir
uit-size-tra
table as they are easy in terms of the
ir
uit size. SQUARE,

by its syntax and semanti
s, avoids su
h queries that are not
ir
uit-size-tra
table.

SQUARE evaluation engine uses symboli
omputation with ordered binary de
ision diagrams (OBDDs) in evaluating an aspe
t of the queries that is PSpa
e hard in terms of the

query size. OBDDs are also deployed in evaluating the
ir
uit-size-tra
table rea
hability

queries.

The
omplexity of mat
hing regular expressions in
ir
uit graphs depends on what we intend to mat
h with the regular expressions. If we intend
he
k for the existen
e of a simple

path (a path with no
y
le) satisfying a regular expression in edge labels, the problem turns

out to be NP-
omplete in terms of the size of the graph [3℄ ex
ept in a few trivial
ases

[1, 2℄. Therefore this semanti
s
an not be evaluated eÆ
iently.

On the other hand, the presen
e of a path (a sequen
e in whi
h
onse
utive pairs are adja
ent verti
es in the graph) satisfying a regular expression
an be established in polynomial

time [3℄. Despite its low
ost, the semanti
s of mat
hing regular expressions with paths in

a graph was found quite useful in querying netlists.

There are some subproblems of SQUARE evaluation that are hard in terms of the size of

the query. De
iding whether all paths between two verti
es of the graph satisfy a given

regular expression turns out to be NP
omplete. For the queries that require the above de
ision, SQUARE evaluator
omputes the automaton that re
ognizes the
omplement of the

language spe
ied by the original regular expression. The absen
e of any path re
ognized

by the
omplement automaton implies that all paths are mat
hed by the original regular

expression. Computing the
omplement automaton may require exponential spa
e (and

time) in the size of the nondeterministi
nite automaton that is obtained dire
tly from

the query expression. However this
ombinatorial explosion happens only over the query

expression, whi
h when assumed to have a
onstant bound, redu
es the problem of query

evaluation to one of polynomial spa
e and time
omplexity.

A sket
h of the algorithm for existen
e of regular paths goes as follows.

Compute the automaton A that re ognizes the regular path.

54

Treat the
ir
uit graph like an automaton and
ompute its automata theoreti
interse
tion P with A.

Compute transitive
losure on P , whi
h is the regular-path
losure on the
ir
uit

graph.

The SQUARE subexpressions generate OBDDs involving variables that are free in the

subexpressions. The relational
al
ulus
onstru
ts are evaluated by
omposing the OBDDs

of the subexpressions.

On a dierent front, the NDDL based generation of the netlist database involves some

very minor (almost impertinent) algorithm intensive pro
essing (the most pertinent one

being the traversal of a type inheritan
e DAG). Essentially the NDDL
ompiler
reates the

s
hema data stru
tures from a textual NDDL des
ription and performs depth-rst traversal

and topologi
al ordering of the inheritan
e graph in the s
hema in the pro
ess of generating

the C++
ode for the netlist database of NMS.

The algorithms and analysis involved in the design and development of NMS are presented

in detail in
hapter ??.

As regards the ar
hite
ture of the software implementation of NMS, most of its fun
tional

omponents (ex
ept the C++
ode generators, viz. the SQUARE and NDDL
ompilers)

ommuni
ate among themselves through native pro
edure
alls in the same pro
ess spa
e,

as shown by the bidire
tional thi
k arrows in Fig. 5.4. Thus the C++ linker is the basi

integration glue for NMS. The NDDL and SQUARE
ompilers are separate programs that

generate
ode for integration with the NMS, as indi
ated in Fig. 5.4.

The s
ripting interfa
e of the NMS is
reated by embedding a T
l interpreter into the

NMS. An additional tool named Swig (http://www.swig.org) has been used to generate T
l

wrappers of some C++
lasses and fun
tions. The SQUARE
ompiler is written in
ommon

lisp using the freely available implementation
lisp (http://
lisp.
ons.org). The NMS uses

two spe
ialized software
omponents available freely in the publi
domain, besides the usual

C/C++ runtime library implementations. They are as follows.

BUDDY : A BDD Pa
kage from the IT-University of Copenhagen, Danmark, written

by Jorn Lind-Nielsen (buddyitu.dk).

T l : An extension language and embeddable interpreter (http://www.s ripti s. om)

[50℄.

There is plenty of room for optimizations and performan
e enhan
ements of NMS and

SQUARE, nevertheless the
urrent performan
e and eÆ
a
y of the system seems good

enough to be pra
ti
ally useful.

55

**6.1 Evaluation of the all-paths Query
**

The semanti
s of the regular all paths query has been explained earlier in
hapter 3. Its

evaluation primitive requires as
ertaining whether all possible paths from one parti
ular

vertex to another in a graph satises a given regular expression on the edge labels. Theorem

6.1.1 establishes that Regular-All-Paths evaluation is NP-hard.

Theorem 6.1.1. All-Regular-Paths is NP-hard.

It is known that satisability of boolean formulas written in
onjun
tive normal form

(CNF) is NP-hard [30℄. We redu
e an arbitrary instan
e CNF-satisability to a RegularAll-Paths instan
e to prove it NP-hard. A CNF boolean formula F is a
onjun
tion of

several
lauses ea
h of whi
h is disjun
tion of several literals (variables or their negates).

We will try to prove F unsatisable, i.e. :F valid. In symboli
ally
omputing :F from F

(whi
h is in CNF) we
hange the inter-
lause
onjun
tions to disjun
tions, the intra-
lause

disjun
tions to
onjun
tions and negate ea
h literal. As an example if

Proof:

then

F = (x1 _ x2 _ x3 ) ^ (:x1 _ x3 _ x4 ) ^ (:x2 _ :x3 _ x4 )

(6.1.1)

:F = (:x1 ^ :x2 ^ :x3) _ (x1 ^ :x3 ^ :x4) _ (x2 ^ x3 ^ :x4):

(6.1.2)

**Constru
t a graph with n + 1 verti
es v0 ; v1 ; v2 ; : : : ; vn and no edges yet.
**

For ea
h variable xi in F
reate two edges from vi 1 to vi , one labelled with xi and the other

with :xi . The pre
eding
onstru
tion for F in equation 6.1.1 is illustrated in Fig. 6.1. The

graph so formed will be the
ontext for the Regular-All-Paths query
orresponding to the

CNF-satisability instan
e. Let us
all this graph G.

X1

X2

X3

X4

V0

V1

X1

X2

X3

X4

**Figure 6.1: A graph
ontext
onstru
ted for CNF-sat.
**

Next, we
onstru
t a regular expression from :F . Re
all that we had used a parti
ular

arbitrarily
hosen order of variables (viz. x1 ! x2 ! x3 : : : ! xn ) while
onstru
ting the

graph G. We need to
onsistently use this order in
onstru
ting the regular expression as

follows. We rewrite ea
h disjun
tive
lause in :F (with
onjun
tive terms within) in su
h

a way that all the variables x1 ; x2 ; x3 ; : : : ; xn appear in the
lause and in that order. If a

56

variable xj was originally absent in the
lause ll its position with a spe
ial term (xj _:xj ).

Having done that, we do the following substitutions on the boolean expression to interpret

it as a regular expression.

**Substitute the ^s within the disjun
tive
lauses by the
on
atenation operator of regular
**

expressions.

**Substitute the _ between the
lauses by the disjun
tion operator of regular expressions.
**

Terms within the disjun
tive
lauses, of the form (xj _ :xj ) (that arose due to the

absen
e of the literal xj in the original
lause) are interpreted as a single proposition.

**Let us
all the regular expression so interpreted . The NFA that
an be easiy
onstru
ted
**

from is one in whi
h there are as many linear bran
hes from the start state as there were

disjun
tive
lauses in :F and ea
h bran
h has a length n ex
luding the start state. One

su
h automaton for :F given in equation 6.1.2 presented in Fig. 6.2.

X2

X3

X4 ,

X4

X3

X4

X1

X1

X2 ,

X1 , X

1

X2

X2

X3

X4

**Figure 6.2: An NFA interpreted from a CNF expression.
**

With the above
onstru
tion in pla
e, our
laim is that the Regular-All-Paths for the

expression on the graph G evaluates to true if and only if :F is valid. It is
lear that a path

from v0 to vn represents a parti
ular assignment (a.k.a. interpretetion) of all the variables of

:F , and all the v0 ! vn paths in G, by the
onstru
tion,
ompletely enumerates all possible

assignments of the variables in :F . Further, a v0 ! vn path's satisfying is equivalent

to the
orresponding assignment's satisfying :F . Thus Regular-All-Paths(v0 ; vn ; ) is a

ne
essary and suÆ
ient
ondition for the validity of :F . This proves that the
onstru
ted

instan
e of Regular-All-Paths solves an arbitrary instan
e of CNF-satisability.

Another related result is as follows.

57

Theorem 6.1.2. Regular-All-Paths is in
o-NP.

The
omplement of Regular-All-Paths(v0 ; vn ; ) is to as
ertain whether it is false.

A
erti
ate for its being false is a path in the graph from v0 to vn , proved not to satisfy .

This
an be done in polynomial time by testing non-existen
e of a -path in the
erti
ate

path using the Exists-Regular-Path algorithm.

Proof:

**There is a well known result in automata theory that regular sets are
losed under
**

omplement. A typi
al proof of this statement pro
eeds by
onstru
ting an automaton from

a given automaton, whi
h a
epts exa
tly the
omplement language of the given automaton.

For self
ontainment we state the result and its proof as follows.

Theorem 6.1.3. Regular sets are
losed under
omplement.

We are required to prove that if L is a regular set and L , then L is

also a regular set. Let L be the language re
ognized by a DFA M = hQ; 1 ; Æ; q0 ; F i andl

let L . First we may assume 1 = , for if there are symbols in 1 not in , we

may delete all su
h transitions in M with symbols not in . The fa
t that L assures

that we shall not thereby
hange the language of M . If there are symbols in not in 1 ,

then by denition of M , none of these symbols appear in the words of L. We may therefore

introdu
e a dead state d into M with Æ(d; a) = d for ea
h a 2 , and Æ(q; a) = d for ea
h

q 2 Q and for ea
h a 2 1 .

Next the a
epting states of M are made non-a
epting and vi
e versa. In parti
ular d is

made a
epting. The automaton so formed after these transformation
learly a
epts L.

It should be noted that the proof requires M to be deterministi
and without transitions.

Proof:

**This result has signi
an
e in Regular-All-Paths evaluation. Given a regular expression
**

(or an automaton) we
an
ompute its
omplement as above, and and non-existen
e of a

omplement language path is equivalent all paths' satisfying the given expression. It would

appear at rst sight that sin
e the
onstru
tion in Theorem 6.1.3 is linear time in the input

automaton, the all paths problem polynomially redu
es to a path existen
e problem (whi
h

in turn
an be solved in polynomial time). The problem here is that the
onstru
tion in

Theorem 6.1.3 requires the input automaton to be deterministi
, but the automaton that we

an derive from the query in polynomial time is non-deterministi
. Even if the automaton

so
onstru
ted appears stru
turally deterministi
, it should be noted that the propositions

don't form an alphabet disjoint form in that several propositions may simultaneouly hold

on a single edge. We use the following result in formulating our approa
h to the evaluation.

Theorem 6.1.4. For a xed regular expression Regular-All-Paths may be
omputed in time

polynomial in the size of the
ontext graph.

Proof:

If the regular expression is assumed xed, it is onsidered a part of the problem

58

and not its input. Thus we
an ignore the
ost of
omputing its deterministi
equivalent and

thereby its
omplement. This redu
es the problem of Regular-All-Paths to Exists-RegularPath , whi
h in turn
an be solved in polynomial time as shown in se
tion 6.2.

**We will use the fa
t in Theorem 6.1.4 to divide the evaluation of the regular all paths
**

query into two sub-stages as follows.

**Generation of an evaluator
ode from a query.
**

Exe
ution of the evaluator
ode on an a
tual graph
ontext.

We guarantee that the se
ond stage of evaluation i.e. exe
ution of the generated evaluator

will take time polynomial in the size of the graph
ontext.

The exploding aspe
ts en
ountered in generating the evaluator are as follows.

**The number of DFA states
orresponding to the query NFA may be exponential in the
**

number of NFA states (and hen
e in the size of the regula expression in the query).

**The number of outgoing transitions at any state is exponential in the number of
**

outgoing non-ex
lusive predi
ates.

While
onstru
ting the DFA from the NFA, the rst explosion
ould not be prevented from

propagating to the running time of the exe
ution of the generated evaluator. The se
ond

explosion however
ould be prevented from ae
ting the evaluator's exe
ution time. If the

number of propositions that
an
ause a valid transition from a state

**6.2 Evaluation of the Exists-Path Query
**

Algorithm 6.1 iteratively
omputes a relation
ontaining pairs of nodes that are mutually

rea
hable by some path satisfying the regular expression. In the algorithm, let R(n1 ; s1 ; n2 ; s2 )

be the relation that there is an edge from n1 to n3 whi
h satises an (s1 ; s2 ) transition.

59

Algorithm 6.1.

AllPairExistsRegularPath

F R

while(true) begin

Fold F

H F [n3 =n2 ; s3 =s2 ; n2 =n1 ; s2 =s1 ℄

G 9s2; n2 (H ^ F )

F G[n2 =n3 ; s2 =s3 ℄

if(F == Fold ) break

end

return 9s1 ; s2 F ^ (s1 2 SSTART ) ^ (s2 2 SACCEPTING)

end

Chapter 7

Results

60

Chapter 8

**Con
lusion and S
ope for Future
**

Work

61

Bibliography

[1℄ Lapaugh, A., and Papadimitrou, C., The even-path problem for graphs and digraphs.

Networks, 14 (1984) pp. 507-513.

[2℄ Nedev, Zhivko Prodanov, Finding even simple path in dire
ted planar graph. SIAM

Journal on
omputing Vol 29, No. 2 pp. 685-695

[3℄ Mendelzon, A.O., and Wood,P.T., Finding regular simple paths in graph databases,

SIAM Journal on Computing, 24(6) De
ember 1995 pp. 1325-1358.

[4℄ S
hrijver,A., Finding k disjoint paths in a dire
ted planar graph, SIAM Journal on

Computing, 23(4), August 1994 pp. 780-788

[5℄ Bryant, R., Graph-based algorithms for boolean fun
tion manipulation. IEEE Transa
tions on Computers, C-35, 1986 pp. 677-691.

[6℄ Clarke, E., Grumberg, O., Model Che
king, MIT Press , 1998

[7℄ Clarke, E., Emerson, E.A., Sistla A.P., Automati
Veri
ation of Finite State Con
urrent Systems Using Temporal Logi
Spe
i
ations ACM Transa
tions on Programming

Languages and Systems, Vol. 8, No. 2 , April 1986, pp 244-263

[8℄ Bahar ,Iris, et al. Algebrai
De
ision Diagrams and their Appli
ations International

Conferen
e on Computer Aided Design, 1993

[9℄ Hop
roft, J.E., Motwani, R., Ullman, J.D., Introdu
tion to Automata Theory, Languages and Computation. Pearson Edu
ation, 2001

[10℄ Bur
h J. R. , Clarke E., et. al. Symboli
Model Che
king for Sequential Cir
uit Veri
ation. IEEE Transa
tions on CAD , 1994 , pp. 401-424.

[11℄ Bur
h J. R. , Clarke E., et. al. Symboli
Model Che
king : 1020 States and Beyond.

Information and Computation , 1992 , pp. 142-170.

62

63

[12℄ M
Millan, K, Symboli
Model Che
king:An Approa
h to the State Explosion Problem,

Kulwer A
ademi
Publishers, 1993

[13℄ Coudert, O., Madre, J.C., Berthet, C., Verifying temporal properties of sequential

ma
hines without building their state graphs. Computer Aided Veri
ation, vol. 3, of

DIMACS Series in Dis
rete Mathemati
s and Theoreti
al Computer S
ien
e, 1991.

[14℄ Tarjan R.E., A Unied Approa
h to Path Problems Journal of the ACM , Vol 28, No

3, July 1981, pp. 577-593

[15℄ Fast algorithms for solving path problems, Journal of the ACM, Vol 28, No 3, July

1981, pp. 594-614

[16℄ Sheng, L., Ozsoyoglu, Z.M., Ozsoyoglu, G., A Graph Query Language and its Query

Pro
essing, IEEE ICDE Conf., Australia, Mar
h 1999.

[17℄ Consens M., Mendelzon A., Graphlog: A visual formalism for real life re
ursion. ACM

Symposium on Prin
iples of Database Systems 1990.

[18℄ Ullman, J., Implementation of Logi
al Languages for Databases., ACM Transa
tions

on Database Systems, vol. 10, 1985

[19℄ Cruz I., Wood P., Mendelzon A., G+: re
ursive queries without re
ursion, Pro
eedings

of the 2nd International Conferen
e on Expert Database Systems, 1988, pp. 355-368.

[20℄ Miles Ohlri
h, Carl Ebeling, Eka Ginting and Lisa Sather, Subgemini: Identifying SubCir
uits using a Fast Subgraph Isomorphism Algorithm, Pro
. 30th Design Automation

Conferen
e, 31-37, 1993.

**[21℄ C. Ebeling and O. Zaji
ek, Validating VLSI Cir
uit Layout by Wirelist Comparison,
**

[22℄ Thomas Stephan Chanak, Netlist Pro
essing for Custom VLSI via pattern mat
hing.

PhD Thesis, Dept. of Ele
tri
al Engineering , Stanford University. Pro
. IEEE International Conferen
e on Computer Aided Design, 172-173, 1983.

[23℄ C. Ebeling, GeminiII: A Se
ond Generation Layout Validation Tool, Pro
. IEEE International Conferen
e on Computer Aided Design, 322-325, 1988.

[24℄ C. Bamji and J. Allen, GRASP: A Grammar-Based S
hemati
Parser, Pro
. 26th Design Automation Conferen
e, 448-453, 1989.

64

[25℄ Garey, M.R., Johnson, D.S., Computers and Intra
tability : A Guide to the Theory

and Pra
ti
e or NP-Completeness, W.H. Freeman and Co., New York, 1978

[26℄ Patthak, A.C., Bhatta
harya, I., Dasgupta, A., Dasgupta, P., Chakrabarti, P.P., Quantied Computation Tree Logi
, Information Pro
essing Letters, Feb 2002.

[27℄ Mandal, C.R., Cadouri, E., Chakrabarti,P.P., Chatterjee,Bijoy, Majumder,

Jayanta, et al Netlist Database Referen
e Manual 3.0 jointly released by

National Semi
ondu
tor Corp, and IIT Kharagpur, O
tober 17,2001. ( mail

to:bijoyns
.
om,pp
hak
se.iitkgp.ernet.in)

[28℄ Chatterjee, K., Chakrabarti, P.P., Dasgupta,P., A Bran
hing Time Temporal Framework for Quantitative Reasoning. (mail to : pp
hak
se.iitkgp.ernet.in)

[29℄ Karplus, K., Ex
lusion
onstraints, a new appli
ation of Graph Algorithms to VLSI design, Pro
eedings of the 4th MIT
onferen
e on advaan
ed resear
h in VLSI (Leiserson

ed.) 1986

[30℄ Papadimitriou, C.H., Computational Complexity, Addison-Wesley, 1994.

[31℄ Thomas H. Cormen , Charles E. Leiserson, Ronald, L. Rivest , Introdu
tion to Algorithms , Preiti
e Hall of India , 1998

[32℄ Douglas B. West, Introdu
tion to Graph Theory , Prenti
e Hall of India, 1999

[33℄ Codd, C.J. Relational Completeness of Database Sublanguages ,Database Systems ,

Courant Computer S
ien
e Symposium, Prenti
e Hall 1972

**[34℄ Date, C.J., An Introdu
tion to Database Systems, Addison Wesley, 3rd Edition, 1981
**

[35℄ Vardi, M.Y., Wolper, P.,An automata theoreti
approa
h to automati
program veri
ation Pro
eedings of the rst symposium on logi
in
omputer s
ien
e. Cambridge

MA, 1986, pp 322-331

[36℄ Craigen D, Gerhart S, Ralston T. Formal methods reality
he
k:industrial usage. IEEE

Trans Software Eng 1995 pp. 9098

[37℄ Ja
kson D., Wing, J., Lightweight formal methods. IEEE Computer 1996;April:2122

[38℄ H. De Man, I. Bolsens, E. Vanden Meers
h, J. Van Cleynenbreugel. "DIALOG, An

Expert Debugging System for MOS-VLSI Design", IEEE transa
tions on CAD Vol

CAD..4, N3, July 1985

65

[39℄ A. SAlz and Mark Horowitz "IRSIM:An in
remental MOS Swit
h-Level Simulator" ,

Pro
eedings of the 26th Design Automation Conferen
e, 1989

[40℄ H. De Man, I. Bolsens, E. Vanden Meers
h, J. Van Cleynenbreugel. "An Expert System for Logi
al and Ele
tri
al debugging of MOS VLSI networks", Pro
eedings of the

International Conferen
e on Computer Aided Design, 1984

**[41℄ A.Aho, "The Awk Programming Language", Addison Wesley , 1988
**

[42℄ Nagel, L.W.: "SPICE2: A Computer Program to Simulate Semi
ondu
tor Cir
uits."

Berkeley, Univ. of California, Ele
troni
Resear
h Laboratory. ERL-M520, 1975

**[43℄ Clayton B. M
Donald , "Symboli
Fun
tional and Timing Veri
ation of Transistor
**

Level Cir
uits" PhD Thesis , CMU Dept. of ECE, http://www.e
e.
mu.edu/
layton/dist/thesis.pdf

**[44℄ M. Kaufmann and R. S. Boyer,"The Boyer-Moore Theorem Prover and Its Intera
tive
**

Enhan
ement" Computers and Mathemati
s with Appli
ations, 29(2), 1995, pp. 27-62.

[45℄ P. G. Paulin and J. P. Knight, "Algorithms for high-level synthesis" ,IEEE D. & T. of

Computers, pp. 18-31, De
. 1989.

[46℄ C. Mandal and R. M. Zimmer, "High-level synthesis of stru tured data paths" IFIP

TC10 WG 10.5 International Conferen e on Computer Hardware Des ription Languages and Their Appli ations, pp. 92-94

**[47℄ Ja
ques Wenin, Johan Verhasselt, Mar
Van Camp, Jean Leonard, Pierre Guebels,
**

"Rule based VLSI veri
ation system
onstrained by layout parasiti
s",26th

ACM/IEEE Design Automation Conferen
e, 1989

**[48℄ N. F.Gon
alves, H.De Man "NORA, a ra
efree dynami
CMOS te
hnique for pipelined
**

logi
stru
tures", IEEE Journal of Solid State Cir
uits, Vol SC-18 June 1983

[49℄ G. Pelz, "An Interpreter for General Netlist Design Rule Che
king", Pro
eedings of the

29th Design Automation Conferen
e, 1992

**[50℄ J. Ousterhout "T
l and the Tk Toolkit", Addison Wesley, 1993
**

[51℄ Gregor Ki
zales, Jim Des Rivieres, Daniel G. Bobrow "The art of metaobje
t proto
ol",

MIT Press , Sep 1991

66

[52℄ Sonya E. Keene, "Obje
t-Oriented Programming in Common Lisp: A Programmer's

Guide to CLOS", Addison Wesley 1989

[53℄ Guy L., Jr. Steele, "Common Lisp: The Language", Digital Press , 1990

[54℄ Bipin Rajendran, Veerbhan Kheterpal, Abhishek Das, Jayanta Majumder, Chittaranjan Mandal, P. P. Chakrabarti. "Timing Analysis of Tree-Like RLC Cir
uits" IEEE

International Symposium on Cir
uits and Systems, May 2002

[55℄ Abhishek Das, "NEQTAR : A Tool for Timing Analysis of Cir uits",B.Te h dissertation, Dept of CSE, IIT Kharagpur, 2001

**[56℄ R. K. Patra, "Analysis and Veri
ation of Asyn
hronous Cir
uits", B.Te
h dissertation,
**

Dept of CSE, IIT Kharagpur, 2002

**[57℄ IEEE, "IEEE Standard Hardware Des
ription Language Based on the Verilog Hardware
**

Des
ription Language", IEEE Srd. 1364-1995, IEEE, 1995

[58℄ P. Moorby, D. Thomas, "The Verilog Hardware Des
ription Language", Kulwer A
ademi
, MA, 1991

**[59℄ J. Bhasker, "Verilog HDL Synthesis: A Pra
ti
al Primer", Star Galaxy Publi
ations,
**

1998

**[60℄ J.M. Berge, "VHDL Designer's Referen
e", Kulwer A
ademi
, 1992
**

[61℄ P.J. Ashenden, "The Designer's guide to VHDL", Morgan Kaufmann, 1994

[62℄ Kenneth H. Rosen (editor) "Handbook of Dis
rete and Combinatorial Mathemati
s",CRC press, 1999

- L4.pptuploaded byRoshdy AbdelRassoul
- Lect4 Stick Diagramuploaded bymanicks369601
- CMOS Solutionuploaded byMahmoud Salama
- vtu-old-question-papers_best.pdfuploaded bypoojabadiger
- nptel-cad2-02uploaded byAjaya Hs
- ht-12auploaded byneerarum
- 74HC245 Octal 3−State Noninverting Bus Transceiver.pdfuploaded byfarowarez
- 10.1.1.63.5333uploaded byGovinda Prasad Acharya
- Cadence Power Guideuploaded byEvy Foodlover
- 3 & 4th sem PEDuploaded byAnonymous 1MIgfL
- d 41022328uploaded byAnonymous 7VPPkWS8O
- Ji 3516041608uploaded byAnonymous 7VPPkWS8O
- VLSI Design Outcomes Mapping 2014-15 (1) (1)uploaded byashivaramakrishna
- Analog Questionsuploaded byhafeez_k_t
- Clock Powereduploaded bykmsathya1987
- Switches Gatesuploaded byPratyush Singh
- Verilog programs for digital basicsuploaded byRaja Sekhar
- 74HC4543uploaded byjnax101
- MOS characteristic -2uploaded byCow Gal
- Digital Logicuploaded byhoathinhdon
- VLSI CMOS Fabrication Technologyuploaded byRamanaButterfly
- uPD77016uploaded byRicardo Urio
- D flipflop.docxuploaded byDebopam Datta
- Previous Papers of 4/4 1st Semesteruploaded byMohammed Zama Khan
- 2st Ia 10ec56_set2uploaded bypatilrajuc
- Limits of CMOS Technology Scalinguploaded byIzzat Mustafa
- vlsiuploaded byLakshmi Sindhu
- Combinational Logic Gate Designuploaded byDebopam Datta
- qp_april2011_32_eee_vlsiuploaded byGopi Pavan Jonnadula
- Lecture 5uploaded byVenkata Kishore

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading