compiling communicating processes into delay-insensitive vlsi circuits
Post on 21-Jan-2016
42 Views
Preview:
DESCRIPTION
TRANSCRIPT
Compiling Communicating Processes into Delay-Insensitive
VLSI Circuits
Alain J. Martin
Department of Computer ScienceCalifornia Institute of Technology
Communicating Hardware Processes
Inspired by: • Hoare's communicating sequential processes
(CSP). • Dijkstra's guarded commands. Based on: • Concurrent processes communicating by message passing.
Communicating Hardware Processes
Data Types • Only basic type is the boolean. • Other types are collections of booleans represented using PASCAL record notation. • Example: alu = record op : alu.15..alu.12 x : alu.11..alu.8 y : alu.7..alu.4 z : alu.3..alu.0 end • 8-bit integer x : x.0, x.1, ..., x.7.
Communicating Hardware Processes
Assignment:
• For a boolean b: • The command b:=true
assigns the value true to b (also denoted b+ or ).
• The command b:=false assigns the value false to b
(also denoted b- or ). • Given two integers x and y of the same length n: y := x ==> y.0, y.1, ..., y.(n-1) := x.0, x.1, ..., x.(n-1).
b
b
Communicating Hardware Processes
Arrays:
• Arrays are used when the identity of the element in a set of variables that is to be used for some action is determined during the computation.
• Example:
reg[i.z] := aluf (reg[i.x], reg[i.y], i.op)
Note: instruction i is of of type alu
Communicating Hardware Processes
Composition Operators • There are three composition operators:
• The sequential operator: ;. • The concurrent, or parallel, operator: ||. • The coincident, or bullet, operator: ..
Communicating Hardware Processes
Sequential Operator
• S 1;S 2 means first execute S 1 then execute S 2 .
• The ``;'' operator is associative: (S 1 ; S 2 ); S 3 = S 1 ; (S 2 ; S 3 )
• The ``;'' operator is NOT commutative: S 1 ; S 2 <> S 2 ; S 1
Communicating Hardware Processes
Parallel Operator
• S 1 || S 2 means S 1 and S 2 are executed in parallel.
• The || operator is associative and commutative:
(S 1 || S 2 ) || S 3 = S 1 || (S 2 || S 3 ) S 1 || S 2 = S 2 || S 1
Communicating Hardware Processes
Bullet Operator • S1.S2 means S1 and S2 complete simultaneously.
• The . operator is associative and commutative:
(S 1 . S 2 ) . S 3 = S 1 . (S 2 . S 3 )
S 1 . S 2 = S 2 . S 1
Communicating Hardware Processes
Other Properties
• If S 1 and S 2 are non interfering, S 1 || S 2 is equivalent to the execution of either
S 1 ; S 2 or S 2 ; S 1 or S 1 . S 2 .
• The operator precedence is: (1) . (2) ; (3) ||:
S 0 . S 1 ; S 2 || S 3 ===> ((S 0 . S 1 ); S 2 ) || S 3
Communicating Hardware Processes
Control Structures
• Selection • Repetition • Deterministic and non deterministic versions
Communicating Hardware Processes
Deterministic selection: [G1 ==> S1 [] ... [] Gn ==> Sn ]
• G1, ..., Gn are boolean expressions called guards. • S1 , ..., Sn are parts of a program, or commands. • Gi ==> Si :a guarded command if Gi evaluates to true then Si is executed. • At any time, at most one guard is true. • If no guard is true, the execution is suspended. • Exact one guarded command will be executed
Communicating Hardware Processes
Non deterministic selection: [G1 ==> S1 | ... | Gn ==> Sn ]
• Identical to deterministic selection except that multiple guards can be true at the same time. • If multiple guards are true, one is selected arbitrarily. • Exact one guarded command will be executed
Communicating Hardware Processes
Deterministic repetition: *[G1 ==> S1 [] ... [] Gn ==> Sn ]
• G1, ..., Gn are boolean expressions. • S1 , ..., Sn are parts of a program. • Gi ==> Si :a guarded command if Gi evaluates to true then Si is executed. • After Si completes, control returns to the start. • At any time, at most one guard is true. • If no guard is true, the repetition terminates. • Zero, one or more guarded commands can be executed
Communicating Hardware Processes
Non deterministic repetition: *[G1 ==> S1 | ... | Gn ==> Sn ]
• Identical to deterministic repetition except that multiple guards can be true at the same time. • If multiple guards are true, one is selected arbitrarily.
Communicating Hardware Processes
• Wait command:
[G]= [G ==> skip]
• Infinite repetition: *[S] = *[true ==> S]
• Reactive Process Structure
*[[G1 ==> S1 [] ... [] Gn ==> Sn ]]
Wait until some Gi holds; execute Si ;
repeat forever.
Communicating Hardware Processes
Replication Construct • Used to represent a list of syntactic objects. <op i : n..m : S(i)> =
S(n), if n = m S(n) op (<op i : n+1..m : S(i)>), if n < m
• op is any constructor (;,.,||) or separator ([],|,``,'',`` ''), • i is an integer variable, called the running index, • the range, defined by n..m, where n and m are integer constants, is not empty, i.e., n <= m, • S(i) is any program part in which i appears free.
Communicating Hardware Processes
Replication Construct • Example:
[<[] i : 0..3 : G(i) ==> S(i)>] =
[ G(0) ==> S(0) [] G(1) ==> S(1) [] G(2) ==> S(2) [] G(3) ==> S(3) ]
Communicating Hardware Processes
Procedures • Procedure parameters are either input or output. • Example: procedure p(x : input; y : output); S
• The procedure call p(a, b) is equivalent to:
x := a; S; b := y
Communicating Hardware Processes
Functions • Function parameters are always inputs. • Example: function y(x); S where S is the same program part as in
procedure p.
Communicating Hardware Processes
Concurrent Processes • Main building block of a computation is a process. • Body of a concurrent computation is of the form: p1 || p2 || . . . || pn where p1 through pn are processes. • Several instances of the same process type canbe called by assigning different names. • Unlike procedures, each instance of a processcan be called only once.
Communicating Hardware Processes
Communication Commands,Ports, & Channels
• Processes communicate by using communication commands on ports. • Ports are declared in the heading of a process: p = process(R, L) • A port of a process is paired with a port of another process to form a channel. p1 =process(X) . . . end p2 =process(Y) . . . end p1 || p2 chan(p1.X, p2.Y)
Communicating Hardware Processes
• Example: p1 =process(X) . . . end p2 =process(Y) . . . end p1 || p2 chan(p1.X, p2.Y) • Equivalent to: p1 =process(C) . . . end p2 =process(C) . . . end p1 || p2 chan(C)
p1 p2X Y
p1 p2 C
Communicating Hardware Processes
Semantics of Synchronization • Number of completed receive actions cR cannot exceed the number of completed send actions cS:
cR <= cS
• Without buffering, if two processes p1 and p2 share a channel with port X in p1 and port Y in p2 , then
cX = cY
Communicating Hardware Processes
Probe • If p1 reaches the n th X-action before p2 reaches the n th Y-action, the completion of X is suspended until p2 reaches Y. • The X-action is said to be pending. • The predicate ``X is pending'' is denoted qX. •The probe X in process p1 is the same value as qY.
Communicating Hardware Processes
Communication • Matching communication actions ``pass messages''. • X? is an input command on the input port X. • Y! is an output command on the output port Y. • X?u and Y!v implement the assignment v := u.
Communicating Hardware Processes
Stream Merge:
MERGE = process(X?int(8), Y?int(8), Z!int(8)) u : int(8)
*[ [ X ==>X?u; Z!u
| Y ==>Y?u; Z!u
] ]end
MergeX
YZ
Communicating Hardware Processes
One-place Buffer:
BUF1=process(L?int(8), R!int(8)) x : int(8) *[L?x; R!x] end
BufL R
Communicating Hardware Processes
N-place Buffer
BUF(n) =process(L?int(8), R!int(8)) p(i : 0..n-1) : BUF1 <|| i : 0..n-1 : p(i)> chan<i : 0..n-2 : (p(i).R,p(i+1).L))> p(0).L = BUF(n).L p(n-1).R = BUF(n).R end
P(0)Buf(n).Lp(0).L
P(0).RP(1).L P(1)
P(1).Rp(2).L P(n-1)
P(n-1).RBuf(n).R
Communicating Hardware Processes
Lazy Stack
Stack element:Empty=[ in ==> in?x;Full
[] out ==> get?x;out!x;Empty ]
Full =[ out ==> out!x;Empty [] in ==> put!x;in?x;Full ]
head
Tail
in out
put get
in out
top related