Download Production Rule

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Compiling Communicating
Processes into Delay-Insensitive
VLSI Circuits
Alain J. Martin
Department of Computer Science
California Institute of Technology
Production Rule
Production rules:
if C then A
if condition C is true then Perform action A
Example:
if A and B then C
Production rule: A B  C
Production Rule
• CMOS transistors can be modeled by a set of PRs.
Example: inverter:
a b 
a  b 
Pull-up network
a
b
Pull-down network
Production Rule
General Model
• Pull-up network: a PR that makes z=true
• Pull-down network: a PR that makes z=false
Pull-up network
Z
Pull-down network
Production Rule
One-input operators:
• Wire
a b 
a  b 
• Fork
a b c 
a  b  c 
• inverter
a b 
a  b 
a
b
a
b
c
a
b
Production Rule
Two-input operators:
1
1
• And
a
b
a b  c 
c
a  b  c 
0
1
• OR
a
b
ab c
c a  b  c 
0
0
Production Rule
• Nand
a
b
c
a b  c 
a  b  c 
1
1
0
1
• Nor
a
b
c
ab  c 
 a  b  c 
0
0
Production Rule
• XOR
a b c 
a  b c 
• EQ
a b c 
a  b c 
a
• C-element
a b  c 
a  b  c 
c
b
Production Rule
• Switch
a b  c 
a  b  c 
a
SW
c
b
• SR-latch
s q
r q
r
s
SR
q
q’
Production Rule
Multi-input operators:
• Multiplexer
( s  a )( s b ) c 
( s  a )( s  b ) c 
a
b
mux
s
c
Arbiter:ME
Arbiter 
*[[x u ;[x];u 
|y  v ;[y]; v 
]]
0
x
u
v
y
0
Arbiter:ME
• No request: x=0 y=0 ==> u=0 v=0
0
x 0
y
1
u0
v 0
0
1
0
Arbiter:ME
• Request on x: x=1 y=0 ==> u=1 v=0
• Similar to request on y.
0
x 1
y
0
u1
v 0
0
1
0
Arbiter:ME
• Request on both x and y: x=1 y=1 ==> either u=1 or v=1
• xu and yv will be both zero at some time
• Depend on the race one of them will be 1.
For example xu=0 propagates fast than yv
0
then yv will be locked at 1
and u=1 and v=0.
xu
x 1
u -->
y
v -->
1
yv
0
CHP: Compilation Method
• CHP specification
• Process decomposition
• Handshaking expansion
• Reshuffling
• Production rule expansion
• Circuit Implementation
CHP: CHP specification
*[ FETCH : i, pc := imem[pc], pc+1
[ off(i) -->offset, pc := imem[pc], pc+1;
[] not off(i) -->skip ];
EXEC : [ alu(i) -->(reg[i.z], f) := aluf(reg[i.x], reg[i.y], i.op, f)
[] ld(i) -->reg[i.z] := dmem[reg[i.x]+reg[i.y]]
[] st(i) -->dmem[reg[i.x] + reg[i.y]] := reg[i.z]
[] ldx(i) -->reg[i.z] := dmem[offset + reg[i.y]]
[] stx(i) -->dmem[offset + reg[i.y]] := reg[i.z]
[] lda(i) -->reg[i.z] := offset + reg[i.y]
[] stpc(i) -->reg[i.z] := pc
[] jmp(i) -->pc := reg[i.y]
[] brch(i) -->[ cond(f, i.cc) -->pc := pc + offset
[] not cond(f, i.cc) -->skip ] ] ]
CHP: CHP specification
• CPU: *[[Fetch; Exec]]
• i:instruction being executed.
• All instructions contain an op field.
• The parameter fields depend on the types of instruct
instruction for alu = record
op : alu.15..alu.12
x : alu.11..alu.8
y : alu.7..alu.4
z : alu.3..alu.0
end
Example. Add, and, …, load and store.
CHP: CHP specification
• f: flags generated by the execution of an alu
instruction
• cc: condition code field of branch instructions.
• Memory: 1. imem: instruction memory
2. dmem: data memory
• offset: two-word instructions
• reg[0] always contains the value zero.
• (z,f) := aluf(x,y,op,f)
evaluate an alu instrution with the opcode op,
parameters x,y
current flag f.
CHP: Process decomposition
P
P1
X
Y
P2
Chan(X,Y)
P=BS;S;AS
P1=BS;X;AS
P2=*[[Y-->S;Y]]
or (Y/S) call operator
• S can be a selection, repetition or assignment command.
CHP: Process decomposition
P
X
P1
Y
P2
Chan(X,Y)
P=BS;S;AS
P1=BS;X;AS
P2=*[[Y-->S;Y]]
or (Y/S) call operator
• S is a selection
• S  [ B1  S 1[] B 2  S 2 ]
P 2  *[[ Y  B1  S 1;Y []Y  B 2  S 2;Y ]
CHP: Process decomposition
P
X
P1
Y
P2
Chan(X,Y)
P=A;S;B
P1=A;X;B
• S is a repetition
• S  *[ B1  S 1[] B 2

S2]
P 2  *[[ Y  B1  S 1
[]Y  B 2

S2
[]Y  B1  B 2

Y ]]
P2=*[[Y-->S;Y]]
or (Y/S) call operator
CHP: Process decomposition
P
X
P1
Y
P2
Chan(X,Y)
P=BS;S;AS
P1=BS;X;AS
P2=*[[Y-->S;Y]]
or (Y/S) call operator
• S is an assignment (B is an arbitrary boolean function)
•
SxB
P 2  *[[ Y  B  x 
[]Y  B  x  ]]
CHP: Process decomposition
• Process decomposition can reduce a process
with an arbitrary control structure to a set of
subprocesses of only two different types:
• Sequences of communication actions
• Repetition of the types shown in
the previous 3 slides.
CHP: Process decomposition
• Example
: Simple Logic Unit
X
Y
SLU
Z
OP
* [ OP ? op;
[ op  ( X ? x || Y ? y ); z : x  y ; Z ! z
[]op  ( X ? x || Y ? y ); z : x  y ; Z ! z ]]
CHP: Process decomposition
* [ OP ? op ;
[ op  ( X ? x || Y ? y ); z : x  y ; Z ! z
[]op  ( X ? x || Y ? y ); z : x  y ; Z ! z ]]

* [ A; B ]
|| *[[ A  OP ? op ; A ]]
|| *[[ B  op  ( X ? x || Y ? y ); z : x  y ; Z ! z ; B
[] B  op  ( X ? x || Y ? y ); z : x  y ; Z ! z ; B ]]
CHP: Process decomposition
* [[ B  op  ( X ? x || Y ? y ); z : x  y ; Z ! z ; B
[] B  op  ( X ? x || Y ? y ); z : x  y ; Z ! z ; B ]]

* [[ B  op  ( C || D ); z : x  y ; E ; B
[] B  op  ( C || D ); z : x  y ; E ; B ]]
|| *[[ C  X ? x; C ]]
|| *[[ D  Y ? y ; D ]]
|| *[[ E  Z ! z ; E ]]
CHP: Process decomposition
* [[ B  op  ( C || D ); z : x  y ; E ; B
[] B  op  ( C || D ); z : x  y ; E ; B ]]

* [[ B  op  ( C || D ); F ; E ; B
[] B  op  ( C || D ); G ; E ; B ]]
|| *[ [ F  (x  y)  z ; F
[] F  ( x  y)  z ; F
[] G  (x  y)  z ; G
[] G  (x  y)  z ; G ] ]
CHP: Process decomposition
* [ A; B ] || *[[ A  OP ? op ; A ]]
|| *[[ B  op  ( C || D ); F ; E ; B
[] B  op  ( C || D ); G ; E ; B ]]
|| *[[ C  X ? x ; C ]]
|| *[[ D  Y ? y ; D ]]
• Decomposed SLU
|| *[[ E  Z ! z ; E ]]
|| *[ [ F  (x  y)  z ; F
[] F  ( x  y)  z ; F
[] G  (x  y)  z ; G
[] G  (x  y)  z ; G ] ]
CHP: Handshaking Expansion
• Handshaking Expansion:
P1
X
Y
x0
P2
P1
P2
xi
P1   ; X ; 
yi
yo
P 2   ;Y ;
P1   ; xo ; [ xi ]; 
P2   ; [ yi ]; yo ;
• P1:Active P2: passive
CHP: Handshaking Expansion
• Handshaking Expansion: 2-phase
P1
X
Y
x0
P2
P1
P2
xi
P1   ; X ; 
yi
yo
P 2   ;Y ;
P1   ; xo  xo; [ xi  xo ]; 
P 2   ; [ yi  yo ]; yo  yo;
CHP: Handshaking Expansion
• Handshaking Expansion: 4-phase
P1
X
Y
x0
P2
P1
P2
xi
P1   ; X ; 
yi
yo
P 2   ;Y ;
P1   ; xo ; [ xi ]; xo ; [ xi ]; 
P2   ; [ yi ]; yo ; [ yi ]; yo ;
• P1:Active P2: passive
CHP: Handshaking Expansion
• Handshaking Expansion:
ao
OP?op
SLU
* [ A; B ]
ai
|| *[[ A  OP ? op ; A ]]

* [ ao ; [ ai ] ; ao  [ai];
bo ; [bi]; bo  [bi] ]
|| *[[ ao  OP ? op ; ai  ; [ ao ]; ai  ]]
CHP: Handshaking Expansion
• Handshaking Expansion:
bo
(C||D);...
SLU
bi
* [[ B  op  ( C || D ); F ; E ; B
[] B  op  ( C || D ); G ; E ; B ]]

* [[ bo  op  ( C || D ); F ; E ; bi  ; [ bo ]; bi 
[]boop  ( C || D ); G ; E ; bi  ; [ bo ]; bi  ]]
CHP: Reshuffling
• ...; xo ; [ xi ];...
...; [ yi ]; yo ;...
are only used to reset to zero
they can be inserted anywhere
as long as cyclic order is maintained.
• WARNING: Reshuffling can introduce deadlock.
•
...; xo ; [ xi ]; xo ; [ xi ]; S ;... 
...; xo ; [ xi ]; S ; xo ; [ xi ];...
does not introduce deadlock when:
1. S contains no communication action, or
2. X is an internal channel created by process decomposition
CHP: Lazy-active protocol
• Active protocol X:
...; xo ; [ xi ]; xo ; [ xi ];...
• Passive protocol Y:
...; [ yi ]; yo ; [ yi ]; yo ;...
• Lazy active protocol X:
...[ xi ]; xo ; [ xi ]; xo ;...
1.[ xi ] is postponed to next X command
2. First [ xi ] is vacuous.
CHP: Reshulffling
• Active protocol:
* [ ao ; [ ai ] ; ao  [ai]; bo ; [bi]; bo  [bi] ]
• Reshuffing
* [ ao ; [ ai ] ; bo ; [bi] ;( ao || bo  );( [ai]  [bi] )]
• Lazy active
* [ [ai] ; ao ; [ ai ] ; [bi] ; bo ; [bi] ;( ao || bo  )]
Simple Logic Unit
Simple Logic Unit:Block
diagram
OPreg
OP
A?(and,or)
Control
F
C D
X
Y
Xreg
Yreg
G
E
x
y
And/Or
Unit
z
Zreg
Z
Simple Logic Unit:Block
diagram
Ao and or
Co
Ci
Do
Di
Control
Fo Fi Go Gi
Eo
Ei
Simple Logic Unit:
Simple Logic Unit:
• Extracting the control signals: data transfer
Simple Logic Unit:
• Extracting the control signals: data operations
Simple Logic Unit:Control HSE
CHP: Production rule
expansion
• Production rule expansion:
A. a handshaking expansion ==> a set of PRs
B. consist of 3 Steps:
state assignment,
guard strengthening
symmetrization
CHP: Production rule
expansion
• state assignment: keep the execution sequence
* [[li]; ro ; [ri]; ro ;[ri]; lo ;[li]; lo ]
x  li  ro 
state
ri  ro  assignment
ri  x 
li
lo
L/R
li  ro 
ri  lo 
x  ri  lo 
li  lo 
li  x 
x  ro 
x  lo 
* [[li]; ro ; [ri]; x ;[x]; ro ;[ri]; lo ;[li]; x ;[x]; lo ]
ro
ri
CHP: Production rule
expansion
• Symmetrization: Combinational vs state holding
x  li  ro 
x  li  ro 
ri  x 
li  x 
x  ri  lo 
x  ri  lo 
li
ro lo
li
x
ri
li
x
ri
F/F
x
lo
L/R
ro
ri