org.opencores.mapping
Class FlowMap

java.lang.Object
  |
  +--org.opencores.mapping.FlowMap

public final class FlowMap
extends java.lang.Object

Performs unit-delay optimal mapping for LUTs - FlowMap algorithm.

See Also:
,

Inner Class Summary
(package private)  class FlowMap.Variable
          Internal class used for building larger LUTs, representing directed acyclic subgraph input.
 
Field Summary
static boolean OPTIMIZE_SIZE
          Whether FlowMap should optimize space
private  int tempCnt
          current temp flag
 
Constructor Summary
FlowMap()
           
 
Method Summary
private  NodeLUT buildLUT(NodeLUT child, java.util.Vector GPI)
          Collapses DAG of same nodes with temp==tempCnt-1 into child, using shortest-first joining.
private  void buildSame(NodeLUT child, int label, java.util.Vector LUTs)
          adds all childs predecessors with same label into LUTs Vector
private  boolean flow(java.util.Vector PI, Node t, int label)
          Calculates flow from source s to sink t or to node with label 'label'.
private  boolean flowR(Node sink, boolean top, int label)
          Tries to find flow from source s to sink t.
private  NodeLUT joinLUTs(NodeLUT child)
          Collapses tree of same labeled nodes into s, using shortest-first joining.
private  int label(Node t)
          Calculates label of node t.
 void labeling(Graph g)
          first step of algorithm - labeling
 Graph mapping(Graph g)
          Second step of the algorithm - mapping.
private  void mark(Node t, java.util.Vector PI, int mil)
          Mark predecessor nodes ot t with tempCnt.
private  void markAccessible(NodeLUT sink, boolean top)
          Similar to routine A of Ford Fulerson max-flow algorithm, marks visited nodes with .visited flag.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

OPTIMIZE_SIZE

public static boolean OPTIMIZE_SIZE
Whether FlowMap should optimize space

tempCnt

private int tempCnt
current temp flag
Constructor Detail

FlowMap

public FlowMap()
Method Detail

labeling

public void labeling(Graph g)
first step of algorithm - labeling
Parameters:
g - graph to label. Labels are stored in node.y

label

private int label(Node t)
Calculates label of node t.
Parameters:
n - node to calculate label
Returns:
label of t

mark

private void mark(Node t,
                  java.util.Vector PI,
                  int mil)
Mark predecessor nodes ot t with tempCnt.
Parameters:
t - node to mark predecessors
PI - vector to put primary input nets in

flow

private boolean flow(java.util.Vector PI,
                     Node t,
                     int label)
Calculates flow from source s to sink t or to node with label 'label'. Also mark function should be called to set .temp and .flag = false for all predecessors
Parameters:
s - source node
t - sink node
label - minimum label to stop
Returns:
true if there is flow > Conf.K between source and sink
See Also:
mark

flowR

private boolean flowR(Node sink,
                      boolean top,
                      int label)
Tries to find flow from source s to sink t.

Each node is splitted into two parts - top and bottom. Top can access bottoms of predecessors, bottom can access successor tops. Top-bottom link is valid if node .flag == false.

Mark function should be called to set .temp and .flag = false for all predecessors

Parameters:
sink - source node
top - designates top access to sink node
label - minimum label to stop
Returns:
true if there is a flow between source and sink
See Also:
mark, markAccessible, Ford, Jr. and D.R. Fulkerson: Maximal Flow Trough a Network

mapping

public Graph mapping(Graph g)
Second step of the algorithm - mapping. Call labeling first.
Parameters:
g - labeled graph
Returns:
mapped graph (completely rebuilt)
See Also:
labeling

joinLUTs

private NodeLUT joinLUTs(NodeLUT child)
Collapses tree of same labeled nodes into s, using shortest-first joining.
Parameters:
child - sink node
Returns:
collapsed tree node

markAccessible

private void markAccessible(NodeLUT sink,
                            boolean top)
Similar to routine A of Ford Fulerson max-flow algorithm, marks visited nodes with .visited flag.

Each node is splitted into two parts - top and bottom. Top can access bottoms of predecessors, bottom can access successor tops. Top-bottom link is valid if node .flag == false.

Parameters:
sink - sink node
top - designates top access to sink node
See Also:
flowR,

buildSame

private void buildSame(NodeLUT child,
                       int label,
                       java.util.Vector LUTs)
adds all childs predecessors with same label into LUTs Vector

buildLUT

private NodeLUT buildLUT(NodeLUT child,
                         java.util.Vector GPI)
Collapses DAG of same nodes with temp==tempCnt-1 into child, using shortest-first joining. .temp is incremented, to disable looping.
Parameters:
child - sink node
Returns:
collapsed tree node