Download presentation
Presentation is loading. Please wait.
Published byKyle Dresser Modified over 9 years ago
1
Compiling Communicating Processes into Delay-Insensitive VLSI Circuits Alain J. Martin Department of Computer Science California Institute of Technology
2
Communicating Hardware Processes Inspired by: Hoare's communicating sequential processes (CSP). Dijkstra's guarded commands. Based on: Concurrent processes communicating by messagepassing.
3
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.
4
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
5
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
6
Communicating Hardware Processes Composition Operators There are three composition operators: The sequential operator: ;. The concurrent, or parallel, operator: ||. The coincident, or bullet, operator:..
7
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
8
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
9
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
10
Communicating Hardware Processes Other Properties If S 1 and S 2 are noninterfering, 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
11
Communicating Hardware Processes Control Structures Selection Repetition Deterministic and nondeterministic versions
12
Communicating Hardware Processes Deterministic selection: [G 1 ==> S 1 []... [] G n ==> S n ] G 1,..., G n are boolean expressions called guards. S 1,..., S n are parts of a program, or commands. G i ==> S i :a guarded command if G i evaluates to true then S i 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
13
Communicating Hardware Processes Nondeterministic selection: [G 1 ==> S 1 |... | G n ==> S n ] 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
14
Communicating Hardware Processes Deterministic repetition: *[G 1 ==> S 1 []... [] G n ==> S n ] G 1,..., G n are boolean expressions. S 1,..., S n are parts of a program. G i ==> S i :a guarded command if G i evaluates to true then S i is executed. After S i 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
15
Communicating Hardware Processes Nondeterministic repetition: *[G 1 ==> S 1 |... | G n ==> S n ] Identical to deterministic repetition except that multiple guards can be true at the same time. If multiple guards are true, one is selected arbitrarily.
16
Communicating Hardware Processes Wait command: [G]= [G ==> skip] Infinite repetition: *[S] = *[true ==> S] Reactive Process Structure *[[G 1 ==> S 1 []... [] G n ==> S n ]] Wait until some G i holds; execute S i ; repeat forever.
17
Communicating Hardware Processes Replication Construct Used to represent a list of syntactic objects. = S(n), if n = m S(n) op ( ), 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.
18
Communicating Hardware Processes Replication Construct Example: [ S(i)>] = [ G(0) ==> S(0) [] G(1) ==> S(1) [] G(2) ==> S(2) [] G(3) ==> S(3) ]
19
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
20
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.
21
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 can be called by assigning different names. Unlike procedures, each instance of a process can be called only once.
22
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)
23
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) p1p2 X Y p1p2 C
24
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
25
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.
26
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.
27
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 Merge XYXY Z
28
Communicating Hardware Processes One-place Buffer: BUF1=process(L?int(8), R!int(8)) x : int(8) *[L?x; R!x] end Buf L R
29
Communicating Hardware Processes N-place Buffer BUF(n) =process(L?int(8), R!int(8)) p(i : 0..n-1) : BUF1 chan p(0).L = BUF(n).L p(n-1).R = BUF(n).R end P(0) Buf(n).L p(0).L P(0).R P(1).L P(1) P(1).R p(2).L P(n-1) P(n-1).R Buf(n).R
30
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 putget in out
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.