at.dms.kjc.backendSupport
Class ChannelAsCircularArray

java.lang.Object
  extended by at.dms.kjc.backendSupport.Channel
      extended by at.dms.kjc.backendSupport.ChannelAsArray
          extended by at.dms.kjc.backendSupport.ChannelAsCircularArray

public class ChannelAsCircularArray
extends ChannelAsArray

Implement a channel as a circular array. The size of the array is the power of 2 >= the maximum number of elements stored in the array.

Author:
dimock

Field Summary
protected  int offsetMask
          buffer size is alway power of 2, nmask id power of 2 - 1
 
Fields inherited from class at.dms.kjc.backendSupport.ChannelAsArray
bufDefn, bufName, bufPrefix, bufSize, bufType, head, headDefn, headName, tail, tailDefn, tailName
 
Fields inherited from class at.dms.kjc.backendSupport.Channel
bufferStore, extraCount, ident, rotationLength, theEdge, unique_id
 
Constructor Summary
ChannelAsCircularArray(Edge edge)
          Constructor
 
Method Summary
 JMethodDeclaration assignFromPeekMethod()
          void peek(input_type val, int offset) generally assign if val is not an array, else memcpy
 JMethodDeclaration assignFromPopMethod()
          void pop(input_type val) generally assign if val is not an array, else memcpy
 List<JStatement> beginSteadyRead()
          Statements for beginning of steady state iteration on read (downstream) end of buffer: overrides superclass to have no statements here.
 List<JStatement> beginSteadyWrite()
          Statements for beginning of steady state iteration on write (upstream) end of buffer overrides superclass to have no statements here.
static ChannelAsCircularArray getChannel(Edge edge)
          Make a new Channel or return an already-made channel.
 JMethodDeclaration peekMethod()
          input_type peek(int offset)
 JMethodDeclaration popManyMethod()
          void pop(int N).
 JMethodDeclaration popMethod()
          input_type pop().
 JMethodDeclaration pushMethod()
          void push(output_type val)
 
Methods inherited from class at.dms.kjc.backendSupport.ChannelAsArray
beginInitRead, beginInitWrite, bufRef, dataDecls, dataDeclsH, endInitRead, endInitWrite, endSteadyRead, endSteadyWrite, getBufSize, readDecls, readDeclsExtern, topOfWorkSteadyRead, topOfWorkSteadyWrite, writeDecls, writeDeclsExtern, zeroOutHead, zeroOutTail
 
Methods inherited from class at.dms.kjc.backendSupport.Channel
addChannel, assignFromPeekMethodName, assignFromPopMethodName, findChannel, getBuffers, getDest, getExtraCount, getIdent, getSource, getType, peekMethodName, popManyMethodName, popMethodName, postPreworkInitRead, printBuffers, pushMethodName, reset, setExtralength, setRotationLengths
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offsetMask

protected int offsetMask
buffer size is alway power of 2, nmask id power of 2 - 1

Constructor Detail

ChannelAsCircularArray

public ChannelAsCircularArray(Edge edge)
Constructor

Parameters:
edge - should give enough information (indirectly) to calculate buffer size
Method Detail

getChannel

public static ChannelAsCircularArray getChannel(Edge edge)
Make a new Channel or return an already-made channel.

Parameters:
edge - The edge that this channel implements.
other - The channel that this delegates to.
Returns:
A channel for this edge, that

popMethod

public JMethodDeclaration popMethod()
input_type pop().

Overrides:
popMethod in class ChannelAsArray

popManyMethod

public JMethodDeclaration popManyMethod()
void pop(int N).

Overrides:
popManyMethod in class ChannelAsArray

assignFromPopMethod

public JMethodDeclaration assignFromPopMethod()
void pop(input_type val) generally assign if val is not an array, else memcpy

Overrides:
assignFromPopMethod in class ChannelAsArray

peekMethod

public JMethodDeclaration peekMethod()
input_type peek(int offset)

Overrides:
peekMethod in class ChannelAsArray

assignFromPeekMethod

public JMethodDeclaration assignFromPeekMethod()
void peek(input_type val, int offset) generally assign if val is not an array, else memcpy

Overrides:
assignFromPeekMethod in class ChannelAsArray

pushMethod

public JMethodDeclaration pushMethod()
void push(output_type val)

Overrides:
pushMethod in class ChannelAsArray

beginSteadyRead

public List<JStatement> beginSteadyRead()
Statements for beginning of steady state iteration on read (downstream) end of buffer: overrides superclass to have no statements here.

Overrides:
beginSteadyRead in class ChannelAsArray

beginSteadyWrite

public List<JStatement> beginSteadyWrite()
Statements for beginning of steady state iteration on write (upstream) end of buffer overrides superclass to have no statements here.

Overrides:
beginSteadyWrite in class ChannelAsArray