at.dms.kjc.spacetime
Class Util

java.lang.Object
  extended by at.dms.kjc.spacetime.Util

public class Util
extends Object

A class with useful functions that span classes.


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
           
 
Constructor Summary
Util()
           
 
Method Summary
static void add(LinkedList<Integer> list, int[] addme)
          Add the elements of addme to list.
static void add(LinkedList list, Object[] addme)
          Add the elements of addme to list.
static void addAll(HashSet set, Collection c)
           
static int cacheLineDiv(int i)
           
static boolean doesSliceUseTile(Slice slice, ComputeNode tile, Layout layout)
           
static CType getBaseType(CType type)
           
static String getFileHandle(PredefinedContent content)
           
static String getFileVar(PredefinedContent content)
           
static String getOutputsVar(FileOutputContent out)
           
static int getTypeSize(CType type)
          For type return the number of words that it occupies.
static int initBufferSize(InterSliceEdge edge)
           
static int magicBufferSize(InterSliceEdge edge)
           
static int[] makeInt(JExpression[] dims)
           
static String[] makeString(JExpression[] dims)
           
static double mean(int[] array)
           
static int median(int[] array)
           
static String networkReceive(boolean dynamic, CType tapeType)
           
static String networkSendPrefix(boolean dynamic, CType tapeType)
           
static String networkSendSuffix(boolean dynamic)
           
static boolean onlyFileInput(InputSliceNode node)
          Determine if this input slice node reads from a single source and the source is a file device.
static boolean onlyWritingToAFile(OutputSliceNode outNode)
           
static int outputsPerSteady(SIRStream str, HashMap exeCounts)
          Calculate the number of items the file writers write to files in the schedule exeCounts.
static void printExecutionCount(HashMap map)
          Print to screen the mapping of multiplicities
static void sendConstFromTileToSwitch(RawTile tile, int c, boolean init, boolean primePump, SwitchReg reg)
           
static
<T> boolean
setCompare(LinkedList<T> list, T[] array)
          Return true if the sets contructed from list and array are equal.
static SliceNode[] sliceNodeArray(Slice[] traces)
           
static LinkedList<FilterSliceNode> sortedFilterSlicesTime(Partitioner partitioner)
          Return a sorted list of filter trace nodes for time only that does not include io traces.
static int steadyBufferSize(InterSliceEdge edge)
           
static int sum(int[] array)
           
 
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

printExecutionCount

public static void printExecutionCount(HashMap map)
Print to screen the mapping of multiplicities

Parameters:
map - The HashMap.

getTypeSize

public static int getTypeSize(CType type)
For type return the number of words that it occupies.

Parameters:
type - The type.
Returns:
The number of words occupied by type.

makeInt

public static int[] makeInt(JExpression[] dims)

getBaseType

public static CType getBaseType(CType type)

makeString

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

setCompare

public static <T> boolean setCompare(LinkedList<T> list,
                                     T[] array)
Return true if the sets contructed from list and array are equal.

Type Parameters:
T - Type of list elements and array elements.
Parameters:
list - The list
array - The array
Returns:
true if the sets contructed from list and array are equal.

add

public static void add(LinkedList<Integer> list,
                       int[] addme)
Add the elements of addme to list.

Parameters:
list - The list.
addme - Add elements to list.

add

public static void add(LinkedList list,
                       Object[] addme)
Add the elements of addme to list.

Parameters:
list - The list.
addme - Add elements to list.

networkReceive

public static String networkReceive(boolean dynamic,
                                    CType tapeType)
Parameters:
dynamic -
tapeType -
Returns:
The code to receive a item from either the dynamic network or the static network based on the type.

doesSliceUseTile

public static boolean doesSliceUseTile(Slice slice,
                                       ComputeNode tile,
                                       Layout layout)
Parameters:
slice -
tile -
Returns:
True if
trace
has a filter that is mapped to
tile
.

median

public static int median(int[] array)
Parameters:
array -
Returns:
The median element of
array
.

mean

public static double mean(int[] array)
Parameters:
array -
Returns:
The mean of the elements of
array
.

sum

public static int sum(int[] array)
Parameters:
array -
Returns:
the sum of the elements of array.

networkSendPrefix

public static String networkSendPrefix(boolean dynamic,
                                       CType tapeType)
Parameters:
dynamic -
tapeType -
Returns:
The prefix for sending an item over either the dynamic network or the static network of the given type. Should be used before the value to send over the network is generated.

networkSendSuffix

public static String networkSendSuffix(boolean dynamic)
Parameters:
dynamic -
Returns:
The suffix to append after the value is generated for a network send.

steadyBufferSize

public static int steadyBufferSize(InterSliceEdge edge)

initBufferSize

public static int initBufferSize(InterSliceEdge edge)

magicBufferSize

public static int magicBufferSize(InterSliceEdge edge)

getFileVar

public static String getFileVar(PredefinedContent content)

getFileHandle

public static String getFileHandle(PredefinedContent content)

getOutputsVar

public static String getOutputsVar(FileOutputContent out)

cacheLineDiv

public static int cacheLineDiv(int i)

addAll

public static void addAll(HashSet set,
                          Collection c)

sliceNodeArray

public static SliceNode[] sliceNodeArray(Slice[] traces)
Parameters:
traces -
Returns:
An array of all the TraceNode in the
traces
array dictated by the order that the traces appear in
traces
.

sendConstFromTileToSwitch

public static void sendConstFromTileToSwitch(RawTile tile,
                                             int c,
                                             boolean init,
                                             boolean primePump,
                                             SwitchReg reg)

sortedFilterSlicesTime

public static LinkedList<FilterSliceNode> sortedFilterSlicesTime(Partitioner partitioner)
Return a sorted list of filter trace nodes for time only that does not include io traces.

Parameters:
partitioner -
Returns:
a sorted list of filter trace nodes for time only that does not include io traces.

outputsPerSteady

public static int outputsPerSteady(SIRStream str,
                                   HashMap exeCounts)
Calculate the number of items the file writers write to files in the schedule exeCounts.

Parameters:
str - The toplevel container.
exeCounts - The schedule.
Returns:
the number of items the file writers write to files in the schedule exeCounts.

onlyFileInput

public static boolean onlyFileInput(InputSliceNode node)
Determine if this input slice node reads from a single source and the source is a file device.

Parameters:
node - The InputSliceNode to check
Returns:
true if reads file device as its single source

onlyWritingToAFile

public static boolean onlyWritingToAFile(OutputSliceNode outNode)
Parameters:
outNode - OutputSliceNode
Returns:
True if this output slice node has only one output and that output is directly writing to a file reader with no non-redundant buffers in between.