Title: Semantics1
1- Scheduling Primitives for Bluespec
- Arvind
- Computer Science Artificial Intelligence Lab
- Massachusetts Institute of Technology
- Work in progress
2Motivation
rule recirculate x mem.peek() y
fifo.first() if done?(x) then fifo.deq()
mem.deq() outQ.enq(x) else
mem.deq() mem.req(addr(x))
fifo.deq() fifo.enq(y)
Need a way of - saying deq happens before enq
within the same rule - building such a FIFO
3BS A Language of Atomic Actions
A program is a collection of instantiated modules
m1 m2 ...
Module Module name State variable
r Rule R a Action method g (x)
a Read method f (x) e
e r c t Op(e , e) e ? e
e (t e in e) m.f(e) e
when e
a r e if e then a a a a
a (t e in a) m.g(e) a
when e
4LPM in Bluespecusing the sequential connective
Different made up syntax
- module lpm
- rule recirculate
- action method enter(x) mem.req(addr(x))
fifo.enq(x)
(x mem.peek() in (y fifo.first() in (if
done?(x) then fifo.deq() mem.deq()
outQ.enq(x) else (mem.deq()
mem.req(addr(x)))
(fifo.deq() fifo.enq(y)))
5Guards vs Ifs
- Guards affect the surroundings
-
- (a1 when p1) a2 gt (a1 a2) when p1
- Effect of an if is local
- (if p1 then a1) a2 gt if p1 then (a1 a2)
else a2 - p1 has no effect on a2
6Conditionals Cases
- if p then a1 else a2
- ? if p then a1 if !p then a2
- Similarly for cases
7Semantics of a rule execution
- Specify which state elements the rule modifies
- Let ? represent the value of all the registers
before the rule executes - Let U be the set of updates implied by the rule
execution
8BS Action Rules
9BS Action Rules cont
Expression rules are similar
10Guard Semantics
- If no rule applies, e.g., if e in (a when e)
returns false, then the system is stuck and the
effect of the whole atomic action of which (a
when e) is a part is no action.
11Execution model
- Repeatedly
- Select a rule to execute
- Compute the state updates
- Make the state updates
Implementation concern Schedule multiple rules
concurrently without violating one-rule-at-a-time
semantics
12LPM Scheduling issues
The compilers scheduling is not good enough for
this level of specificity
Can a rule calling method enter execute
concurrently with the recirculate rule ? If
not who should have priority?
- module lpm
- rule recirculate
- action method enter(x) mem.req(addr(x))
fifo.enq(x)
(x mem.res() in (y fifo.first() in (if
done?(x) then fifo.deq() mem.deq()
outQ.enq(x) else (mem.deq()
mem.req(addr(x)))
(fifo.deq() fifo.enq(y)))
13Concurrent Scheduling Rule composition
Rule R1 a1 when p1 Rule R2 a2 when p2
- Scheduling Primitives
- 1. S par(R1,R2)
- where the meaning of rule S is
- Rule S ((if p1 then a1)(if p2 then a2))
when (p1 xor p2) - 2. S compose(R1,R2)
- where the meaning of rule S is
- Rule S ((a1 when p1)(a2 when p2))
- 3. S restrict(R1,R2)
- where the meaning of rule S is
- Rule S (a2 when (!p1 p2))
14Schedules
- Grammar
- S R
- compose(S, S)
- par(S, S)
- restrict(S, S)
1. The user must specify a schedule 2. A rule
can occur multiple times in a schedule
Such schedules combined with rule-splitting lets
the user specify concurrency safely in execution
15LPM Split the Internal rule
- module lpm
- rule recirculate
- (x mem.res() in (y fifo.first() in
- (if !done?(x) then (mem.deq()
mem.req(addr(x))) - (fifo.deq()
fifo.enq(y))) - rule exit
- (x mem.res() in (y fifo.first() in
- (if done?(x) then fifo.deq() mem.deq()
outQ.enq(x) - action method enter(x) mem.req(addr(x))
fifo.enq(x)
16LPM Schedules
- Schedule-1
- rc restrict(enter,recirculate)
- ee compose(exit,enter)
- ex restrict(ee,exit)
- en restrict(exit,enter)
- S1 par(rc,ee,en,ex)
- Schedule-2
- er restrict(recirculate, enter)
- ee compose(exit,er)
- ex restrict(ee,exit)
- en restrict(er,exit)
- S2 par(ee,en,ex)
enter has priority over recirculate no dead
cycles
recirculate has priority over enter no dead
cycles
Difficult to pick between S1 and S2!
17Final words
- Market forces are demanding a much greater
variety of SoCs - The design cost for SoCs has to be brought down
dramatically by facilitating IP reuse - High-level synthesis tools are essential for
architectural exploration and IP development
Bluespec and associated tools are a promising
solution to this problem
18Resources
- The Blusepec Inc Web site http//bluespec.com
http//bluespec.com/products/Papers.htm - Contact Bluespec Inc to get a free copy of the
BSV language manual. For other publications
http//csg.lcs.mit.edu/pubs/bluespecpubs.html - The 6.375 subject at MIT Complex Digitial
Systems http//csg.csail.mit.edu/6.375/
Thanks for listening