HOME       UP       PREV       NEXT (Other Expression forms: Hardware Construction Languages)  

Other Expression forms: Channel Communication

Using shared variables to communicate between threads requires that the user abides by self-imposed protocol conventions.

Typical patterns are:

Some protocols cannot be pipelined; some degrade throughput when pipelined and others are designed for it

Some approaches completely ban shared variables and enforce use of channels (Handel-C and the best Bluespec coding styles). »(LINK: Handlec.pdf)

Mutable variables suffer from RaW, WaR and WaW hazards!

Bluespec infers channel-like behaviour from user syntax that looks like conventional reads and writes of shared variables.

Handel-C uses explicit Occam/CSP-like channels ('!' to write, '?' to read):

   // Generator (src)     // Processor          // Consumer (sink)
   while (1)              while(1)              while(1)
   {                      {                     {
     ch1 ! (x);             ch2 ! (ch1? + 2)      $display(ch2?);
     x += 3;              }                     }

Using channels makes concurrency explicit and allows synthesis to re-time the design.

In both languages, handshaking wires internal to a module may disappear during synthesis. In both cases, all of the handshaking signals potentially required are generated by the compiler and then trimmed away again if they would have constant values owing to certain components being always ready.

38: (C) 2012-17, DJ Greaves, University of Cambridge, Computer Laboratory.