at.dms.kjc.spacedynamic
Class Util

java.lang.Object
  extended by at.dms.util.Utils
      extended by at.dms.kjc.spacedynamic.Util
All Implemented Interfaces:
DeepCloneable, Serializable

public class Util
extends Utils

This class contains various function used by multiple passes

See Also:
Serialized Form

Field Summary
static String CGNIFPVAR
           
static String CGNIINTVAR
           
static String CGNOFPVAR
           
static String CGNOINTVAR
           
static String CSTIFPVAR
           
static String CSTIINTVAR
           
static String CSTOFPVAR
           
static String CSTOINTVAR
           
 
Fields inherited from class at.dms.util.Utils
EMPTY_LIST, getForLoopCallers
 
Constructor Summary
Util()
           
 
Method Summary
static boolean countMe(SIRFilter filter)
           
static HashSet<FlatNode> getAssignedEdges(Layout layout, FlatNode node)
           
static int getCount(HashMap counts, FlatNode node)
           
static int getCountPrev(HashMap counts, FlatNode prev, FlatNode node)
           
static HashSet<Object> getDirectDownstream(FlatNode node)
           
static FlatNode getFilterDownstreamAssigned(Layout layout, FlatNode node)
          Given a filter flatnode , return the closest downstream node that is assigned to a tile or ioport.
static FlatNode getFilterUpstreamAssigned(Layout layout, FlatNode node)
          Given a filter flatnode , return the closest upstream node that is assigned to a tile or ioport.
static int getItemsProduced(FlatNode node)
          Return the number of items node produces during one firing during steady-state.
static double getRRSplitterWeight(FlatNode prev, FlatNode node)
           
static FlatNode[] getSendingSchedule(Layout layout, FlatNode node)
          Given a flatnode of a joiner or a filter that is mapped, get the schedule of mapped nodes that it pushes to (so disregard unmapped splitters and joiners).
static SIRFilter getSinkFilter(SIRStream stream)
           
static SIRFilter getSourceFilter(SIRStream stream)
           
static int getTypeSize(CType type)
           
static int getTypeSize(SIRStructure struct)
           
static int[] lcm(int a, int b)
          LCM of a and b.
static String[] makeString(JExpression[] dims)
           
static String networkReceive(boolean dynamic, CType tapeType)
           
static String networkSendPrefix(boolean dynamic, CType tapeType)
           
static String networkSendSuffix(boolean dynamic)
           
static int nextPow2(int i)
           
static void removeIO(SIRFilter filter)
          set the push and pop/peek rates to 0 and the input / output types to void *
static void restoreIO(SIRFilter f1, SIRFilter f2)
          Set the i/o rates of f1 to the i/o rates of f2.
 
Methods inherited from class at.dms.util.Utils
asPercent, cellMathEquivalent, cMathEquivalent, cppMathEquivalent, deepClone, deepCloneInto, equalArrays, fail, getEnvironmentVariable, getExpression, hasPeeks, initArray, initArray, initLiteralArray, intArrayToList, isMathMethod, isUniform, kopi_assert, kopi_assert, makeCountdownForLoop, makeDotFileName, makeForLoop, makeForLoop, makeForLoop, makeForLoopFieldIndex, makeForLoopLocalIndex, passThruParens, peelMarkers, popBeforePeek, readFile, removeUnusedPops, replaceAll, setupDotFileName, simplifyMathMethod, splitQualifiedName, splitQualifiedName, toArray, toIntArray, toVector, voidToInt, writeFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSTOINTVAR

public static String CSTOINTVAR

CSTOFPVAR

public static String CSTOFPVAR

CSTIFPVAR

public static String CSTIFPVAR

CSTIINTVAR

public static String CSTIINTVAR

CGNOINTVAR

public static String CGNOINTVAR

CGNOFPVAR

public static String CGNOFPVAR

CGNIFPVAR

public static String CGNIFPVAR

CGNIINTVAR

public static String CGNIINTVAR
Constructor Detail

Util

public Util()
Method Detail

getItemsProduced

public static int getItemsProduced(FlatNode node)
Return the number of items node produces during one firing during steady-state. For filters it is the pop, for splitters and joiners it is 1.

Parameters:
node - The str in question
Returns:
The number of items produced per firing in the steady-state

countMe

public static boolean countMe(SIRFilter filter)

getFilterUpstreamAssigned

public static FlatNode getFilterUpstreamAssigned(Layout layout,
                                                 FlatNode node)
Given a filter flatnode , return the closest upstream node that is assigned to a tile or ioport.

Parameters:
layout: - needed to find whether the node is assigned
node: - must be a SIRFilter
Returns:
a FlatNode or null if could not find an upstream node.

getFilterDownstreamAssigned

public static FlatNode getFilterDownstreamAssigned(Layout layout,
                                                   FlatNode node)
Given a filter flatnode , return the closest downstream node that is assigned to a tile or ioport.

Parameters:
layout: - needed to find whether the node is assigned
node: - must be a SIRFilter
Returns:
a FlatNode or null if could not find a downstream node.

nextPow2

public static int nextPow2(int i)

getCount

public static int getCount(HashMap counts,
                           FlatNode node)

getCountPrev

public static int getCountPrev(HashMap counts,
                               FlatNode prev,
                               FlatNode node)

getRRSplitterWeight

public static double getRRSplitterWeight(FlatNode prev,
                                         FlatNode node)

lcm

public static int[] lcm(int a,
                        int b)
LCM of a and b.

Parameters:
a -
b -
Returns:
int[the lcm, a's multipler, b's multipler]

getTypeSize

public static int getTypeSize(CType type)

getTypeSize

public static int getTypeSize(SIRStructure struct)

makeString

public static String[] makeString(JExpression[] dims)

networkReceive

public static String networkReceive(boolean dynamic,
                                    CType tapeType)

networkSendPrefix

public static String networkSendPrefix(boolean dynamic,
                                       CType tapeType)

networkSendSuffix

public static String networkSendSuffix(boolean dynamic)

getAssignedEdges

public static HashSet<FlatNode> getAssignedEdges(Layout layout,
                                                 FlatNode node)
Returns:
the FlatNodes that are directly downstream of the given flatnode and are themselves assigned a tile in the layout

getDirectDownstream

public static HashSet<Object> getDirectDownstream(FlatNode node)

getSinkFilter

public static SIRFilter getSinkFilter(SIRStream stream)

getSourceFilter

public static SIRFilter getSourceFilter(SIRStream stream)

restoreIO

public static void restoreIO(SIRFilter f1,
                             SIRFilter f2)
Set the i/o rates of f1 to the i/o rates of f2.

Parameters:
f1 - Set this filter to the i/o rates of f2.
f2 - Set f1 to this filters i/o rates.

removeIO

public static void removeIO(SIRFilter filter)
set the push and pop/peek rates to 0 and the input / output types to void *


getSendingSchedule

public static FlatNode[] getSendingSchedule(Layout layout,
                                            FlatNode node)
Given a flatnode of a joiner or a filter that is mapped, get the schedule of mapped nodes that it pushes to (so disregard unmapped splitters and joiners). This only works on nodes whose output is split at most once!

Parameters:
layout -
node -
Returns:
The schedule of nodes that are the assigned sinks of this filter.