lib.datatypes
Class VirtexCoordinate

java.lang.Object
  |
  +--lib.datatypes.VirtexCoordinate

public class VirtexCoordinate
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

VirtexCoordinate represents a point in the space of a Virtex I FPGA. NOTE: Slices are ordered as in the literature with 1 being positioned on the left and 0 on the right half of the CLB. This will apparently be different in a Virtex II device.

Copyright (c) 2002 Alex Carreira

Version:
1.0
Author:
Alex Carreira
See Also:
Serialized Form

Constructor Summary
VirtexCoordinate()
          Constructs a VirtexCoordinate at the bottom left corner of a device (0, 0, 1, 0).
VirtexCoordinate(AbsoluteCoordinate aAC)
          Constructs a VirtexCoordinate from an AbsoluteCoordinate.
VirtexCoordinate(int aCLBColumn, int aCLBRow, int aSlice, int aLE)
          Constructs a VirtexCoordinate at a user specified location.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object aVirtexCoord)
          Compares two VirtexCoordinates.
 int getAbsoluteLERow()
           
 int getAbsoluteSliceColumn()
           
 int getCLBColumn()
           
 int getCLBRow()
           
 int getLE()
           
 int getSlice()
           
 void incrementCLBCol()
          Increments the VirtexCoordinate column by one CLB.
 void incrementCLBRow()
          Increments the VirtexCoordinate row by one CLB.
 void incrementLERow()
          Increments the VirtexCoordinate row by one LE.
 void incrementSliceCol()
          Increments the VirtexCoordinate column by one slice.
 boolean isValid()
           
 void setCLBColumn(int aCLBColumn)
          Set the CLB column location.
 void setCLBRow(int aCLBRow)
          Set the CLB row location.
 void setLE(int aLE)
          Set the LE location.
 void setSlice(int aSlice)
          Set the Slice location.
 java.lang.String toString()
           
 boolean tryAddExplicitDimToCoord(int aCLBColumnDim, int aCLBRowDim, int aSliceDim, int aLEDim, boolean sliceShared)
          Trys to add an explicit Virtex Dimension to a Virtex Coordinate and returns false if unsuccessful.
 boolean trySubCoord(VirtexCoordinate aVC)
           
 boolean trySubExplicitDimFromCoord(int aCLBColumnDim, int aCLBRowDim, int aSliceDim, int aLEDim, boolean sliceShared)
          Trys to subtract an explicit Virtex Dimension from a Virtex Coordinate and returns false if unsuccessful.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtexCoordinate

public VirtexCoordinate()
Constructs a VirtexCoordinate at the bottom left corner of a device (0, 0, 1, 0).

VirtexCoordinate

public VirtexCoordinate(AbsoluteCoordinate aAC)
Constructs a VirtexCoordinate from an AbsoluteCoordinate.

VirtexCoordinate

public VirtexCoordinate(int aCLBColumn,
                        int aCLBRow,
                        int aSlice,
                        int aLE)
                 throws VirtexCoordinateException
Constructs a VirtexCoordinate at a user specified location.
Parameters:
aCLBColumn - A column coordinate.
aCLBRow - A row coordinate.
aSlice - A slice coordinate.
aLE - A LE coordinate.
Throws:
Throws - a VirtexCoordinateException if a value less than zero is specified for any parameter. Also thrown if the Slice or LE locations specified exceed one.
Method Detail

setCLBColumn

public final void setCLBColumn(int aCLBColumn)
                        throws VirtexCoordinateException
Set the CLB column location.
Parameters:
aCLBColumn - A location of a CLB column.
Throws:
Throws - a VirtexCoordinateExcption if a value less than zero is specified.

getCLBColumn

public final int getCLBColumn()
Returns:
The location of a CLB column.

setCLBRow

public final void setCLBRow(int aCLBRow)
                     throws VirtexCoordinateException
Set the CLB row location.
Parameters:
aCLBRow - A location of a CLB row.
Throws:
Throws - a VirtexCoordinateExcption if a value less than zero is specified.

getCLBRow

public final int getCLBRow()
Returns:
The location of a CLB row.

setSlice

public final void setSlice(int aSlice)
                    throws VirtexCoordinateException
Set the Slice location.
Parameters:
aSlice - A location of a Slice within a CLB.
Throws:
Throws - a VirtexCoordinateException if a value less than zero or greater than one is specified.

getSlice

public final int getSlice()
Returns:
The location of a slice within a CLB.

setLE

public final void setLE(int aLE)
                 throws VirtexCoordinateException
Set the LE location.
Parameters:
aLE - A location of a LE within a CLB.
Throws:
Throws - a VirtexCoordinateException if a value less than zero or greater than one is specified.

getLE

public final int getLE()
Returns:
The location of a LE within a CLB.

getAbsoluteSliceColumn

public final int getAbsoluteSliceColumn()
Returns:
The absolute location of a Slice from the left edge in Slice units.

getAbsoluteLERow

public final int getAbsoluteLERow()
Returns:
The absolute location of a LE from the bottom edge in LE units.

equals

public boolean equals(java.lang.Object aVirtexCoord)
Compares two VirtexCoordinates.
Overrides:
equals in class java.lang.Object
Parameters:
aVirtexCoord - aVirtexCoordinate to compare.
Returns:
false if not equal, true otherwise.

clone

public java.lang.Object clone()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A String representing an instance of VirtexCoordinate.

isValid

public boolean isValid()
Returns:
True if this is a valid Virtex Coordinate, false otherwise.

incrementSliceCol

public void incrementSliceCol()
Increments the VirtexCoordinate column by one slice.

incrementCLBCol

public void incrementCLBCol()
Increments the VirtexCoordinate column by one CLB.

incrementLERow

public void incrementLERow()
Increments the VirtexCoordinate row by one LE.

incrementCLBRow

public void incrementCLBRow()
Increments the VirtexCoordinate row by one CLB.

tryAddExplicitDimToCoord

public boolean tryAddExplicitDimToCoord(int aCLBColumnDim,
                                        int aCLBRowDim,
                                        int aSliceDim,
                                        int aLEDim,
                                        boolean sliceShared)
Trys to add an explicit Virtex Dimension to a Virtex Coordinate and returns false if unsuccessful. WARNING: Even if unsuccessful, this method may modify the coordinate rendering it unusable. It is recommended that a coordinate be cloned and that the clone perform this operation testing the return value for validity.
Parameters:
aCLBColumnDim - Width in CLBs, must be greater than or equal to zero.
aCLBRowDim - Height in CLBs, must be greater than or equal to zero.
aSliceDim - Width in Slices, must be greater than or equal to zero.
aLEDim - Height in LEs, must be greater than or equal to zero.
sliceShared - Specifies whether to increment LEs into the middle of slices (true), or to the start of the next slice (false).
Returns:
False if operation fails to create a valid coordinate, true otherwise.

trySubExplicitDimFromCoord

public boolean trySubExplicitDimFromCoord(int aCLBColumnDim,
                                          int aCLBRowDim,
                                          int aSliceDim,
                                          int aLEDim,
                                          boolean sliceShared)
Trys to subtract an explicit Virtex Dimension from a Virtex Coordinate and returns false if unsuccessful. WARNING: Even if unsuccessful, this method may modify the coordinate rendering it unusable. It is recommend that a coordinate be cloned and that the clone perform this operation testing the return value for validity.
Parameters:
aCLBColumnDim - Width in CLBs, must be greater than or equal to zero.
aCLBRowDim - Height in CLBs, must be greater than or equal to zero.
aSliceDim - Width in Slices, must be greater than or equal to zero.
aLEDim - Height in LEs, must be greater than or equal to zero.
sliceShared - Specifies whether to decrement LEs into the middle of slices (true), or to the start of the next slice (false).
Returns:
False if operation fails to create a valid coordinate, true otherwise.

trySubCoord

public boolean trySubCoord(VirtexCoordinate aVC)
Parameters:
aVC - A VirtexCoordinate to subtract from this VirtexCoordinate instance.
Returns:
True if successful, false otherwise.