ztex
Class ConfigData

java.lang.Object
  extended by ztex.ConfigData

public class ConfigData
extends java.lang.Object

This class represents the configuration data space of ZTEX FPGA Boards that support it. The internal format is

 <Address> <Description>
 0..2      Signature "CD0"
 3         Kind of FPGA Board, see boardNames, e.g. 2 for "ZTEX USB-FPGA Module",
 4         FPGA Board series, e.g. 2
 5         FPGA Board number (number behind the dot), e.g. 16
 6..7      FPGA Board variant (letter), e.g. "b"
 8..9      FPGA, see fpgas, e.g. 12 for X7A200T
 10        FPGA package, see packages, e.g. 3 for FBG484
 11..13    Speed grade + temperature range, e.g. "2C"
 14        RAM size, format is ( n & 0xf0 ) << ( (n & 0xf) + 16 ) bytes
 15        RAM type, see ramTypes
 16..25    Serial number, overwrites SN_STRING of the ZTEX descriptor.  
           If it is equal to "0000000000" (default) it is replaced by the unique MAC address.
 26..27    Actual size of Bitstream in 4K sectors; 0 means Bitstream disabled (default)
 28..29    Maximum size of Bitstream in 4K sectors; 0 means that either no Flash
           is present or that this information is stored in Flash (exchangeable media)
 30..31    Start of the Bitstream in 4K sectors
 30..79    Reserved
 80..127   48 bytes user space
 


Field Summary
static java.lang.String[] boardNames
          Kinds of FPGA Boards.
static java.lang.String[] fpgas
          FPGA's used on ZTEX FPGA Boards.
static java.lang.String[] packages
          FPGA packages used on ZTEX FPGA boards.
static java.lang.String[] ramTypes
          RAM types and speed used on ZTEX FPGA boards.
 
Constructor Summary
ConfigData()
          Constructs an empty instance.
ConfigData(Ztex1v1 z)
          Constructs an instance and connects it with z.
 
Method Summary
 boolean connect(Ztex1v1 z)
          Reads the configuration data (if existent) from a device and connects it to this instance.
 byte[] data()
          Returns a copy of the configuration data array.
 java.lang.String defaultBitstreamPath(java.lang.String name)
          Returns the bitstream path if the same directory sheme as for the examples is used.
 boolean disconnect()
          Disconnects the currently connected device.
 int getBitstreamSize()
          Returns actual size of bitstream in bytes sectors. 0 means that no bitstream is stored.
 int getBitstreamStart()
          Returns bitstream start position in bytes.
 java.lang.String getFpga()
          Returns FPGA information.
 byte getMajorVersion()
          Returns the major version number, e.g. 2 for USB-FPGA Modules 2.14b.
 int getMaxBitstreamSize()
          Returns maximum size of bitstream in bytes.
 byte getMinorVersion()
          Returns the minor version number, e.g. 14 for USB-FPGA Modules 2.14b.
 java.lang.String getName()
          Returns the name of the FPGA Board.
 int getRamSize()
          Returns RAM size in bytes.
 java.lang.String getRamType()
          Returns RAM type and speed.
 java.lang.String getSN()
          Returns the serial number.
 byte getUserData(int i)
          Returns user data at index i.
 java.lang.String getVariant()
          Returns the variant letter, e.g.
 boolean sendtUserData()
          Sends the user data to the FPGA Board.
 boolean setBitstreamSize(int size)
          Sets the actual size of bitstream in bytes.
 void setBitstreamStart(int start4k)
          Sets the start position of the bitstream in 4 KByte sectors.
 void setFpga(java.lang.String name, java.lang.String pckg, java.lang.String sg)
          Sets FPGA information.
 void setMaxBitstreamSize(int size4k)
          Sets the maximum size of bitstream in 4 KByte sectors.
 void setName(java.lang.String kind, int series, int number, java.lang.String variant)
          Sets the name of the FPGA Board.
 void setRam(int size, java.lang.String type)
          Sets RAM information.
 boolean setSN(java.lang.String sn)
          Sets the serial number.
 void setUserData(int i, byte v)
          Sets user data at index i to value v.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

boardNames

public static final java.lang.String[] boardNames
Kinds of FPGA Boards. It's defined as
public static final String boardNames[] = {
    "(unknown)" ,             // 0
    "ZTEX FPGA Module" ,      // 1
    "ZTEX USB-FPGA Module"    // 2, FX2 based
    "ZTEX USB3-FPGA Module"   // 3, FX3 based
};


fpgas

public static final java.lang.String[] fpgas
FPGA's used on ZTEX FPGA Boards. It's defined as
public static final String fpgas[] = {
        "(unknown)" ,  // 0
        "XC6SLX9" ,    // 1
        "XC6SLX16" ,   // 2
        "XC6SLX25" ,   // 3
        "XC6SLX45" ,   // 4
        "XC6SLX75" ,   // 5
        "XC6SLX100" ,  // 6
        "XC6SLX150" ,  // 7
        "XC7A35T",     // 8
        "XC7A50T",     // 9
        "XC7A75T",     // 10
        "XC7A100T",    // 11
        "XC7A200T",    // 12
        "Quad-XC6SLX150",  // 13
        "XC7A15T",     // 14
};


packages

public static final java.lang.String[] packages
FPGA packages used on ZTEX FPGA boards. It's defined as
public static final String packages[] = {
        "(unknown)",  // 0
        "FTG256" ,    // 1  256 balls, 1.0mm
        "CSG324" ,    // 2  324 balls, 0.8mm
        "CSG484" ,    // 3  484 balls, 0.8mm
        "FBG484"      // 4  484 balls, 1.0mm
};


ramTypes

public static final java.lang.String[] ramTypes
RAM types and speed used on ZTEX FPGA boards. It's defined as
public static final String ramTypes[] = {
        "(unknown)",        // 0
        "DDR-200 SDRAM",    // 1
        "DDR-266 SDRAM",    // 2
        "DDR-333 SDRAM",    // 3
        "DDR-400 SDRAM",    // 4
        "DDR2-400 SDRAM",   // 5
        "DDR2-533 SDRAM",   // 6
        "DDR2-667 SDRAM",   // 7
        "DDR2-800 SDRAM",   // 8
        "DDR2-1066 SDRAM"   // 9
};

Constructor Detail

ConfigData

public ConfigData()
Constructs an empty instance.


ConfigData

public ConfigData(Ztex1v1 z)
           throws InvalidFirmwareException,
                  UsbException,
                  CapabilityException
Constructs an instance and connects it with z. Also see connect(Ztex1v1).

Parameters:
z - The ztex device to connect with.
Throws:
InvalidFirmwareException - if interface 1 is not supported.
UsbException - If a communication error occurs.
CapabilityException - If no MAC-EEPROM support is present.
Method Detail

connect

public boolean connect(Ztex1v1 z)
                throws InvalidFirmwareException,
                       UsbException,
                       CapabilityException
Reads the configuration data (if existent) from a device and connects it to this instance. After this user defined settings (e.g. serial number, bitstream size) are stored on device immediately after they are altered.

Parameters:
z - The ztex device to connect with.
Returns:
True if configuration data could be read.
Throws:
InvalidFirmwareException - If interface 1 is not supported.
UsbException - If a communication error occurs.
CapabilityException - If no MAC-EEPROM support is present.

disconnect

public boolean disconnect()
Disconnects the currently connected device. After this modified settings are not stored on device anymore.

Returns:
True if a device was connected.

data

public byte[] data()
Returns a copy of the configuration data array.

Returns:
A copy of the configuration data array.

getName

public java.lang.String getName()
Returns the name of the FPGA Board.

Returns:
The name of the FPGA Board.

getMajorVersion

public byte getMajorVersion()
Returns the major version number, e.g. 2 for USB-FPGA Modules 2.14b.

Returns:
the major version number.

getMinorVersion

public byte getMinorVersion()
Returns the minor version number, e.g. 14 for USB-FPGA Modules 2.14b.

Returns:
the minor version number.

getVariant

public java.lang.String getVariant()
Returns the variant letter, e.g. "b" for USB-FPGA Modules 2.14b.

Returns:
the variant letter.

setName

public void setName(java.lang.String kind,
                    int series,
                    int number,
                    java.lang.String variant)
Sets the name of the FPGA Board. Example:
setName("ZTEX USB-FPGA Module", 2, 16, "b");  // denotes "ZTEX USB-FPGA Module 2.16b"
This setting is not transferred to the FPGA Board because is should not be altered by the user.

Parameters:
kind - Kind of FPGA Board, see boardNames for possible values, e.g. "ZTEX USB-FPGA Module"
series - FPGA Board series, e.g. 2
number - FPGA Board number (number behind the dot), e.g. 16
variant - FPGA Board variant (letter), e.g. "b"

getFpga

public java.lang.String getFpga()
Returns FPGA information. Notation of the result is <name>-<package>-<speed grade and temperature range>, e.g. XC7A200T-FBG484-2C.

Returns:
FPGA Information.

setFpga

public void setFpga(java.lang.String name,
                    java.lang.String pckg,
                    java.lang.String sg)
Sets FPGA information. Example:
setFpga("XC7A200T", "FBG484", "2C");   // denotes Xilinx part number XC7A200T-2FBG484C
This setting is not transferred to the FPGA Board because is should not be altered by the user.

Parameters:
name - Name of the FPGA, see fpgas for possible values, e.g. "XC7A200T"
pckg - FPGA package, see packages for possible values, e.g. "FBG484"
sg - Speed grade and temperature range, e.g. "2C"

getRamType

public java.lang.String getRamType()
Returns RAM type and speed.

Returns:
FPGA Information.

getRamSize

public int getRamSize()
Returns RAM size in bytes.

Returns:
RAM size in bytes.

setRam

public void setRam(int size,
                   java.lang.String type)
Sets RAM information. Example:
setRam(128, "DDR2-800 SDRAM");   // sets RAM info to 128 MB DDR2-800 SDRAM
This setting is not transferred to the FPGA Board because is should not be altered by the user.

Parameters:
size - RAM size in MBytes, e.g. 128
type - RAM type and speed, see ramTypes for possible values, e.g. "DDR2-800 SDRAM"

getMaxBitstreamSize

public int getMaxBitstreamSize()
Returns maximum size of bitstream in bytes. This is the amount of flash which should be reserved for the bitstream.

Returns:
Maximum size of bitstream in bytes sectors.

setMaxBitstreamSize

public void setMaxBitstreamSize(int size4k)
Sets the maximum size of bitstream in 4 KByte sectors. This setting is not transferred to the FPGA Board because is should not be altered by the user.

Parameters:
size4k - Maximum size of bitstream in 4 KByte sectors. E.g. a value of 256 reserves 1 MByte for the bitstream.

getBitstreamStart

public int getBitstreamStart()
Returns bitstream start position in bytes. On devices which boot from flash the first sectors are reserved for the firmware.

Returns:
Bitstream start position in bytes.

setBitstreamStart

public void setBitstreamStart(int start4k)
Sets the start position of the bitstream in 4 KByte sectors. This setting is not transferred to the FPGA Board because is should not be altered by the user.

Parameters:
start4k - Bitstream start position in 4 KByte sectors. E.g. a value of 128 reserves 512 KByte for the bitstream.

getBitstreamSize

public int getBitstreamSize()
Returns actual size of bitstream in bytes sectors. 0 means that no bitstream is stored. The value is rounded up to a multiples of 4096.

Returns:
Actual size of bitstream in byte sectors.

setBitstreamSize

public boolean setBitstreamSize(int size)
                         throws InvalidFirmwareException,
                                UsbException,
                                CapabilityException
Sets the actual size of bitstream in bytes. The value is rounded up to a multiple of 4096. If a device is connected, this setting is transferred to the FPGA Board. A warning is printed if bitstream size is larger then the reserved size (see getMaxBitstreamSize()).

Parameters:
size - Actual size of bitstream in bytes.
Returns:
True if a device is connected and setting was send.
Throws:
InvalidFirmwareException - If interface 1 is not supported.
UsbException - If a communication error occurs.
CapabilityException - If no MAC-EEPROM support is present.

getSN

public java.lang.String getSN()
Returns the serial number. This is not necessarily the serial number returned by the FPGA board according to the USB specification, see setSN(String)

Returns:
Serial number as stored in the configuration data space.

setSN

public boolean setSN(java.lang.String sn)
              throws InvalidFirmwareException,
                     UsbException,
                     CapabilityException
Sets the serial number. During start-up the firmware overwrites SN_STRING from the ZTEX descriptor (see ZtexDevice1) by this value. If it is equal to "0000000000" (default) it is replaced by the unique MAC address.

This setting is transferred to the FPGA Board. Change takes effect after the next restart of the firmware.

Parameters:
sn - Serial number string. Only the first 10 characters are considered.
Returns:
True if a device is connected and setting was send.
Throws:
InvalidFirmwareException - If interface 1 is not supported.
UsbException - If a communication error occurs.
CapabilityException - If no MAC-EEPROM support is present.

getUserData

public byte getUserData(int i)
Returns user data at index i.

Parameters:
i - the index. Valid values are 0 to 47.
Returns:
User data.
Throws:
java.lang.IndexOutOfBoundsException - If i is smaller than 0 or greater than 47.

setUserData

public void setUserData(int i,
                        byte v)
                 throws java.lang.IndexOutOfBoundsException
Sets user data at index i to value v. Use the method getMaxBitstreamSize() to transfer the data to the FPGA Board.

Parameters:
i - The index. Valid values are 0 to 47.
v - The value.
Throws:
java.lang.IndexOutOfBoundsException - If i is smaller than 0 or greater than 47.

sendtUserData

public boolean sendtUserData()
                      throws InvalidFirmwareException,
                             UsbException,
                             CapabilityException
Sends the user data to the FPGA Board.

Returns:
True if a device is connected and data could be send.
Throws:
InvalidFirmwareException - If interface 1 is not supported.
UsbException - If a communication error occurs.
CapabilityException - If no MAC-EEPROM support is present.

defaultBitstreamPath

public java.lang.String defaultBitstreamPath(java.lang.String name)
Returns the bitstream path if the same directory sheme as for the examples is used. For USB-FPGA Modules 1.* and 2.0* (Spartan 6 FPGA) it is "usb-fpga-./.bit", for later FPGA Boards it is "usb-fpga-./.runs/impl_./.bit".

Parameters:
name - The project name.
Returns:
Standard bitstream path.