Download presentation

Presentation is loading. Please wait.

Published byLexus Gelling Modified over 4 years ago

1
March 2007http://csg.csail.mit.edu/arvindSemantics-1 Scheduling Primitives for Bluespec Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Work in progress

2
March 2007 Semantics-2http://csg.csail.mit.edu/arvind mem fifo Done? outQ Motivation 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

3
March 2007 Semantics-3http://csg.csail.mit.edu/arvind BS: A Language of Atomic Actions A program is a collection of instantiated modules m 1 ; m 2 ;... 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 | (t = e in a) | m.g(e) | a when e Conditional action Parallel Composition Sequential Composition Method call Guarded action

4
March 2007 Semantics-4http://csg.csail.mit.edu/arvind mem fifo Done? outQ LPM in Bluespec using the sequential connective 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))) Notice Different made up syntax

5
March 2007 Semantics-5http://csg.csail.mit.edu/arvind Guards vs If’s Guards affect the surroundings (a1 when p1) | a2 ==> (a1 | a2) when p1 Effect of an “if” is local (if p1 then a1) | a2 ==> if p1 then (a1 | a2) else a2 p1 has no effect on a2

6
March 2007 Semantics-6http://csg.csail.mit.edu/arvind Conditionals & Cases if p then a1 else a2 if p then a1 | if !p then a2 Similarly for cases

7
March 2007 Semantics-7http://csg.csail.mit.edu/arvind Semantics 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

8
March 2007 Semantics-8http://csg.csail.mit.edu/arvind BS Action Rules reg-update ├ e v, (v != ┴ ) ├ (r := e) {(r, v)} Like a set union but blows up if there are any duplicates Like pmerge but U2 dominates U1 if-true ├ e true, ├ a U ├ (if e then a) U if-false ├ e false ├ (if e then a) par ├ a1 U1, ├ a2 U2 ├ (a1 | a2) pmerge(U1,U2) seq ├ a1 U1, update(,U1) ├ a2 U2 ├ ( a1 ; a2) smerge(U1,U2)

9
March 2007 Semantics-9http://csg.csail.mit.edu/arvind BS Action Rules cont a-let-sub ├ e v, smerge(, {(t,v)}) ├ a U ├ ((t = e) in a) U Expression rules are similar a-meth-call ├ e v, (v != ┴ ),x.a = lookup(m.g), smerge(,{(x,v)}) ├ a U ├ m.g(e) U

10
March 2007 Semantics-10http://csg.csail.mit.edu/arvind Guard 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”. a-when-ready ├ e true, ├ a U ├ (a when e) U e-when-ready-true ├ e1 v, ├ e2 true ├ (e1 when e2) v e-when-ready-false ├ e1 v, ├ e2 false ├ (e1 when e2) ┴

11
March 2007 Semantics-11http://csg.csail.mit.edu/arvind Execution model Repeatedly: Select a rule to execute Compute the state updates Make the state updates Highly non- deterministic Implementation concern: Schedule multiple rules concurrently without violating one-rule-at-a-time semantics

12
March 2007 Semantics-12http://csg.csail.mit.edu/arvind mem fifo Done? outQ LPM: Scheduling issues 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))) Can a rule calling method “enter” execute concurrently with the “recirculate” rule ? If not who should have priority? The compiler’s scheduling is not good enough for this level of specificity

13
March 2007 Semantics-13http://csg.csail.mit.edu/arvind Concurrent 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))

14
March 2007 Semantics-14http://csg.csail.mit.edu/arvind Schedules 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

15
March 2007 Semantics-15http://csg.csail.mit.edu/arvind LPM: 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)

16
March 2007 Semantics-16http://csg.csail.mit.edu/arvind LPM 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!

17
March 2007 Semantics-17http://csg.csail.mit.edu/arvind Final 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

18
March 2007 Semantics-18http://csg.csail.mit.edu/arvind Resources The Blusepec Inc Web site http://bluespec.com http://bluespec.com/products/Papers.htm 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 http://csg.lcs.mit.edu/pubs/bluespecpubs.html The 6.375 subject at MIT: Complex Digitial Systems http://csg.csail.mit.edu/6.375/http://csg.csail.mit.edu/6.375/ Thanks for listening

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google