21 #ifndef TORC_BITSTREAM_ASSEMBLER_ASSEMBLER_HPP
22 #define TORC_BITSTREAM_ASSEMBLER_ASSEMBLER_HPP
32 #include <boost/regex.hpp>
33 #include <boost/smart_ptr.hpp>
81 typedef std::map<int32_t, map<int32_t, uint32_t> >
FrameWords;
121 #define DEPRECATED __attribute__ ((deprecated))
129 bool processLut(
const string& input,
const string& name =
"string stream");
133 void error(
const string& m);
141 if(inDigit >=
'0' && inDigit <=
'9')
return inDigit -
'0';
145 if(inDigit >=
'A' && inDigit <=
'F')
return inDigit -
'A' + 10;
194 if (inSiteType.length() > 3) {
195 return inSiteType.substr(0, 4).compare(
"RAMB") == 0;
201 const string &inElementName) {
203 if (inSiteType.compare(
"DSP48E") == 0) {
204 if (inElementName.compare(
"PATTERN") == 0 || inElementName.compare(
213 return inConfigName.length() == 7 && inConfigName.substr(0, 5).compare(
218 return inConfigName.substr(0, 6).compare(
"INITP_") == 0;
225 TileTypeToSiteType::iterator pTiles =
mLibrary.find(inTileType);
231 SiteTypeToConfigSettings::iterator pSites = pTiles->second.find(inSiteType);
232 if(pSites == pTiles->second.end()) {
245 const string &siteLocation);
263 uint32_t inMemoryInitRow,
const vector<uint32_t> &inBitAddresses,
269 uint32_t check = 0x01020304;
270 char *p = (
char *)✓
271 return (p[0] == 0x01);
274 void readWord(std::ifstream &fileStream, uint32_t &outWord) {
275 fileStream.read((
char *) &outWord,
sizeof(uint32_t));
281 uint32_t outWord = 0;
282 char *in = (
char *)&inWord;
283 char *out = (
char *)&outWord;
284 uint wordSize =
sizeof(inWord);
285 for(uint i = 0; i< wordSize; i++) {
286 out[i] = in[wordSize-i-1];
304 const vector<uint32_t> &inBitAddresses, uint32_t inBlockIndex) = 0;
350 #endif // TORC_BITSTREAM_ASSEMBLER_ASSEMBLER_HPP
bool isMemoryInitSetting(const string &inConfigName)
Is ramb memory init setting.
void convertXdlToBitstream(void)
Initiates Xdl to bitstream conversion.
Encapsulation of a tile index in an unsigned 32-bit integer.
std::set< std::string > mUnsupportedTileTypeSet
std::map< const string, std::vector< string > > CompoundSettingMap
Element name to vector of related element names that collectively affect bits.
void mergeHexConfigBits(string inElementName, string inConfigVal, const ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitstream for configuration with Hex values.
string getTiletypeFromSitename(const string &inSiteType)
Get tile type from site type.
virtual void checkValidityAndMergeBitstream(string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
Verify the configuratino and merge with base bitstream.
virtual bool isLutRamOrRomSetting(const string &inConfigVal)
Is config value a LUT ram setting.
virtual bool isCompoundSetting(string inElementName)=0
Does element need compound setting.
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.
Device database, including complete wiring and logic support.
static int hexCharacterToDec(char inDigit)
Convert a hex ASCII character to a decimal value.
std::map< const string, ConfigValuesToBits > ConfigSettingsToValues
Map from config setting to config values. ConfigSettingsToValues.
bool mTraceParsing
Enable debug output in the bison parser.
string mLutCurrentEquationLhs
LHS of Lut equation currently being processed.
virtual bool isLutEquationSetting(const string &inConfigValue)
Is config value a LUT equation.
virtual bool isConfigValHexString(const string &inSiteType, const string &inElementName)
Does the configuration have hex string in config value.
Header for the DirectoryTree class.
void mergeRambInitBits(const string &inConfigVal, uint32_t inMemoryInitRow, const vector< uint32_t > &inBitAddresses, uint32_t inBlock)
Merge micro-bitstreams for ramb memory init values.
static const string sLibraryRelativePath
Path to library folder containing mirco-bitstream database.
bool tileAndSiteExistInLibrary(const string &inTileType, const string &inSiteType)
Is site present in library database ToDo: This function will need tile type also. ...
Main torc::bitstream namespace header.
std::istream istream
Imported type name.
string mStreamName
Name of file or input stream for error messages.
std::map< int32_t, map< int32_t, uint32_t > > FrameWords
Currently not in use. Datastructure to store LUT frames in efficient and flexible way...
bool mSuccess
Flag signaling parsing success.
std::map< const string, SiteTypeToConfigSettings > TileTypeToSiteType
Map from tile type to site types. Includes routing as a site type.
void failure(void)
Signals a parsing failure by deasserting the success flag.
uint32_t reverseEndianness(uint32_t inWord)
Reverse endianness of input word.
bool processLut(const string &input, const string &name="string stream")
Import Lut expression from a string.
torc::bitstream::BitstreamSharedPtr mBitstreamPtr
torc::architecture::DDB DDB
Imported type name.
virtual bool isRoutethrough(const string &inSetting)
Is config a _ROUTETHROUGH.
void assembleRamb(torc::physical::InstanceSharedPtr inInstancePtr)
Assemble bitstream for Ramb.
void initialize(void)
Initializations done in constructor.
void readWord(std::ifstream &fileStream, uint32_t &outWord)
Read word from stream and convert endianness if required.
path mTargetBitstreamPath
Target bitstream path.
void mergeCompoundSettingBits(string inElement1Name, string inConfig1Val, InstanceSharedPtr inInstancePtr, const ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitstream for compound setting.
bool isMemoryParityInitSetting(const string &inConfigName)
Is ramb parity init setting.
EOperation
Permissible operations on LUT frames.
std::vector< uint32_t > mLutFrameSetForOne
Frame set for Lut output assigned to 1.
void binaryLutFrameOperation(EOperation inOperation)
Function called from parser when it encounters a bit operator.
Main torc::physical namespace header.
Site type and population data for the family and the device.
bool mTraceScanning
Enable debug output in the flex scanner.
virtual vector< string > getDependantConfigs(string inElement1Name)=0
Returs vector of related configurations.
virtual void initializeFrameDataForSite(const string &inSiteName)=0
Store frame blocks and bit offset for given site.
Tile map, tile type, and wire information for the family and device.
void pushLutFrame(string inLiteral)
Function called from parser when it encounters a literal.
EMergeMode mMergeMode
Merge mode - set bits or clear bits.
const torc::architecture::DDB & mDB
Torc database of architecutre on which design is implemented.
boost::filesystem::path path
Imported type name.
Assembler(DDB &inDB)
Constructor take only Xdl design pointer.
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
static const boost::regex sLutConfigRegEx
Regex to identify Lut configuration.
virtual int generateBitstream(DesignSharedPtr inDesignPtr, const path inTargetBitstreamPath, EMergeMode inMergeMode=eSet, path baseBitstreamPath=path())
Function to generate bitstream, takes target bitstream path and optional base bitstream path...
boost::filesystem::path path
const torc::architecture::Sites & mSites
Sites from the architecture database.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
virtual void getAnnotatedSiteTypeForSlicel(string &inOutSiteType, const string &siteLocation)
If slice site type, annotate type as per even or odd column.
bool mFreeDB
To track if DB object was allocated in constructor.
void mergeLutEquationBits(const string &inElementName, const string &inConfigValue, ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitstream for Lut equation.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
void saveBitstream(void)
Save bitstream.
std::string string
Imported type name.
ConfigValuesToBits mCurrentConfigToBitMap
Map from Lut config value to micro-bitstreams.
void assembleNets(void)
Assemble bitstream for nets.
int mUnsupportedTileTypeCount
virtual bool isSiteTypeSupported(const string &inSiteType)=0
Is site supporeted for Xdl to bitstream conversion.
static const string sConfigOff
String used when an element is explicity configured off.
std::map< const string, ConfigSettingsToValues > SiteTypeToConfigSettings
Map from site type to config settings. SiteTypeToConfigSettings.
void mergeLutRamOrRomBits(const string &inElementName, const string &inConfigVal, ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitsram for Lut in ram/rom mode.
virtual ~Assembler(void)
Destructor does not do anything.
boost::filesystem::path mLibraryPath
Pointer to bitstream object to which micro bitstreams are merged.
TileTypeToSiteType mLibrary
Micro-bitstream library in map datastructure.
static const boost::regex sRoutethroughRegEx
Regex to indentify ROUTETHROUGH configuration in instances.
static const boost::regex sLutRamOrRomConfigRegEx
Regex to identify Luts configured as ram/rom.
void error(const location &l, const string &m)
Lut parse error handling.
int mUnsupportedInstCount
void assembleInstances(void)
Assemble bitstream for instances.
Header for the DDB class.
class torc::LutScanner * lexer
Pointer to the current lexer instance.
vector< vector< uint32_t > > mLutFrameSetStack
Frame set for literals are pushed to this stack.
torc::physical::DesignSharedPtr mDesignPtr
Xdl design pointer.
bool isBigEndianMachine()
Check if processor is big endian.
uint32_t mLutCurrentReferenceFrameIndex
Address of 1st frame being affected by Lut equation.
static const string sLibraryExtension
Extension used for micro-bitstream libraries.
virtual void mergeWithBaseBitstream(const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
Merge micro-bitstream with base bitstream.
Base class for bitstream assembly.
uint32_t mCurrentReferenceWordIndex
Address of 1st work within frame affected by Lut equation.
virtual void initializeFrameDataForTile(TileIndex inTileIndex)=0
Store frame blocks and bit offset for given tile index.
int mUnsupportedTileCount
boost::shared_ptr< Bitstream > BitstreamSharedPtr
bool elementAndConfigExistInLibrary(const string &inElementName, const string &configValue, ConfigSettingsToValues &inConfigSettingToValues)
Is configuration present in given map.
void populateLibraryMap(path inLibDBPath)
Read micro-bitstream library file and populate it in a map.
const torc::architecture::Tiles & mTiles
Tiles from architecture database.
virtual bool isRambSite(const string &inSiteType)
Returns true if the site is some form of RAMB site.
std::map< const string, std::vector< uint32_t > > ConfigValuesToBits
Map from config value to vector of config bits. ConfigValuesToBits.
boost::shared_ptr< Assembler > AssemblerSharedPtr
Typedef for shared pointer of Assembler class.