at.dms.kjc.backendSupport
Class Channel

java.lang.Object
  extended by at.dms.kjc.backendSupport.Channel
Direct Known Subclasses:
ChannelAsArray, DelegatingChannel, InterSPUChannel, OffChipBuffer, UnbufferredPopChannel, UnbufferredPushChannel

public class Channel
extends Object

A Buffer is an implementation of an Edge in a back end. It refers to nodes in a slice graph like an edge does, but a Buffer also contains code that a back end can emit to pass data between nodes in the slice graph.

Author:
dimock

Field Summary
protected static HashMap<Edge,Channel> bufferStore
          the store for all Buffers, indexed by edge.
protected  int extraCount
          set to 1 for double bufferring or higher if even more extra buffers desired
protected  String ident
          unique ident for the buffer
protected  int rotationLength
          the rotation length of this buffer for software pipelining Includes any length from extraLength field.
protected  Edge theEdge
          Technical note: a Buffer in a backend implements an Edge in a slice graph This data structure uses an Edge to store source, destination, and type information.
protected  int unique_id
          used to make sure ident is unique
 
Constructor Summary
protected Channel(Edge edge)
          Create a channel given an edge.
protected Channel(SliceNode src, SliceNode dst)
          Create a buffer given src and dst SliceNode's
 
Method Summary
static void addChannel(Channel c)
          Add a Channel to our collection of channels.
 JMethodDeclaration assignFromPeekMethod()
           
 String assignFromPeekMethodName()
           
 JMethodDeclaration assignFromPopMethod()
           
 String assignFromPopMethodName()
           
 List<JStatement> beginInitRead()
           
 List<JStatement> beginInitWrite()
           
 List<JStatement> beginSteadyRead()
           
 List<JStatement> beginSteadyWrite()
           
 List<JStatement> dataDecls()
           
 List<JStatement> dataDeclsH()
           
 List<JStatement> endInitRead()
           
 List<JStatement> endInitWrite()
           
 List<JStatement> endSteadyRead()
           
 List<JStatement> endSteadyWrite()
           
static Channel findChannel(Edge edge)
          Determine whther a channel for an edge exists in out collection of channels.
static Collection<Channel> getBuffers()
           
 SliceNode getDest()
           
 int getExtraCount()
           
 String getIdent()
           
 SliceNode getSource()
           
 CType getType()
           
 JMethodDeclaration peekMethod()
           
 String peekMethodName()
           
 JMethodDeclaration popManyMethod()
          Pop many items at once ignoring them.
 String popManyMethodName()
           
 JMethodDeclaration popMethod()
           
 String popMethodName()
           
 List<JStatement> postPreworkInitRead()
           
static void printBuffers()
          For debugging.
 JMethodDeclaration pushMethod()
           
 String pushMethodName()
           
 List<JStatement> readDecls()
           
 List<JStatement> readDeclsExtern()
           
static void reset()
          Reset the buffer store and create all number buffer objects.
 void setExtralength(int extracount)
           
static void setRotationLengths(BasicSpaceTimeSchedule sched)
          Set rotation count: number of buffers needed during primePump phase.
 List<JStatement> topOfWorkSteadyRead()
           
 List<JStatement> topOfWorkSteadyWrite()
           
 List<JStatement> writeDecls()
           
 List<JStatement> writeDeclsExtern()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theEdge

protected Edge theEdge
Technical note: a Buffer in a backend implements an Edge in a slice graph This data structure uses an Edge to store source, destination, and type information. XXX fix this? is sharing edges with the sliceGraph can see wanting to optimize buffers to remove useless edges and wanting to change source and dest, presumably without changing slice graph.


ident

protected String ident
unique ident for the buffer


unique_id

protected int unique_id
used to make sure ident is unique


bufferStore

protected static HashMap<Edge,Channel> bufferStore
the store for all Buffers, indexed by edge.


rotationLength

protected int rotationLength
the rotation length of this buffer for software pipelining Includes any length from extraLength field.


extraCount

protected int extraCount
set to 1 for double bufferring or higher if even more extra buffers desired

Constructor Detail

Channel

protected Channel(Edge edge)
Create a channel given an edge. Subclasses should provide factories for their channel types.

Parameters:
edge -

Channel

protected Channel(SliceNode src,
                  SliceNode dst)
Create a buffer given src and dst SliceNode's

Parameters:
src -
dst -
Method Detail

findChannel

public static Channel findChannel(Edge edge)
Determine whther a channel for an edge exists in out collection of channels.

Parameters:
edge - Edge that the channel should implement
Returns:
an existing channel if there is one, else null.

addChannel

public static void addChannel(Channel c)
Add a Channel to our collection of channels.

Parameters:
c - Channel to add to our collection of channels.

reset

public static void reset()
Reset the buffer store and create all number buffer objects. Used if one wants to munge the trace graph.


printBuffers

public static void printBuffers()
For debugging.


getIdent

public String getIdent()

getBuffers

public static Collection<Channel> getBuffers()
Returns:
of the buffers of this stream program

getType

public CType getType()

getExtraCount

public int getExtraCount()

setExtralength

public void setExtralength(int extracount)

getSource

public SliceNode getSource()

getDest

public SliceNode getDest()

setRotationLengths

public static void setRotationLengths(BasicSpaceTimeSchedule sched)
Set rotation count: number of buffers needed during primePump phase. Also adds in extracount to set up double-bufferring if desired.

Parameters:
sched - BasicSpaceTimeSchedule gives primePump multiplicities.

popMethodName

public String popMethodName()

popMethod

public JMethodDeclaration popMethod()

popManyMethodName

public String popManyMethodName()

popManyMethod

public JMethodDeclaration popManyMethod()
Pop many items at once ignoring them. Default method generated here to call popMethod() repeatedly.


assignFromPopMethodName

public String assignFromPopMethodName()

assignFromPopMethod

public JMethodDeclaration assignFromPopMethod()

peekMethodName

public String peekMethodName()

peekMethod

public JMethodDeclaration peekMethod()

assignFromPeekMethodName

public String assignFromPeekMethodName()

assignFromPeekMethod

public JMethodDeclaration assignFromPeekMethod()

pushMethodName

public String pushMethodName()

pushMethod

public JMethodDeclaration pushMethod()

beginInitRead

public List<JStatement> beginInitRead()

postPreworkInitRead

public List<JStatement> postPreworkInitRead()

endInitRead

public List<JStatement> endInitRead()

beginInitWrite

public List<JStatement> beginInitWrite()

endInitWrite

public List<JStatement> endInitWrite()

beginSteadyRead

public List<JStatement> beginSteadyRead()

endSteadyRead

public List<JStatement> endSteadyRead()

beginSteadyWrite

public List<JStatement> beginSteadyWrite()

endSteadyWrite

public List<JStatement> endSteadyWrite()

topOfWorkSteadyRead

public List<JStatement> topOfWorkSteadyRead()

topOfWorkSteadyWrite

public List<JStatement> topOfWorkSteadyWrite()

dataDeclsH

public List<JStatement> dataDeclsH()

dataDecls

public List<JStatement> dataDecls()

readDeclsExtern

public List<JStatement> readDeclsExtern()

readDecls

public List<JStatement> readDecls()

writeDeclsExtern

public List<JStatement> writeDeclsExtern()

writeDecls

public List<JStatement> writeDecls()