byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
XUS_Assembler.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2022 Kristiyan Manev (University of Manchester)
3  *
4  * Licensed under the Apache License, Version 2.0(the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #include<iostream>
18 #include<algorithm> //replace
19 #include<string>
20 #include<stdexcept>
21 #include<fstream>
22 #include<cstring>
23 #include<iomanip> //setfill, setw
24 
25 #include "XilinxUltraScale.h"
26 #include "../../../Common/FileIO.h"
27 #include "../../../Common/str.h"
28 #include "../../../Common/Endianness.h"
29 
30 using namespace std;
31 
32 void XilinxUltraScale::assembler(string filenameIn, string filenameOut)
33 {
34  enum FILEFORMAT {FILE_NULL = 0, FILE_BIT, FILE_BIN, FILE_BIT_ASM};
35  FILEFORMAT fileformatIn = FILE_NULL, fileformatOut = FILE_NULL;
36 
37  if(str::iff::stringEndsWith(filenameIn, ".bit"))
38  fileformatIn = FILE_BIT;
39  if(str::iff::stringEndsWith(filenameIn, ".bin"))
40  fileformatIn = FILE_BIN;
41  if(str::iff::stringEndsWith(filenameIn, ".bitasm"))
42  fileformatIn = FILE_BIT_ASM;
43  if(str::iff::stringEndsWith(filenameOut, ".bit"))
44  fileformatOut = FILE_BIT;
45  if(str::iff::stringEndsWith(filenameOut, ".bin"))
46  fileformatOut = FILE_BIN;
47  if(str::iff::stringEndsWith(filenameOut, ".bitasm"))
48  fileformatOut = FILE_BIT_ASM;
49 
50  ifstream fin (filenameIn, ifstream::binary);
51  if(!fin.good())
52  throw runtime_error(string("Could not open file: \"").append(filenameIn).append("\" .\n"));
53 
54  ofstream fout (filenameOut, ofstream::binary | ofstream::trunc);
55  if(!fout.good())
56  throw runtime_error(string("Could not open file: \"").append(filenameOut).append("\"!\n"));
57 
58  if(fileformatIn == FILE_BIT && fileformatOut == FILE_BIT_ASM)
59  disassemblerBitToAsm(fin, fout);
60  else if(fileformatIn == FILE_BIN && fileformatOut == FILE_BIT_ASM)
61  disassemblerBinToAsm(filenameIn, fin, fout);
62  else if(fileformatIn == FILE_BIT_ASM && fileformatOut == FILE_BIT)
63  assemblerAsmToBit(fin, fout);
64  else if(fileformatIn == FILE_BIT_ASM && fileformatOut == FILE_BIN)
65  assemblerAsmToBin(fin, fout);
66  else
67  throw runtime_error(string("Unknown Xilinx US assembler operation between file formats. See \"byteman -h assembly\".\n"));
68  fin.close();
69  fout.close();
70 }
71 
72 void XilinxUltraScale::disassemblerBinToAsm(string filenameIn, ifstream& fin, ofstream& fout) {
73  loadedBitstreamEndianness = parseBitstreamEndianness(fin);
74  uint32_t idcode = parseBitstreamIDCODE(fin, loadedBitstreamEndianness);
75  setDeviceByIDCODEOrThrow(idcode);
76  designName = filenameIn;
78 
79  disassemblerToAsm(fin, fout);
80 }
81 
82 void XilinxUltraScale::disassemblerBitToAsm(ifstream& fin, ofstream& fout) {
83  loadedBitstreamEndianness = parseBitstreamEndianness(fin);
84  parseBITheader(fin, loadedBitstreamEndianness);
85  setDeviceByPartNameOrThrow();
86 
87  disassemblerToAsm(fin, fout);
88 }
89 void XilinxUltraScale::assemblerAsmToBit(ifstream& fin, ofstream& fout){
90  assemblerParseHeader(fin);
91 
92  setDeviceByPartNameOrThrow();
93  initializeResourceStringParameters();
94  outputBITheader(fout, loadedBitstreamEndianness);
95 
96  assemblerAsmTo(fin, fout);
97 }
98 void XilinxUltraScale::assemblerAsmToBin(ifstream& fin, ofstream& fout){
99  assemblerParseHeader(fin);
100 
101  setDeviceByPartNameOrThrow();
102  initializeResourceStringParameters();
103 
104  assemblerAsmTo(fin, fout);
105 }
106 
108 {
109  for (string line; getline(fin, line); ) {
110  auto firstEqPos = line.find_first_of('=');
111  if(firstEqPos != string::npos)
112  line.replace(firstEqPos, 1, '=',' ');
113 
114  if(str::iff::stringContains(line, "Name"))designName = str::parse::lastStringWord(line);
115  if(str::iff::stringContains(line, "FPGA"))partName = str::parse::lastStringWord(line);
116  if(str::iff::stringContains(line, "Date"))fileDate = str::parse::lastStringWord(line);
117  if(str::iff::stringContains(line, "Time"))fileTime = str::parse::lastStringWord(line);
118  if(str::iff::stringContains(line, "HEADER END"))break;
119  }
120  log("Design name: " + designName);
121  log("FPGA: " + partName);
122  log("Date: " + fileDate);
123  log("Time: " + fileTime);
124 }
125 void XilinxUltraScale::assemblerAsmTo(ifstream& fin, ofstream& fout)
126 {
127  outputCAPheaderConstant(fout, loadedBitstreamEndianness);
128 
130  int frameCount = 0;
131  int slr = 0, b = 7, r = 0, c = 0, m = 0;
132  for (string line; getline(fin, line); ) {
133  if(line.at(line.find_first_not_of(" \t")) == '#')// if #, skip that line as comment
134  continue;
135  transform(line.begin(), line.end(), line.begin(), ::toupper);
136  replace(line.begin(), line.end(), '=',' ');
137  replace(line.begin(), line.end(), '#',' ');
138  replace(line.begin(), line.end(), ',', ' ');
139  if(str::iff::stringContains(line, "SYNC") && (!str::iff::stringContains(line, "DESYNC"))){
140  XCAP_writeSYNQ(fout, loadedBitstreamEndianness);
141  }
142  else if(str::iff::stringContains(line, ".WORD")){
143  uint32_t wordValue;
144  if(!str::parse::multipleUints(line, wordValue))wordValue = 0;
145  FileIO::write32(fout, wordValue, loadedBitstreamEndianness);
146  }
147  else if(str::iff::stringContains(line, ".BYTE")){
148  uint32_t value;
149  if(!str::parse::multipleUints(line, value))value = 0;
150  uint32_t byteValue = value % 256;
151  FileIO::write8(fout, byteValue, loadedBitstreamEndianness);
152  }
153  else if(str::iff::stringContains(line, "NOP")){
154  int nopHiddenValue;
155  if(!str::parse::multipleInts(line, nopHiddenValue))nopHiddenValue = 0;
156  XCAP_writeNOP(fout, 1, nopHiddenValue, loadedBitstreamEndianness);
157  }
158  else if(str::iff::stringContains(line, "RESERVED")){
159  int reservedHiddenValue;
160  if(!str::parse::multipleInts(line, reservedHiddenValue))reservedHiddenValue = 0;
161  XCAP_writeRESERVED(fout, 1, reservedHiddenValue, loadedBitstreamEndianness);
162  }
163  else if(str::iff::stringContains(line, "SELECT NEXT SLR")){
164  slr++;
165  int magic1size;
166  if(!str::parse::multipleInts(line, magic1size))magic1size = 0;
167  XCAP_writeSelectRegister(fout, XCAP::Register::MAGIC1, loadedBitstreamEndianness);
168  XCAP_writeType2(fout, magic1size, loadedBitstreamEndianness);
169  }
170  else if(str::iff::stringContains(line, "@")){
171  XCAP::Register newRegAddr = getXCAPregister(line);
172  if(str::iff::stringContains(line, "READ REG @")){
173  int readLength;
174  if(!str::parse::multipleInts(line, readLength)) readLength = 1; // default read length is 1 if unspecified
175  XCAP_writeReadRegister(fout, newRegAddr, readLength, loadedBitstreamEndianness);
176  } else {// must be a write then ¯\_(ツ)_/¯
177 
178  if(newRegAddr == XCAP::Register::UNDEFINED){
179  throw runtime_error(string("Couldn't parse assembly command: \"").append(line).append("\"!"));
180  } else if(str::iff::stringContains(line, "SELECT REGISTER")){
181  XCAP_writeSelectRegister(fout, newRegAddr, loadedBitstreamEndianness);
182  } else if(newRegAddr == XCAP::Register::FDRI){
183  if(!str::parse::multipleInts(line, frameCount))
184  throw runtime_error(string("FDRI command needs size: \"").append(line).append("\"!"));
185  int wordCount = frameCount * XUS_WORDS_PER_FRAME;
186  if(regAddr == XCAP::Register::FDRI) {
187  XCAP_writeType2(fout, wordCount, loadedBitstreamEndianness);
188  } else {
189  XCAP_writeFDRI1(fout, wordCount, loadedBitstreamEndianness);
190  }
191  if(frameCount > 0){
192  string frameLine;
193  for (string frameLine; getline(fin, frameLine); ) {
194  if(frameLine.at(frameLine.find_first_not_of(" \t")) == '#')// if #, skip that line as comment
195  continue;
196  uint32_t frameData[XUS_WORDS_PER_FRAME];
197  if(!str::parse::arrayOfUints(frameLine, XUS_WORDS_PER_FRAME, &frameData[0]))
198  throw runtime_error(string("Was expecting the data for a full frame on this line: \"").append(frameLine).append("\", because I think there are ").append(to_string(frameCount)).append(" frames left."));
199  //first 3 words are clk, next 90 are the 0-45 and 48-93 data words
200  for (int w = XUS_WORDS_AT_CLK; w < (XUS_WORDS_AT_CLK + XUS_WORDS_BEFORE_CLK) ; w++){
201  FileIO::write32(fout, frameData[w], loadedBitstreamEndianness);
202  }
203  for (int w = 0; w < XUS_WORDS_AT_CLK ; w++){
204  FileIO::write32(fout, frameData[w], loadedBitstreamEndianness);
205  }
206  for (int w = (XUS_WORDS_AT_CLK + XUS_WORDS_BEFORE_CLK); w < XUS_WORDS_PER_FRAME ; w++){
207  FileIO::write32(fout, frameData[w], loadedBitstreamEndianness);
208  }
209 
210  frameCount--;
211  if(frameCount == 0)
212  break;
213  }
214  if(frameCount != 0)
215  throw runtime_error(string("End of file reached while performing FDRI frame writes.!"));
216  }
217  } else if(newRegAddr == XCAP::Register::FAR){
218  if(!str::parse::multipleInts(line, b, r, c, m))
219  throw runtime_error(string("Could not parse the new FAR value: \"").append(line).append("\"!"));
220  r += SLRinfo[slr].fromRow;
221  uint32_t farValue = XCAP_getFAR(slr, b, r, c, m);
222  XCAP_writeRegister(fout, XCAP::Register::FAR, farValue, loadedBitstreamEndianness);
223  } else {
224  uint32_t newValue;
225  if(!str::parse::multipleUints(line, newValue))
226  throw runtime_error(string("Could not parse the new register value: \"").append(line).append("\"!"));
227  XCAP_writeRegister(fout, newRegAddr, newValue, loadedBitstreamEndianness);
228  }
229  }
230  regAddr = newRegAddr;
231  } else {// ! str::iff::stringContains(line, "@")
232  //must have been a command then
233  XCAP::Command cmdID = getXCAPcommand(line);
234  if(cmdID == XCAP::Command::UNDEFINED)
235  throw runtime_error(string("Couldn't parse assembly command: \"").append(line).append("\"!"));
236  XCAP_writeCommand(fout, cmdID, loadedBitstreamEndianness);
237  }
238  }
239  outputBITheaderLengthField(fout, loadedBitstreamEndianness);
240 }
241 
243 {
244  fout << "--- HEADER BEGIN ---" << endl;
245  fout << "Name = \"" << designName << "\"" << endl;
246  fout << "FPGA = \"" << partName << "\"" << endl;
247  fout << "Date = \"" << fileDate << "\"" << endl;
248  fout << "Time = \"" << fileTime << "\"" << endl;
249  fout << "--- HEADER END ---" << endl;
250 }
251 
252 void XilinxUltraScale::disassemblerToAsm(ifstream& fin, ofstream& fout) {
253  initializeResourceStringParameters();
254  disassemblerWriteHeader(fout);
255 
257  bool synched = false;
258  bool aligned = false;
259  int wordCount = 0;
260  int shadowFrameValid = 0;
261  int slr = 0, b = 7, r = 0, c = 0, m = 0;
262  //Parse bitstream
263  for( ; ; ){
264  if(!fin.good()){
265  break; // done with the bitstream
266  } else {
267  if(!synched){
268  streamoff startFileOffset = fin.tellg();
269  streamoff endFileOffset;
270  if(!aligned){
271  if(findBitstreamSyncSequence(fin, loadedBitstreamEndianness)){
272  endFileOffset = fin.tellg() - (streamoff)4;
273  synched = true;
274  aligned = true;
275  } else {//end of bitstream
276  endFileOffset = fin.tellg();
277  }
278  } else { //already aligned
279  if(findBitstreamSyncWord(fin, loadedBitstreamEndianness)){
280  endFileOffset = fin.tellg() - (streamoff)4;
281  synched = true;
282  } else {//end of bitstream
283  endFileOffset = fin.tellg();
284  }
285  }
286  fin.seekg(startFileOffset, fin.beg);
287  assemblyOutputData(fin, fout, (endFileOffset - startFileOffset));
288  if(synched){
289  FileIO::read32(fin);//discard sync command
290  fout << "SYNC" << endl;
291  } else {
292  break; //if still not synched, then we reached end of file
293  }
294  } else {
295  uint32_t instruction = FileIO::read32(fin, loadedBitstreamEndianness);
296  int instructionType = XCAP_getInstructionType(instruction);
297  XCAP::Operation instructionOPCODE = XCAP_getInstructionOperation(instruction);
298  int instructionPayload = XCAP_getInstructionPayload(instruction);
299  if(instructionType == 1) {
300  wordCount = XCAP_getInstructionWordCount(instruction);
301  regAddr = XCAP_getInstructionRegister(instruction);
302  } else if(instructionType == 2) {
303  wordCount = instructionPayload;
304  } else {
305  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << instruction << " (Invalid instruction [invalid type])" << endl;
306  continue;
307  }
308 
309  if(instructionOPCODE == XCAP::Operation::NOP) {
310  if(instructionPayload != 0)
311  fout << "NOP #" << instructionPayload << endl;
312  else
313  fout << "NOP" << endl;
314  } else if(instructionOPCODE == XCAP::Operation::RESERVED) {
315  if(instructionPayload != 0)
316  fout << "RESERVED #" << instructionPayload << endl;
317  else
318  fout << "RESERVED" << endl;
319  } else if(instructionOPCODE == XCAP::Operation::READ) {
320  fout << "Read Reg @";
321  writeXCAPregisterName(fout, regAddr);
322  fout << " for length #" << wordCount << endl;
323  } else { // XCAP::Operation::WRITE
324  if((regAddr == XCAP::Register::FDRI) && (wordCount > 0) && (wordCount % XUS_WORDS_PER_FRAME == 0)) {
325  if(shadowFrameValid) {
326  fout << dec << "# Shadow register contents are written to frame (BlockType=" << b << ", GlobalRowAddress=" << r << ", MajorAddress=" << c << ", MinorAddress=" << m << ") (Frame type: " << getFrameType(b, r, c) << ")." << endl;
327  XCAP_IncrementFAR(slr, b, r, c, m);
328  }
329  shadowFrameValid = 1;
330  int frameCount = (wordCount/XUS_WORDS_PER_FRAME);
331  fout << dec << "@FDRI for #" << frameCount << " frames:" << endl;
332  for(int i = 0 ; i < frameCount ; i++){
333  fout << "# ";
334  if(i == (frameCount-1)) fout << "(This frame data is written to shadow register!)";
335  fout << dec << "Writing frame #" << i << " (BlockType=" << b << ", GlobalRowAddress=" << r << ", MajorAddress=" << c << ", MinorAddress=" << m << ") (Frame type: " << getFrameType(b, r, c) << ") hex data:" << endl;
336  uint32_t frameData[XUS_WORDS_PER_FRAME];
337  for(int w = 0 ; w < XUS_WORDS_PER_FRAME ; w++){
338  frameData[w] = FileIO::read32(fin, loadedBitstreamEndianness);
339  }
340  fout << "CLOCK: ";
341  for(int w = XUS_WORDS_BEFORE_CLK ; w < (XUS_WORDS_BEFORE_CLK + XUS_WORDS_AT_CLK) ; w++){
342  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << frameData[w] << " ";
343  }
344  fout << " ;DATA: ";
345  for(int w = 0 ; w < XUS_WORDS_BEFORE_CLK ; w++){
346  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << frameData[w] << " ";
347  }
348  for(int w = (XUS_WORDS_BEFORE_CLK + XUS_WORDS_AT_CLK) ; w < XUS_WORDS_PER_FRAME ; w++){
349  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << frameData[w] << " ";
350  }
351  fout << endl;
352  XCAP_IncrementFAR(slr, b, r, c, m);
353  }
354  } else if(regAddr == XCAP::Register::CMD && wordCount == 1){
355  uint32_t writeData = FileIO::read32(fin, loadedBitstreamEndianness);
356  writeXCAPcommandName(fout, static_cast<XCAP::Command>(writeData));
357  fout << ";";
358  if(XCAP::Command::DESYNC == static_cast<XCAP::Command>(writeData)){
359  shadowFrameValid = 0;
360  synched = false;
361  }
362  if(XCAP::Command::WCFG == static_cast<XCAP::Command>(writeData)){
363  shadowFrameValid = 0;
364  fout << " (also clears shadow register)";
365  }
366  fout << endl;
367  } else if(regAddr == XCAP::Register::MAGIC1){
368  uint32_t nextInstr = FileIO::read32(fin, loadedBitstreamEndianness);
369  int nextInstrType = XCAP_getInstructionType(nextInstr);
370  XCAP::Operation nextInstrOP = XCAP_getInstructionOperation(nextInstr);
371  int nextInstrPayload = XCAP_getInstructionPayload(nextInstr);
372  if(2 == nextInstrType && XCAP::Operation::WRITE == nextInstrOP && 0 < nextInstrPayload){
373  slr++;
374  synched = false;
375  aligned = false;
376  fout << "Select next SLR for the next #" << dec << nextInstrPayload << " words." << endl;
377  } else {
378  fout << "Bad MAGIC1 instruction" << endl;
379  fin.seekg(-4, ios::cur);//rewind next instruction if not
380  }
381  } else if((instructionType == 1) && (wordCount == 0)){
382  fout << "Select register @";
383  writeXCAPregisterName(fout, regAddr);
384  fout << endl;
385  } else if(wordCount == 1){
386  uint32_t writeData = FileIO::read32(fin, loadedBitstreamEndianness);
387  fout << "@";
388  writeXCAPregisterName(fout, regAddr);
389  if(regAddr == XCAP::Register::FAR) {
390  XCAP_parseFAR(writeData, slr, b, r, c, m);
391  fout << " = BlockType=" << dec << b << " RowAddress=" << (r-SLRinfo[slr].fromRow) << " MajorAddress=" << c << " MinorAddress=" << m << endl;
392  } else {
393  fout << " = 0x" << uppercase << hex << setw(8) << setfill('0') << writeData << endl;
394  }
395  } else {
396  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << instruction << "(Bad instruction)" << endl;
397  }
398  } // OP_WRITE
399  }// if synched
400  } // if fin is still good
401  } // for(;;)
402 }
#define XUS_WORDS_BEFORE_CLK
Definition: XUS_Fabric.h:37
#define XUS_WORDS_PER_FRAME
Definition: XUS_Fabric.h:40
#define XUS_WORDS_AT_CLK
Definition: XUS_Fabric.h:38
void assemblerParseHeader(std::ifstream &)
void assemblerAsmToBit(std::ifstream &, std::ofstream &)
void disassemblerToAsm(std::ifstream &, std::ofstream &)
void disassemblerBitToAsm(std::ifstream &, std::ofstream &)
void disassemblerBinToAsm(std::string, std::ifstream &, std::ofstream &)
void assembler(std::string, std::string)
void assemblerAsmToBin(std::ifstream &, std::ofstream &)
void disassemblerWriteHeader(std::ofstream &)
void assemblerAsmTo(std::ifstream &, std::ofstream &)
void assemblyOutputData(std::ifstream &fin, std::ofstream &fout, std::streamoff sizeInBytes)
XCAP::Register XCAP_getInstructionRegister(uint32_t instruction)
Parses and returns instruction register. This is the register being addressed if the instruction is o...
Definition: inlineCAP.h:271
XCAP::Operation XCAP_getInstructionOperation(uint32_t instruction)
Parses and returns instruction operation. Most Xil instructions will NOP or write.
Definition: inlineCAP.h:259
uint32_t XCAP_getInstructionPayload(uint32_t instruction)
Parses and returns instruction payload. This is the immediate value after instruction type and operat...
Definition: inlineCAP.h:265
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.
Definition: inlineCAP.h:382
uint32_t XCAP_getInstructionWordCount(uint32_t instruction)
Parses and returns instruction word count. This is the number of words to be read/written if the inst...
Definition: inlineCAP.h:277
void XCAP_writeFDRI1(std::ofstream &fout, int wordCount, Endianness e)
Generate and write only a type 1 FDRI command.
Definition: inlineCAP.h:403
XCAP::Command getXCAPcommand(std::string s)
Definition: inlineCAP.h:67
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.
Definition: inlineCAP.h:390
void XCAP_writeSYNQ(std::ofstream &fout, Endianness e)
Generate and write an SYNQ command.
Definition: inlineCAP.h:436
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.
Definition: inlineCAP.h:368
void XCAP_writeRESERVED(std::ofstream &fout, int cnt, int payload, Endianness e)
Generate the encoding for Reserved instructions and write them to file ofstream.
Definition: inlineCAP.h:360
void XCAP_writeType2(std::ofstream &fout, int wordCount, Endianness e)
Generate and write only a type 2 FDRI command.
Definition: inlineCAP.h:410
uint32_t XCAP_getInstructionType(uint32_t instruction)
Parses and returns instruction type. Valid Xil instructions will be of types 1 and 2.
Definition: inlineCAP.h:253
void writeXCAPcommandName(std::ofstream &fout, XCAP::Command commandID)
Definition: inlineCAP.h:111
void writeXCAPregisterName(std::ofstream &fout, XCAP::Register registerID)
Definition: inlineCAP.h:177
void XCAP_writeNOP(std::ofstream &fout, int cnt, int payload, Endianness e)
Generate the encoding for NOP instructions and write them to file ofstream.
Definition: inlineCAP.h:352
void XCAP_writeReadRegister(std::ofstream &fout, XCAP::Register reg, int readLength, Endianness e)
Generate the encoding for reading a CAP register and write it to file ofstream.
Definition: inlineCAP.h:375
XCAP::Register getXCAPregister(std::string s)
Definition: inlineCAP.h:19
uint32_t XCAP_getFAR(int slr, int blockType, int globalRowAddress, int columnAddress, int minorAddress)
Definition: inlineFAR.h:174
void XCAP_parseFAR(int farValue, int slr, int &blockType, int &globalRowAddress, int &columnAddress, int &minorAddress)
Definition: inlineFAR.h:153
void XCAP_IncrementFAR(int slrID, int &blockType, int &globalRowAddress, int &columnAddress, int &minorAddress)
Definition: inlineFAR.h:144
Endianness parseBitstreamEndianness(std::ifstream &fin)
Definition: inlineInput.h:83
void parseBITheader(std::ifstream &fin, Endianness e)
Definition: inlineInput.h:24
bool findBitstreamSyncSequence(std::ifstream &fin, Endianness e)
Definition: inlineInput.h:154
bool findBitstreamSyncWord(std::ifstream &fin, Endianness e)
Definition: inlineInput.h:131
uint32_t parseBitstreamIDCODE(std::ifstream &fin, Endianness e)
Definition: inlineInput.h:181
void outputBITheader(std::ofstream &fout, Endianness e)
Definition: inlineOutput.h:34
void updateDateAndTime()
Definition: inlineOutput.h:17
void outputCAPheaderConstant(std::ofstream &fout, Endianness e)
Definition: inlineOutput.h:60
void outputBITheaderLengthField(std::ofstream &fout, Endianness e)
Definition: inlineOutput.h:52
std::string to_string(Endianness e)
Definition: Endianness.h:56
void write8(std::ofstream &fout, uint8_t writeValue, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:445
uint32_t read32(std::ifstream &fin, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:131
void write32(std::ofstream &fout, uint32_t writeValue, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:419
Operation
Definition: XCAP.h:69
Register
Definition: XCAP.h:20
Command
Definition: XCAP.h:46
bool stringEndsWith(std::string checkedString)
Returns false. End of recursion for template.
Definition: iff.h:32
bool stringContains(std::string checkedString)
Returns false. End of recursion for template.
Definition: iff.h:57
std::string lastStringWord(std::string s)
Parses a string s, removes all integers and returns the last of all string words.
Definition: parse.h:81
bool arrayOfUints(std::string s, int arrsize, uint32_t *arr)
Removes all string words from a given string s and returns the parsed arrsize number of integers into...
Definition: parse.h:160
bool multipleUints(std::stringstream &ss)
Definition: parse.h:229
bool multipleInts(std::stringstream &ss)
Definition: parse.h:192
std::string replace(std::string str, char oldChar, char newChar)
Replaces all instances of oldChar in string str with newChar and returns the resulting string.
Definition: str.h:41