You are on page 1of 76

Petrify: Method and Tool for Synthesis of Asynchronous Controllers and Interfaces

Jordi Cortadella (UPC, Barcelona, Spain), Mike Kishinevsky (Intel Strategic CAD Labs, Oregon), Alex Kondratyev (Berkeley Cadence Research Labs, CA), Luciano Lavagno (Politecnico di Torino, Italy ), Alex Yakovlev (University of Newcastle, UK)

Outline
Part 1: The Petrify Method
Overview of the Petrify synthesis flow Specification: Signal Tranistion Graphs State graph and next-state functions State encoding Implementation conditions Speed-independent circuits
Complex gates C-element architecture

ASYNC2003 - Tutorial on Petrify Method and Tool

Design flow
Specification (STG)
Reachability analysis

State Graph
State encoding

SG with CSC
Boolean minimization

Next-state functions
Logic decomposition

Decomposed functions
Technology mapping

Gate netlist
ASYNC2003 - Tutorial on Petrify Method and Tool 3

Specification
x y
z

x
y z z+ x-

x+

y+
y-

z-

Signal Transition Graph (STG)


ASYNC2003 - Tutorial on Petrify Method and Tool 4

Token flow
x y z z+ x+ y+ yxz-

ASYNC2003 - Tutorial on Petrify Method and Tool

State graph
xyz 000
x+ z+

100

z+ x+ y+ y-

xzyx-

y+

101
y+

110 111
xz+

001
y+

011
z-

010
ASYNC2003 - Tutorial on Petrify Method and Tool 6

Next-state functions
xyz 000
x+

x z (x y)

z+ x-

100

y+

y zx
z x y z

101
y+

110 111
xz+

y-

001
y+

011
z-

010
ASYNC2003 - Tutorial on Petrify Method and Tool 7

Gate netlist

x z (x y)

x y

y zx
z x y z

ASYNC2003 - Tutorial on Petrify Method and Tool

Design flow
Specification (STG)
Reachability analysis

State Graph
State encoding

SG with CSC
Boolean minimization

Next-state functions
Logic decomposition

Decomposed functions
Technology mapping

Gate netlist
ASYNC2003 - Tutorial on Petrify Method and Tool 9

VME bus
Bus
DSr Data Transceiver LDS

LDTACK D DSr DSw DTACK DTACK LDS VME Bus Controller LDTACK D

Device

Read Cycle

ASYNC2003 - Tutorial on Petrify Method and Tool

10

STG for the READ cycle


DSr+ DTACK-

LDS+

LDTACK+

D+

DTACK+

DSr-

D-

LDTACK-

LDS-

D DSr DTACK VME Bus Controller

LDS
LDTACK

ASYNC2003 - Tutorial on Petrify Method and Tool

11

Choice: Read and Write cycles


DSr+ LDS+ LDTACK+ LDTACKD+ DTACK+ LDSDSrDDTACKDTACKDSw+ D+ LDS+ LDTACK+ DDTACK+ DSw12

LDTACK-

LDS-

ASYNC2003 - Tutorial on Petrify Method and Tool

Choice: Read and Write cycles


DSr+ LDS+ LDTACK+ LDTACKD+ DTACK+ LDSDSrDDTACKDTACKDSw+ D+ LDS+ LDTACK+ DDTACK+ DSw13

LDTACK-

LDS-

ASYNC2003 - Tutorial on Petrify Method and Tool

Choice: Read and Write cycles


DSr+ LDS+ LDTACK+ LDTACKD+ DTACK+ LDSDSrDDTACKDTACKDSw+ D+ LDS+ LDTACK+ DDTACK+ DSw14

LDTACK-

LDS-

ASYNC2003 - Tutorial on Petrify Method and Tool

Circuit synthesis
Goal:
Derive a hazard-free circuit under a given delay model and mode of operation

ASYNC2003 - Tutorial on Petrify Method and Tool

15

Speed independence
Delay model
Unbounded gate / environment delays Certain wire delays shorter than certain paths in the circuit

Conditions for implementability:


Consistency Complete State Coding Persistency

ASYNC2003 - Tutorial on Petrify Method and Tool

16

Design flow
Specification (STG)
Reachability analysis

State Graph
State encoding

SG with CSC
Boolean minimization

Next-state functions
Logic decomposition

Decomposed functions
Technology mapping

Gate netlist
ASYNC2003 - Tutorial on Petrify Method and Tool 17

STG for the READ cycle


DSr+ DTACK-

LDS+

LDTACK+

D+

DTACK+

DSr-

D-

LDTACK-

LDS-

D DSr DTACK VME Bus Controller

LDS
LDTACK

ASYNC2003 - Tutorial on Petrify Method and Tool

18

Binary encoding of signals


DSr+
LDS+

DTACK-

LDTACKDSr+

LDTACKDTACK-

LDTACK-

LDTACK+

LDSDSr+

LDSDTACK-

LDS-

D+

DDTACK+ DSr-

ASYNC2003 - Tutorial on Petrify Method and Tool

19

Binary encoding of signals


10000
LDS+

DSr+

DTACK-

LDTACKDSr+

LDTACKDTACK-

LDTACK-

10010
LDTACK+

01100
LDS-

LDSDSr+

LDSDTACK-

10110
D+

01110

10110

00110
D-

DTACK+

DSr-

(DSr , DTACK , LDTACK , LDS , D)

ASYNC2003 - Tutorial on Petrify Method and Tool

20

Excitation / Quiescent Regions


ER (LDS+)
LDS+

QR (LDS-)
LDS-

LDS-

LDS-

QR (LDS+)

ER (LDS-)

ASYNC2003 - Tutorial on Petrify Method and Tool

21

Next-state function
01
LDS+

00
LDSLDS-

11
10110

LDS-

10
10110

ASYNC2003 - Tutorial on Petrify Method and Tool

22

Karnaugh map for LDS


LDS = 0
D LDTACK DTACK DSr

LDS = 1 10
D LDTACK DTACK DSr

00

01

11

00

01

11

10

00

00

01

01

1 0

11 10

11 10

- 0/1?
23

ASYNC2003 - Tutorial on Petrify Method and Tool

Design flow
Specification (STG)
Reachability analysis

State Graph
State encoding

SG with CSC
Boolean minimization

Next-state functions
Logic decomposition

Decomposed functions
Technology mapping

Gate netlist
ASYNC2003 - Tutorial on Petrify Method and Tool 24

Concurrency reduction
DSr+
LDS+ DSr+

LDSDSr+

LDS-

LDS-

10110 10110

ASYNC2003 - Tutorial on Petrify Method and Tool

25

Concurrency reduction

DSr+

DTACK-

LDS+

LDTACK+

D+

DTACK+

DSr-

D-

LDTACK-

LDS-

ASYNC2003 - Tutorial on Petrify Method and Tool

26

State encoding conflicts

LDS+

LDTACK-

LDTACK+

LDS-

10110 10110

ASYNC2003 - Tutorial on Petrify Method and Tool

27

Signal Insertion
CSC+

LDS+

LDTACK-

LDTACK+

LDS-

101101 101100
D-

DSr-

CSC-

ASYNC2003 - Tutorial on Petrify Method and Tool

28

Design flow
Specification (STG)
Reachability analysis

State Graph
State encoding

SG with CSC
Boolean minimization

Next-state functions
Logic decomposition

Decomposed functions
Technology mapping

Gate netlist
ASYNC2003 - Tutorial on Petrify Method and Tool 29

Complex-gate implementation
LDS D csc DTACK D D LDTACKcsc csc DSr (csc LDTACK )
ASYNC2003 - Tutorial on Petrify Method and Tool 30

Implementation conditions
Consistency
Rising and falling transitions of each signal alternate in any trace

Complete state coding (CSC)


Next-state functions correctly defined

Persistency
No event can be disabled by another event (unless they are both inputs)
ASYNC2003 - Tutorial on Petrify Method and Tool 31

Implementation conditions
Consistency + CSC + persistency

There exists a speed-independent circuit that implements the behavior of the STG
(under the assumption that ay Boolean function can be implemented with one complex gate)
ASYNC2003 - Tutorial on Petrify Method and Tool 32

Persistency
100
b+ a c b is this a pulse ? Speed independence glitch-free output behavior under any delay
ASYNC2003 - Tutorial on Petrify Method and Tool 33

a-

000

c+

001
b+

a c

a+
b+ a-

0000
a+

1000
b+

1100
a-

c+
d+ a+ b-

0100
c+

0110
d+ d-

0111
a+

1111
ba-

1011
c- a-

c-

ad-

c-

0011

1001

0001

ab cd
00 01 00 01 11 10

0000
a+

0 0 1

0 1

1000
b+

1100
a-

0100
ER(d+)
c+

11 10

1 1

0110
d+ d-

0111
a+

1111
ba-

1011
c- a-

c-

0011
ER(d-)

1001

0001

ab cd
00 01 00 01 11 10

0000
a+

0 0 1

0 1

1000
b+

1100
a-

0100
c+

11 10

1 1

0110
d+ d-

0111
a+

1111

d ad ac
Complex gate

ba-

1011
c- a-

c-

0011

1001

0001

Implementation with C elements


S

S+ z+ S- R+ z- R-
S (set) and R (reset) must be mutually exclusive S must cover ER(z+) and must not intersect ER(z-) QR(z-) R must cover ER(z-) and must not intersect ER(z+) QR(z+)

ASYNC2003 - Tutorial on Petrify Method and Tool

37

ab cd
00 01 00 01 11 10

0000
a+

0 0 1

0 1

1000
b+

1100
a-

0100
c+

11 10

1 1

0110
d+ d-

0111
a+

1111
b-

S R

ac

a-

1011
c- a-

c-

0011

1001

0001

0000
a+

1000
b+

1100

but ...
c
S R

a-

0100
c+

0110
d+ d-

0111
a+

1111
b-

ac

a-

1011
c- a-

c-

0011

1001

0001

Assume that R=ac has an unbounded delay Starting from state 0000 (R=1 and S=0):
a+ ; R- ; b+ ; a- ; c+ ; S+ ; d+ ; R+ disabled (potential glitch)

0000
a+

1000
b+

1100
a-

0100
c+

0110
d+ d-

0111
a+

1111
b-

S R

ac

a-

1011
c- a-

c-

0011

1001

0001

ab cd
00 01 00 01 11 10

0000
a+

0 0 1

0 1

1000
b+

1100
a-

0100
c+

11 10

1 1

0110
d+ d-

0111
a+

1111
b-

S R

ab c

a-

1011
c- a-

c-

0011

1001

0001

Monotonic covers

C-based implementations
c
S R

ab c
c

c b a

weak

d a b

weak

d a

generalized C elements (gC)


ASYNC2003 - Tutorial on Petrify Method and Tool 42

Speed-independent implementations
Implementation conditions
Consistency Complete state coding Persistency

Circuit architectures
Complex (hazard-free) gates C elements with monotonic covers ...
ASYNC2003 - Tutorial on Petrify Method and Tool 43

Synthesis exercise
yz1001 yw0001 1011 w+

y+

1000

z-

w-

w+

w- z0000

x+
0011 x0111

1010

w- y+ 0010

0101 x+ z0100 z+

y+

x+
z+

x-

x+ y+ 0110

Derive circuits for signals x and z (complex gates and monotonic covers)
ASYNC2003 - Tutorial on Petrify Method and Tool 44

Synthesis exercise
wx

z00 01 11 10

1001

yw0001

1011 w+

yz

00 01

1
1 0 1

1 1 0 1

y+
1010

1000

w- z0000

x+
0011 x0111

0
0 0

w- y+ 0010

0101 x+ z0100 z+

11 10

x+ y+ 0110

Signal x
ASYNC2003 - Tutorial on Petrify Method and Tool 45

Synthesis exercise
wx

z00 01 11 10

1001

yw0001

1011 w+

yz

00 01

0 0 1 0

0 0

y+
1010

1000

w- z0000

x+
0011 x0111

0 1
0

w- y+ 0010

0101 x+ z0100 z+

11 10

1
1

x+ y+ 0110

Signal z
ASYNC2003 - Tutorial on Petrify Method and Tool 46

A simple filter: specification


Ain Rin IN

y := 0; loop x := READ (IN); WRITE (OUT, (x+y)/2); y := x; end loop

filter

Aout Rout OUT

ASYNC2003 - Tutorial on Petrify Method and Tool

47

A simple filter: block diagram

+ IN
Rin Ain
Rx

x
Ax Ry

y
Ay Ra Aa

OUT

control

Rout Aout

x and y are level-sensitive latches (transparent when R=1) + is a bundled-data adder (matched delay between Ra and Aa) Rin indicates the validity of IN After Ain+ the environment is allowed to change IN (Rout,Aout) control a level-sensitive latch at the output
ASYNC2003 - Tutorial on Petrify Method and Tool 48

A simple filter: control spec.


IN
Rin Ain Rx

x
Ax Ry

y
Ay Ra

+
Aa

OUT

control Rx+ Ax+ RxAxRy+ Ay+ RyAyRa+ Aa + Ra-

Rout Aout

Rin+

Rout+ Aout+ RoutAout49

Ain+
Rin-

Ain-

Aa-

ASYNC2003 - Tutorial on Petrify Method and Tool

A simple filter: control impl.


Rx Ax Ay Ry Ra Aa

Ain

Aout Rout

Rin

Rin+

Rx+
Ax+

Ry+ Ay+ RyAy-

Ra+ Aa+ RaAa-

Rout+ Aout+ RoutAout50

Ain+
Rin-

RxAx-

Ain-

ASYNC2003 - Tutorial on Petrify Method and Tool

Control: observable behavior


Rx Ax Ay Ry R a Aa

z Ain Rin

Aout C Rout

Rin+

AinRyA a+ zRout+

R x+
A x+

A aRinAout+

R aAin+ z+

AyR a+

A xRout-

R xAout-

Ay+ Ry+

ASYNC2003 - Tutorial on Petrify Method and Tool

51

Following slides borrowed from Ran Ginosar, Technion (VLSI Architectures course) with thanks

ASYNC2003 - Tutorial on Petrify Method and Tool

52

Generalized C Element
a b c
c b

+ C -

set(z) = ab reset(z) = b'c'

reset z

c c b a z b a b

reset

set z

c b a

a z

b a

set

set

reset

DYNAMIC (Pseudostatic)

STATIC

From Ran Ginosars course


ASYNC2003 - Tutorial on Petrify Method and Tool 53

STG Rules
Any STG:
Input free-choiceOnly inputs may control the choice) BoundedMaximum k (given bound) token per place Livenessevery signal transition can be activated

STG for Speed Independent circuits:


Consistent state assignmentSignals strictly alternate between + and PersistencyExcited non-input signals must fire, namely they cannot be disabled by another transition

Synthesizable STG:
Complete state codingDifferent markings must represent different states
ASYNC2003 - Tutorial on Petrify Method and Tool 54

We use the following circuit to explain STG rules:

req ack

REQ ACK

ASYNC2003 - Tutorial on Petrify Method and Tool

55

1-Bounded (Safety)
STG is safe if no place or arc can ever contain more than one token Often caused by one-sided dependency

req+ ack-

ack+ req-

REQ+ ACK-

ACK+ REQ-

STG is not safe: If left cycle goes fast and right cycle lags, then arc ack+ REQ+ accumulates tokens. (REQ+ depends on both ack+ and ACK- ) Possible solution: stop left cycle by right cycle
ASYNC2003 - Tutorial on Petrify Method and Tool 56

Liveness
STG is live if from every reachable marking, every transition can eventually be fired

reset-

reset_ok-

req+ ack-

ack+ req-

The STG is not live: Transitions reset, reset_ok cannot be repeated. But non-liveness is useful for initialization
ASYNC2003 - Tutorial on Petrify Method and Tool 57

Consistent state assignment


The following subgraph of STG makes no sense:

a+

a+

a-

a-

ASYNC2003 - Tutorial on Petrify Method and Tool

58

Persistency
STG is persistent if for all non-input transitions once enabled the transition cannot be disabled by another transitions. Non-persistency may be caused by arbitration or dynamic conflict relations STG must have places
ackreqreq+ ack+ REQ+ ACKACK+ REQ-

STG is not persistent: there is a place between req+ andack+ in which a token is needed in order to fire REQ+ . So there is some sort of nondeterminism either REQ+ manages to fire before ack+ or not Possible solution: introduce proper dependence of the left cylce on the right one (e.g., an arc from req+ to REQ+, and from REQ+ to ack+)
ASYNC2003 - Tutorial on Petrify Method and Tool 59

Complete State Coding


STG has a complete state coding if no two different markings have identical values for all signals.
req,ack,REQ,ACK:

ack0100

0000

req+ ack+

1000

1010

REQ+ ACK1000

ACK+
1011

reqcd\ab 00 00 01 11 10

REQ1001

1100

01

11

10

Disaster!

60

Complete State Coding


Possible solution: Add an internal state variable
req,ack,REQ,ACK,x:

ack-

req+

10000

10100

REQ+

ACK+

x-

x+

req-

ack+
11001 10001

ACK-

REQ-

ASYNC2003 - Tutorial on Petrify Method and Tool

61

A faster STG?
Does it need an extra variable?
req+ REQ+

ack+

ACK+

req-

REQ-

ack-

ACK62

ASYNC2003 - Tutorial on Petrify Method and Tool

STG specification in .astg format


.model simple_buffer .inputs r A .outputs a R .graph # left handshake (r,a) r+ a+ a+ rr- aa- r+ # right handshake (R,A) R+ A+ A+ RR- AA- R+ # interaction between handshakes r+ R+ A+ a.marking{<a-,r+><A-,R+>} .end
ASYNC2003 - Tutorial on Petrify Method and Tool 63

Drawn by draw_astg

ASYNC2003 - Tutorial on Petrify Method and Tool

64

The SG
req,ack,REQ,ACK: 0000 r+ 1000 R+ a+ 1100 1010 R+ ra+ 0100 1110 A+ R+ ar0110 1111 A+ ar0111 Ra0011 0101 Rr+ a1011 0001 RAa+ r+ 1111 1001 RAra+ 0111 1101 ARra0101 Aa-

A+
1011 Ra+ 1001 RAa+ 1101 1000 Ara+ 1100 Ar0100 a-

65

The SG
req,ack,REQ,ACK: 0000 r+ 1000 R+ a+ 1100 1010 R+ ra+ 0100 1110 A+ R+ ar0110 1111 A+ ar0111 Ra0011 0101 Rr+ a1011 0001 RAa+ r+ 1111 1001 RAra+ 0111 1101 ARra0101 Aa-

A+
1011 Ra+ 1001 Ra+ 1101 Ar1100 Ar0100 R+ a-

A1000 R+ a+ R+

CSC-conflict states are highlighted


66

Drawn by write_sg & draw_astg

ASYNC2003 - Tutorial on Petrify Method and Tool

67

Extra states inserted by petrify

ASYNC2003 - Tutorial on Petrify Method and Tool

68

Rearranged STG
req+ REQ+ ACK+ c2REQACKc2+ c0+

c1ack+ reqc1+ c0ack-

Initial Internal State: c0=c1=c2=1


ASYNC2003 - Tutorial on Petrify Method and Tool 69

The new State Graph

ASYNC2003 - Tutorial on Petrify Method and Tool

70

The Synthesized Complex Gates Circuit


INORDER = r A a R csc0 csc1 csc2; OUTORDER = [a] [R] [csc0] [csc1] [csc2]; [a] = a (csc2 + csc0) + csc1'; [R] = csc2 (csc0 (a + r) + R); [csc0] = csc0 (csc1' + a') + R' csc2; [csc1] = r' (csc0 + csc1); [csc2] = A' (csc0' (csc1' + a') + csc2);

ASYNC2003 - Tutorial on Petrify Method and Tool

71

Technology Mapping
INORDER = r A a R csc0 csc1 csc2; OUTORDER = [a] [R] [csc0] [csc1] [csc2]; [0] = R'; [1] = [0]' A' + csc2'; [a] = a csc0' + [1]; [3] = csc1'; [4] = csc0' csc2' [3]'; [5] = [4]' (csc1' + R'); [R] = [5]'; [7] = (csc2' + a') (csc0' + A'); [8] = csc0'; [csc0] = [8]' csc1' + [7]'; [csc1] = A' (csc0 + csc1); [11] = R'; [12] = csc0' ([11]' + csc1'); [csc2] = [12] (r' + csc2) + r' csc2;
# # # # # # # # # # # # # # gate gate gate gate gate gate gate gate gate gate gate gate gate gate inv: combinational oai12: combinational sr_nor: asynch inv: combinational nor3: combinational aoi12: combinational inv: combinational aoi22: combinational inv: combinational oai12: combinational rs_nor: asynch inv: combinational aoi12: combinational c_element1:asynch

ASYNC2003 - Tutorial on Petrify Method and Tool

72

The Synthesized Gen-C Circuit


INORDER = r A a R csc0 csc1 csc2; OUTORDER = [a] [R] [csc0] [csc1] [csc2]; [0] = csc0' csc1 (R' + A); [1] = csc0 csc2 (a + r); [2] = csc2' A; [R] = R [2]' + [1]; # mappable [4] = a csc1 csc2'; [csc0] = csc0 [4]' + csc2; # mappable [6] = r' csc0; [csc1] = csc1 r' + [6]; # mappable [8] = A' csc0' (csc1' + a'); [csc2] = csc2 R' + [8]; # mappable [a] = a [0]' + csc1'; # mappable

onto gC
onto gC onto gC onto gC onto gC

ASYNC2003 - Tutorial on Petrify Method and Tool

73

Petrify Environment

write_sg

STG

petrify

lib

SG

draw_astg

EQN

ps

ASYNC2003 - Tutorial on Petrify Method and Tool

74

Petrify
Unix (Linux) command line tool petrify h for help (flags etc.) petrify cg for complex gates petrify gc for generalized C-elements petrify tm for tech mapping draw_astg to draw write_sg to create state graphs Documented on line, including tutorial

ASYNC2003 - Tutorial on Petrify Method and Tool

75

References
See the attached Practical Exercise manual for various design examples using Petrify commands Additional references:
Petrify and all documentation can be downloaded from: http://www.lsi.upc.es/~jordic/petrify/petrify.html J. Cortadella, M. Kishinevsky, A. Kondratyev, L. Lavagno and A. Yakovlev, Logic Synthesis of Asynchronous Controllers and Interfaces, Springer, Berlin, 2002, ISBN3-540-43152-7

ASYNC2003 - Tutorial on Petrify Method and Tool

76

You might also like