24 #include "../../../Common/FileIO.h"
25 #include "../../../Common/str.h"
46 uint32_t cor0 =
XCAP_getCOR0value(7, 0, 0, 0, 0, 0, 0,
DONE_CYCLE::Phase4,
MATCH_CYCLE::NoWait,
LOCK_CYCLE::NoWait,
GTS_CYCLE::Phase5,
GWE_CYCLE::Phase6);
57 uint32_t ctrl0 =
XCAP_getCTRL0value(0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0);
73 uint32_t ctrl0 =
XCAP_getCTRL0value(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0);
93 if((slr + 1) < numberOfSLRs) {
102 slrMagicInstrLocation[slr] = fout.tellp();
109 streamoff currentStreamHead = fout.tellp();
110 streamoff bypassSize = (currentStreamHead - slrMagicInstrLocation[slr])/4 - 1;
111 fout.seekp(slrMagicInstrLocation[slr]);
113 fout.seekp(currentStreamHead);
124 uint32_t cor0 =
XCAP_getCOR0value(7, 0, 0, 0, 0, 0, 0,
DONE_CYCLE::Phase4,
MATCH_CYCLE::NoWait,
LOCK_CYCLE::NoWait,
GTS_CYCLE::Phase5,
GWE_CYCLE::Phase6);
132 if((slr + 1) < numberOfSLRs) {
134 slrMagicInstrLocation[slr] = fout.tellp();
141 streamoff currentStreamHead = fout.tellp();
142 streamoff bypassSize = (currentStreamHead - slrMagicInstrLocation[slr])/4 - 1;
143 fout.seekp(slrMagicInstrLocation[slr]);
145 fout.seekp(currentStreamHead);
162 size_t dotpos = filename.rfind(
".");
163 if(dotpos == string::npos)
164 throw runtime_error(
string(
"Invalid file name: \"").append(filename).append(
"\"!\n"));
165 designName = filename.substr(0, dotpos);
167 log(
"Writing Xilinx UltraScale bitstream to file \"" + filename +
"\":");
171 if(selectedOptions.partialNotFull) {
173 throw runtime_error(
string(
"Currently only full clock region height relocations are supported (use row numbers multiple of ").append(
to_string(
XUS_CLB_PER_CLOCK_REGION)).append(
"."));
175 throw runtime_error(
"Invalid output size dimentions.");
178 ofstream fout (filename, ofstream::binary | ofstream::trunc);
180 throw runtime_error(
string(
"Could not open file: \"").append(filename).append(
"\"!\n"));
186 throw runtime_error(
string(
"Unknown Xilinx UltraScale file format tried to be written.\n"));
188 log(
"Xilinx UltraScale bitstream file \"" + filename +
"\" written successfully.");
Endianness
< Endianness in byteman is represented not only by big/little endian, but also by potential bit swapp...
#define XUS_CLB_PER_CLOCK_REGION
void outputBitstreamGlobalHeaderSequence(std::ofstream &, bool, Endianness) override
Written by outputBitstreamSLRHeaderAfterBitstreamSequence(), outputBitstreamEmptySLRHeaderSequence() ...
void outputBitstreamEmptySLRWrapUpSequence(std::ofstream &, int, bool, Endianness) override
void outputBitstreamGlobalFooterSequence(std::ofstream &, bool, Endianness) override
void outputBitstreamSLRWrapUpSequence(std::ofstream &, int, bool, Endianness) override
void outputBitstreamSLRHeaderAfterBitstreamSequence(std::ofstream &, int, bool, Endianness) override
void outputBitstreamEmptySLRHeaderSequence(std::ofstream &, int, bool, Endianness) override
void outputBitstreamSLRHeaderBitstreamSequence(std::ofstream &, int, bool, Endianness) override
void writeBitstream(std::string, std::string, Rect2D)
void outputBitstreamSLRFooterBitstreamSequence(std::ofstream &, int, bool, Endianness) override
void XCAP_writeRegister(std::ofstream &fout, XCAP::Register reg, int writeValue, Endianness e)
Generate the encoding for writing a CAP register and write it to file ofstream.
void XCAP_writeCommand(std::ofstream &fout, XCAP::Command cmd, Endianness e)
Generate the encoding for writing a CAP command and write it to file ofstream.
void XCAP_writeSYNQ(std::ofstream &fout, Endianness e)
Generate and write an SYNQ command.
void XCAP_writeSelectRegister(std::ofstream &fout, XCAP::Register reg, Endianness e)
Generate the encoding for "selecting" a CAP register and write it to file ofstream.
void XCAP_writeType2(std::ofstream &fout, int wordCount, Endianness e)
Generate and write only a type 2 FDRI command.
void XCAP_writeMaskAndRegister(std::ofstream &fout, XCAP::Register reg, int writeMask, int writeValue, Endianness e)
Generate the encoding for writing a CAP register with a mask and write it to file ofstream.
uint32_t XCAP_getCOR0value(int Reserved_31_27, int ECLK_EN, int Reserved_25, int DRIVE_DONE, int Reserved_23, int OSCFSEL, int Reserved_16_15, DONE_CYCLE selDONE_CYCLE, MATCH_CYCLE selMATCH_CYCLE, LOCK_CYCLE selLOCK_CYCLE, GTS_CYCLE selGTS_CYCLE, GWE_CYCLE selGWE_CYCLE)
Generate COR0 register write value.
void XCAP_writeNOP(std::ofstream &fout, int cnt, int payload, Endianness e)
Generate the encoding for NOP instructions and write them to file ofstream.
uint32_t XCAP_getCTRL0value(int EFUSE_KEY, int ICAP_SELECT, int Reserved_29_13, int OverTempShutDown, int Reserved_11, int ConfigFallback, int Reserved_9, int GLUTMASK_B, int Reserved_7, int DEC, int SBITS, int PERSIST, int Reserved_2_1, int GTS_USR_B)
Generate CTRL0 register write value.
uint32_t XCAP_getFarFarInstruction()
Generate and return the encoding for a Far FAR instruction.
void writeBitstreamBIT(std::ofstream &fout, Rect2D cmdRect)
void writeBitstreamBIN(std::ofstream &fout, Rect2D cmdRect)
void parseParams(std::string params)
std::string to_string(Endianness e)
void write32(std::ofstream &fout, uint32_t writeValue, Endianness e=Endianness::NATIVE)
bool stringEndsWith(std::string checkedString)
Returns false. End of recursion for template.