org.opencores.structure
Class NodeLUT

java.lang.Object
  |
  +--org.opencores.structure.Node
        |
        +--org.opencores.structure.NodeLUT
Direct Known Subclasses:
NodePrim

public class NodeLUT
extends Node

LUT cell type class. It implements function, and allows joining last port is always output, first width-1 are always inputs


Field Summary
 byte[] func
          function data stored here parameters are ordered like in ports, 8 bits per byte
 int OUT
          which port is output port
 
Fields inherited from class org.opencores.structure.Node
dir, flag, fx, fy, INOUT, INPUT, link, name, nfx, nfy, OUTPUT, ports, temp, visited, weight, width, x, y
 
Constructor Summary
NodeLUT(int width)
          constructs empty LUT
NodeLUT(NodeLUT a, NodeLUT b, boolean updateNets)
          Constructor, that joins two specified adjacent LUTs and creates new one.
 
Method Summary
 int calc(int inputs)
          Calculates LUTs function
 java.lang.Object clone()
          creates new (unlinked) node with same parameters.
 void duplicate(NodeLUT n)
          duplicates parameters from n to this
static boolean isAChild(NodeLUT a, NodeLUT b)
          Determines, if a is a child of b.
static int NumJoinInputs(NodeLUT a, NodeLUT b)
          Function, that returns number of inputs if two specified LUTs were joined, not counting matching inputs.
static int NumJoinInputsEx(NodeLUT a, NodeLUT b)
          Function, that returns number of inputs if two specified LUTs were joined, not counting matching inputs nor inbetween connections.
 void permutateInputs(int[] pi)
          Permutates inputs by pi.
 void permutateInputsInv(int[] pi)
          Permutates inputs by inv(pi).
private  int size()
          length of function data
 java.lang.String toString()
           
 
Methods inherited from class org.opencores.structure.Node
duplicate, linkNets, setWidth, unlinkNets
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

OUT

public int OUT
which port is output port

func

public byte[] func
function data stored here parameters are ordered like in ports, 8 bits per byte
Constructor Detail

NodeLUT

public NodeLUT(NodeLUT a,
               NodeLUT b,
               boolean updateNets)
Constructor, that joins two specified adjacent LUTs and creates new one. Removes matching inputs and repairs function accordingly. But it does not remove LUTs nor nets from graph.

Parent MUST drive child's input, and parent MUST NOT have any other childs. It is not possible to do this more generally, since we may have loops.

Parameters:
a - parent LUT
b - child LUT
updateNets - whether this function should update net ports

NodeLUT

public NodeLUT(int width)
constructs empty LUT
Parameters:
width - number of ports (including output!)
Method Detail

size

private int size()
length of function data
Returns:
number of possible inputs

NumJoinInputs

public static final int NumJoinInputs(NodeLUT a,
                                      NodeLUT b)
Function, that returns number of inputs if two specified LUTs were joined, not counting matching inputs.

Parent can drive child's input. It is not possible to do this more generally, since we can have loops.

Parameters:
a - parent LUT
b - child LUT
Returns:
number of inputs

isAChild

public static final boolean isAChild(NodeLUT a,
                                     NodeLUT b)
Determines, if a is a child of b.
Parameters:
a - any LUT
b - any LUT
Returns:
true if a is child of b, and false when b is child of a, or a and b are uncorrelated.

NumJoinInputsEx

public static final int NumJoinInputsEx(NodeLUT a,
                                        NodeLUT b)
Function, that returns number of inputs if two specified LUTs were joined, not counting matching inputs nor inbetween connections.
Parameters:
a - LUT
b - LUT
Returns:
number of inputs

permutateInputs

public void permutateInputs(int[] pi)
                     throws java.lang.Exception
Permutates inputs by pi.
Parameters:
pi - permutation (pi[source_index]=destination_index), must be same length as width-1

permutateInputsInv

public void permutateInputsInv(int[] pi)
                        throws java.lang.Exception
Permutates inputs by inv(pi).
Parameters:
pi - inverse permutation (pi[dest_index]=source_index), must be same length as width-1

calc

public final int calc(int inputs)
Calculates LUTs function
Parameters:
inputs - inputs passed to function, LSB is first parameter
Returns:
0 or 1

toString

public java.lang.String toString()
Overrides:
toString in class Node

clone

public java.lang.Object clone()
creates new (unlinked) node with same parameters.
Returns:
duplicated node
Overrides:
clone in class Node

duplicate

public void duplicate(NodeLUT n)
duplicates parameters from n to this
Parameters:
n - node to copy data from