Use trace algebra to formalize the YAPI model
description
Transcript of Use trace algebra to formalize the YAPI model
Use trace algebra to formalize the YAPI modelUse trace algebra to formalize the YAPI model
EE290N Spring2002
Alessandro Pinto
Mentors: Roberto Passerone
Jerry Burch
OutlineOutline
References
Introduction to YAPI
Implication of select
Introduction to Trace Algebra
Traces to model YAPI
Buffer model
Conservative Approximation
Example
Conclusion
ReferencesReferences
K.A. Vissers et. al. “YAPI: Application Modeling for Signal Processing System”, DAC00
J. Burch, R. Passerone, ASV “Overcoming Heterophobia: Modeling Concurrency in Heterogeneous Systems”
J. Burch, R. Passerone, ASV “Modeling Techniques in Design-by-Refinement Methodologies”
E.A. Lee, T.M. Parks “Dataflow Process Networks”
G. Kahn, “The Semantics of a Simple Language for Parallel Programming”
G. Kahn, D.B. MacQueen, “Corutines and Networks of Parallel Processes”
The YAPI Model 1The YAPI Model 1
KPN (blocking read, non-blocking write)
Non-determinism
i1
i2
oread(i1,i1_int,1) ;read(i2,i2_int,1);o_int=in1_int+in2_int ;write(o,o_int,1) ;
),...,,,( 2211 kk npnpnpselects
The YAPI Model 2The YAPI Model 2
Selection can be done on input and output
Read,Write on unbounded FIFOs
Read,Write on bounded FIFOs
YAPI
TTL
Implication of selectImplication of select
continuitymonotonicity determinacy
i1=[1], i2=[]
F(i1,i2) = [1]
i1=[1,1], i2=[2]
F(i1,i2) = [2,1]o
if (select(i1,1,i2,1) == 1) read(i1,o_int,1);else read(i2,o_int,1);write(o,o_int,1);
i1
i2
read(i,i_int,1);if (select(o1,1,o2,1) == 1) write(o1,i_int,1);else write(o2,i1_int,1);
i
o1
o2
i=[1]
F(i) = ([1],[])
i=[1,3]
F(i) = ([1],[3]), ([3],[1]), ([1,3],[]) …
Trace Algebra 1Trace Algebra 1
Concurrency Algebra• Set of agents• Parallel composition of agents• Projection of agents• Renaming of agents
Trace structure algebra
A
Model of individual behaviors
Model of agents
Trace algebra
C
Trace Algebra• Set of traces• Projection of traces• Renaming of traces
Source: R. Passerone
I1=[1,3,4,-1]
I2=[0,3,5,2]
O=[1,6,9,1]
i1 oi2 +
Trace Algebra 2Trace Algebra 2
Alphabet
Set of traces over alphabet A
Renaming y = rename(r) (x) where x is a trace and r is a renaming function
Projection y = proj(B)(x) where x is a trace and BA
Trace structure T=(,P) where is the signature and P B(A)
A set of axioms must be verified !!!!!!!
WA)(AB
Trace Algebra 3Trace Algebra 3
Trace structure algebra
A’
Trace structure algebra
A
Trace algebra
C
Trace algebra
C’
Homomorphismh
u linv
“Abstract” Domain
“Detailed” Domain
Let Tspec and Timpl be trace structures in A. Then
if u( Timpl ) l( Tspec ) then Timpl Tspec
Derive
Source: R. Passerone
Implication of select: Trace Algebra ViewImplication of select: Trace Algebra View Monotonicity is captured by projection
proj(I)(x) proj(I)(y) ⊑ proj(O)(x) proj(O)(y)⊑
For the previous example two traces belongs to the same process:
]1[
][2
]1[1
o
i
i
]1,2[
]2[2
]1,1[1
o
i
i
First step: Set of TracesFirst step: Set of Traces
Which set of traces should we choose?
Streams
Synchronous
DE
VAAB )(
)()( VANAB
)()( VAAB
Streams 1Streams 1
No timing information
KPN can be expressed on the same set of traces Continuity is a constraint on the trace structures
In this sense YAPI processes can form more trace structures then KPN
23,10
0,1,6,4,32
3,1,5,4,11
o
i
i
KPN
YAPI
Streams 2Streams 2
Operation on traces Renaming
Projection
Operation on trace structures
rfxrrename
VAfx
))((
:
BfxBproj
VAfx
|))((
:
)''))(''('))('(|{''||' PxAprojPxAprojxTTT
23,10
0,1,6,4,32
3,1,5,4,11
o
i
i
23,10
0,1,6,4,34
3,1,5,4,13
aux
i
i
23,10
0,1,6,4,32
3,1,5,4,11
o
i
i
0,1,6,4,32
3,1,5,4,11
i
i
A more detailed domain 1A more detailed domain 1
We want to capture two important things
Relative arrival time
Bounded FIFOs
Synchronous Domain
)()( VAAB V
A more detailed domain 2A more detailed domain 2
Renaming
Projection
rfxrrename
VAfx
))((
:
BfxBproj
VAfx
|))((
:
o
if (select(i1,1,i2,1,p,1)==3)read(p,op,1);
read(i1,i1_int,1);read(i2,i2_int,1);o_int=op(i1_int,i2_int);write(o,o_int,1);
i1
i2
p
3,2,11,8,4
,,,,
0,1,6,4,32
3,1,5,4,11
o
subsump
i
i
3,2,1,8,,4
,,,,,
0,,1,6,4,32
3,1,5,4,,11
o
subsump
i
i
Two possible traces
BuffersBuffers
Buffers are modeled as processes
The strict version of a sequence a is
We indicate with ak the sequence up to instant k
Definition of a buffer Trace structure TB=((I,O),P)
}][|][{ iaiaas
sssk
sk OIthbufferlengOlenIlenkxP )()(0,0|
Buffer ConstraintBuffer Constraint
3,2,11,8,4
,,,,
0,1,6,4,32
3,1,5,4,11
o
subsump
i
i
3,2,1,8,,,,4
,,,,,,,
0,,1,6,4,,,32
3,1,5,4,,,,11
o
subsump
i
i
0,1,6,4,32
3,1,5,4,11
o
o
o
i1
i2
p
o1
o2
Gen Buf1
Buf2
AddSub
Two possible traces of AddSub
T=Gen||Buf1||Buf2||AddSub
Bufferlength =2
Bufferlength =1
3,2,11,8,4
,,,,
o
subsump
3,2,1,8,,,,4
,,,,,,,
o
subsump
P
P
3,2,11,8,4
,,,,
o
subsump
3,2,1,8,,,,4
,,,,,,,
o
subsump
P
P
Conservative Approximation 1Conservative Approximation 1
Synch
Nondet KPN
Approximation Homomorphism
h(x)
VAAB )(
)()( VAAB
Conservative Approximation 2Conservative Approximation 2
h(P)
P
h is in general many to one so this is an upper bound
))(,( Phu
Detailed Domain
Abstract Domain
Conservative Approximation 2Conservative Approximation 2
h(P)
P
B(A) - P
h(B(A) – P)
h(P) - h(B(A) – P)
)))(()(,( PABhPhl
Detailed Domain
Abstract Domain
From Synch to ND-KPN 1From Synch to ND-KPN 1
Definition of the homomorphism
sVAxh )(
3,2,1,8,,4
,,,,,
0,,1,6,4,32
3,1,5,4,,11
o
subsump
i
i
3,2,1,8,4
,
0,1,6,4,32
3,1,5,4,11
o
subsump
i
ih(x)
From Synch to ND-KPN 2From Synch to ND-KPN 2
Let’s consider a process: If p is true add the inputs, if p is false subtract them
lu
]3,4[
],[
]5,3[2
]2,1[1
o
falsetruep
i
i
]3,4,[
],,[
]5,3,[2
]2,,1[1
o
falsetruep
i
i
]3,4,,[
],,,,[
]5,3,,[2
]2,1,,[1
o
falsetruep
i
i
h(x) h(x)
P ))(( PAB
Applications of the ApproximationApplications of the Approximation
Verification Problem
Design Problem
TTTAprojTTTAproj luu )||)(()())(||)()(( 2121
)())(||)()(()||)(( 2121 TTTAprojTTTAproj invinvinv
Example 1Example 1
Norm
n
iixxNorm
1
)(
2
n
iix
1
=(I,O) =(I,O) =(I,O)
Bufferlength=n
Example 1Example 1
2
n
iix
1
=(I,O) =(I,O) =(I,O)
Bufferlength=n
otherwiseIifkIkOVOIfP ,][][|)),(:( 2
Example 1Example 1
2
n
iix
1
=(I,O) =(I,O) =(I,O)
Bufferlength=n
otherwiseIifkIkOVOIfP ,][][|)),(:( 2
otherwiseIifkIkOVOIfP ,][][|)),(:(
Example 1Example 1
2
n
iix
1
=(I,O) =(I,O) =(I,O)
Bufferlength=n
otherwiseIifkIkOVOIfP ,][][|)),(:( 2
otherwiseIifkIkOVOIfP ,][][|)),(:(
otherwisekOkInkOnkkIVOIfPn
j
][,][][][|)),(:(1
Example 2Example 2
One possible execution
2
n
iix
1
]64,,16,,9,9,1[
]8,,4,,3,3,1[
o
i
]99,,,,,,,,,,,[
]64,16,9,9,1,,,,,,,[
o
i
]99,,,,,,,,,,,[
]99,,,,,,,,,,,[
o
i
Bufferlength=n
Example 3Example 3
2
n
iix
1
h(x)
2][][|),(: kIkOVOIfP
][][|),(: kIkOVOIfP
1
0
]*[][|),(:n
j
jnkIkOVOIfP
id
Example 4Example 4
One possible execution
2
n
iix
1
]64,16,9,9,1[
]8,4,3,3,1[
o
i
]99[
]64,16,9,9,1[
o
i
]99[
]99[
o
i
Example 4Example 4
Design problem
2
n
iix
1
2
n
iix
1
ConclusionConclusion
The YAPI model was a good motivation for this project
Trace algebra has been applied to describe the denotational semantics of the model at different level of abstraction
A Conservative approximation between Synchronous model and ND-KPN allows abstraction from one model to another for verification and design