public class LUTTools
extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
empty |
static String |
LUT_INIT |
static char[] |
lutLetters |
static String[][] |
lutMap |
static int |
MAX_LUT_SIZE |
Constructor and Description |
---|
LUTTools() |
Modifier and Type | Method and Description |
---|---|
static EDIFPropertyValue |
configureLUT(Cell c,
String equation)
Programs a LUT cell's init string from the provided equation.
|
static EDIFPropertyValue |
configureLUT(EDIFCellInst c,
String equation)
Programs a LUT cell's init string from the provided equation.
|
static int |
getBit(int value,
int bitIndex) |
static int |
getBit(long value,
int bitIndex) |
static BEL |
getCompanionLUT(Cell cell)
From a placed LUT cell, get the companion LUT BEL location.
|
static Cell |
getCompanionLUTCell(Cell cell)
From a placed LUT cell, get the cell in the companion LUT BEL location.
|
static String |
getCompanionLUTName(BEL lut)
Gets the BEL's companion LUT.
|
static String |
getCompanionLUTName(String lutName)
Get the companion LUT name of the provided LUT name.
|
static long |
getInitValue(String init)
Converts the Verilog-syntax number literal for the LUT initialization
to a primitive long integer.
|
static String[] |
getLUTBELNames(char lutLetter)
Gets the corresponding BEL site names for a given LUT letter.
|
static String |
getLUTEquation(Cell c)
Reads the init string in this LUT and creates an equivalent (non-optimal) equation.
|
static String |
getLUTEquation(EDIFCellInst i)
Reads the init string in this LUT and creates an equivalent (non-optimal) equation.
|
static String |
getLUTEquation(String init)
Creates a (dumb, non-reduced) boolean logic equation compatible
with Vivado's LUT Equation Editor from an INIT string.
|
static String |
getLUTInitFromEquation(String equation,
int lutSize)
Evaluates the provided equation in order to create the INIT string
of a LUT of the given size.
|
static BELPin |
getLUTOutputPin(BEL bel)
Gets the output pin from the BEL of a LUT
|
static int |
getLUTSize(Cell c)
If the provided cell is a LUT, it will return the LUT input
count.
|
static int |
getLUTSize(EDIFCellInst c)
If the provided cell instance is a LUT, it will return the LUT input
count.
|
static int |
getLUTSize(String init)
Performs essentially a log_2 operation on the init string length
to get the LUT size.
|
static int |
initLength(String init)
Extracts the length value from the INIT String (16, in 16'hA8A2)
|
static boolean |
isCellALUT(Cell c)
Checks if this cell is a LUT (LUT1, LUT2, LUT3,...).
|
static boolean |
isCellALUT(EDIFCellInst i)
Checks if this cell is a LUT (LUT1, LUT2, LUT3,...).
|
static void |
main(String[] args) |
static void |
printTruthTable(Cell c)
Prints out the truth table for the given INIT string on the cell.
|
static void |
printTruthTable(EDIFCellInst c)
Prints out the truth table for the given INIT string on the cell.
|
static long |
setBit(long value,
int bitIndex) |
static int |
swapLutPinsFromPIPs(Design design)
Analyze the routing PIPs of a design to identify (based on whether a PIP existing
on a Net drives the expected SitePin based on Net.getPins()) and perform any necessary
LUT pin swapping.
|
static int |
swapMultipleLutPins(Map<SitePinInst,String> oldPinToNewPins)
Given a mapping from old SitePinInsts to new site pin name, update all state
necessary to reflect these LUT pin swaps.
|
static void |
swapSingleLutPins(String key,
Collection<PinSwap> pinSwaps)
For each pair of LUT sites (5LUT/6LUT), perform pin swapping.
|
public static final String LUT_INIT
public static final int MAX_LUT_SIZE
public static final String[][] lutMap
public static final char[] lutLetters
public static final String[] empty
public static String[] getLUTBELNames(char lutLetter)
lutLetter
- The letter of the LUT of interest. Valid values are 'A'..'H',
case insensitive.public static String getCompanionLUTName(BEL lut)
lut
- The LUT bel in question.public static String getCompanionLUTName(String lutName)
lutName
- Name of the LUT in question.public static BEL getCompanionLUT(Cell cell)
cell
- A placed cell on a LUT BEL.public static Cell getCompanionLUTCell(Cell cell)
cell
- A placed cell on a LUT BEL.public static BELPin getLUTOutputPin(BEL bel)
bel
- The physical bel site of the LUTpublic static boolean isCellALUT(Cell c)
c
- The cell in questionpublic static boolean isCellALUT(EDIFCellInst i)
i
- The cell in questionpublic static int getLUTSize(Cell c)
c
- The LUT cellpublic static int getLUTSize(EDIFCellInst c)
c
- The LUT cellpublic static int initLength(String init)
init
- The init string.public static int getLUTSize(String init)
init
- The LUT's init string.public static void printTruthTable(Cell c)
c
- The Cell in question.public static void printTruthTable(EDIFCellInst c)
c
- The cell instance in question.public static long getInitValue(String init)
init
- The LUT INIT string.public static long setBit(long value, int bitIndex)
public static int getBit(int value, int bitIndex)
public static int getBit(long value, int bitIndex)
public static String getLUTInitFromEquation(String equation, int lutSize)
Operators:
XOR: @, ^
AND: &, *, .
OR: |, +
NOT: ~, !
A Few Examples:
O = 0
O = 1
O = (I0 & I1) + (I2 & I3)
O = I0 & !I1 & !I3
NOTE: XOR and AND have the same precedence and are evaluated from left
to right. Vivado uses different rules for handling operators of the
same precedence, so be sure to use parentheses to avoid any ambiguity!equation
- A Vivado LUT Equation String. This follows the same
conventions as the Vivado LUT equation string editor.lutSize
- LUT size (input count), supported sizes are: 1,2,3,4,5,6public static EDIFPropertyValue configureLUT(Cell c, String equation)
c
- The LUT cell to program.equation
- The desired programming of the LUT using Vivado LUT equation syntax.public static EDIFPropertyValue configureLUT(EDIFCellInst c, String equation)
c
- The LUT cell instance to program.equation
- The desired programming of the LUT using Vivado LUT equation syntax.public static String getLUTEquation(Cell c)
c
- The LUT instancepublic static String getLUTEquation(EDIFCellInst i)
i
- The LUT instancepublic static String getLUTEquation(String init)
init
- The existing INIT string configuring a LUT.public static int swapMultipleLutPins(Map<SitePinInst,String> oldPinToNewPins)
oldPinToNewPins
- Mapping from old pins to new pins.public static void swapSingleLutPins(String key, Collection<PinSwap> pinSwaps)
key
- The name of the site and letter of LUT pair (ex: SLICE_X54Y44/D)pinSwaps
- The list of pin swaps to be performed on the pair of LUT sitespublic static int swapLutPinsFromPIPs(Design design)
design
- Design object to analyze and fix.public static void main(String[] args)