byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
XUSP_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 "XilinxUltraScalePlus.h"
26 #include "../../../Common/FileIO.h"
27 #include "../../../Common/str.h"
28 #include "../../../Common/Endianness.h"
29 
30 using namespace std;
31 
32 void XilinxUltraScalePlus::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 XilinxUltraScalePlus::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 XilinxUltraScalePlus::disassemblerBitToAsm(ifstream& fin, ofstream& fout) {
83  loadedBitstreamEndianness = parseBitstreamEndianness(fin);
84  parseBITheader(fin, loadedBitstreamEndianness);
85  setDeviceByPartNameOrThrow();
86 
87  disassemblerToAsm(fin, fout);
88 }
89 void XilinxUltraScalePlus::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 XilinxUltraScalePlus::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 XilinxUltraScalePlus::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 * XUSP_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[XUSP_WORDS_PER_FRAME];
197  if(!str::parse::arrayOfUints(frameLine, XUSP_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 = XUSP_WORDS_AT_CLK; w < (XUSP_WORDS_AT_CLK + XUSP_WORDS_BEFORE_CLK) ; w++){
201  FileIO::write32(fout, frameData[w], loadedBitstreamEndianness);
202  }
203  for (int w = 0; w < XUSP_WORDS_AT_CLK ; w++){
204  FileIO::write32(fout, frameData[w], loadedBitstreamEndianness);
205  }
206  for (int w = (XUSP_WORDS_AT_CLK + XUSP_WORDS_BEFORE_CLK); w < XUSP_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 XilinxUltraScalePlus::disassemblerToAsm(ifstream& fin, ofstream& fout)
253 {
254  initializeResourceStringParameters();
255  disassemblerWriteHeader(fout);
256 
258  bool synched = false;
259  bool aligned = false;
260  int wordCount = 0;
261  int shadowFrameValid = 0;
262  int slr = 0, b = 7, r = 0, c = 0, m = 0;
263  //Parse bitstream
264  for( ; ; ){
265  if(!fin.good()){
266  break; // done with the bitstream
267  } else {
268  if(!synched){
269  streamoff startFileOffset = fin.tellg();
270  streamoff endFileOffset;
271  if(!aligned){
272  if(findBitstreamSyncSequence(fin, loadedBitstreamEndianness)){
273  endFileOffset = fin.tellg() - (streamoff)4;
274  synched = true;
275  aligned = true;
276  } else {//end of bitstream
277  endFileOffset = fin.tellg();
278  }
279  } else { //already aligned
280  if(findBitstreamSyncWord(fin, loadedBitstreamEndianness)){
281  endFileOffset = fin.tellg() - (streamoff)4;
282  synched = true;
283  } else {//end of bitstream
284  endFileOffset = fin.tellg();
285  }
286  }
287  fin.seekg(startFileOffset, fin.beg);
288  assemblyOutputData(fin, fout, (endFileOffset - startFileOffset));
289  if(synched){
290  FileIO::read32(fin);//discard sync command
291  fout << "SYNC" << endl;
292  } else {
293  break; //if still not synched, then we reached end of file
294  }
295  } else {
296  uint32_t instruction = FileIO::read32(fin, loadedBitstreamEndianness);
297  int instructionType = XCAP_getInstructionType(instruction);
298  XCAP::Operation instructionOPCODE = XCAP_getInstructionOperation(instruction);
299  int instructionPayload = XCAP_getInstructionPayload(instruction);
300  if(instructionType == 1) {
301  wordCount = XCAP_getInstructionWordCount(instruction);
302  regAddr = XCAP_getInstructionRegister(instruction);
303  } else if(instructionType == 2) {
304  wordCount = instructionPayload;
305  } else {
306  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << instruction << " (Invalid instruction [invalid type])" << endl;
307  continue;
308  }
309 
310  if(instructionOPCODE == XCAP::Operation::NOP) {
311  if(instructionPayload != 0)
312  fout << "NOP #" << instructionPayload << endl;
313  else
314  fout << "NOP" << endl;
315  } else if(instructionOPCODE == XCAP::Operation::RESERVED) {
316  if(instructionPayload != 0)
317  fout << "RESERVED #" << instructionPayload << endl;
318  else
319  fout << "RESERVED" << endl;
320  } else if(instructionOPCODE == XCAP::Operation::READ) {
321  fout << "Read Reg @";
322  writeXCAPregisterName(fout, regAddr);
323  fout << " for length #" << wordCount << endl;
324  } else { // XCAP::Operation::WRITE
325  if((regAddr == XCAP::Register::FDRI) && (wordCount > 0) && (wordCount % XUSP_WORDS_PER_FRAME == 0)) {
326  if(shadowFrameValid) {
327  fout << dec << "# Shadow register contents are written to frame (BlockType=" << b << ", GlobalRowAddress=" << r << ", MajorAddress=" << c << ", MinorAddress=" << m << ") (Frame type: " << getFrameType(b, r, c) << ")." << endl;
328  XCAP_IncrementFAR(slr, b, r, c, m);
329  }
330  shadowFrameValid = 1;
331  int frameCount = (wordCount/XUSP_WORDS_PER_FRAME);
332  fout << dec << "@FDRI for #" << frameCount << " frames:" << endl;
333  for(int i = 0 ; i < frameCount ; i++){
334  fout << "# ";
335  if(i == (frameCount-1)) fout << "(This frame data is written to shadow register!)";
336  fout << dec << "Writing frame #" << i << " (BlockType=" << b << ", GlobalRowAddress=" << r << ", MajorAddress=" << c << ", MinorAddress=" << m << ") (Frame type: " << getFrameType(b, r, c) << ") hex data:" << endl;
337  uint32_t frameData[XUSP_WORDS_PER_FRAME];
338  for(int w = 0 ; w < XUSP_WORDS_PER_FRAME ; w++){
339  frameData[w] = FileIO::read32(fin, loadedBitstreamEndianness);
340  }
341  fout << "CLOCK: ";
343  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << frameData[w] << " ";
344  }
345  fout << " ;DATA: ";
346  for(int w = 0 ; w < XUSP_WORDS_BEFORE_CLK ; w++){
347  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << frameData[w] << " ";
348  }
349  for(int w = (XUSP_WORDS_BEFORE_CLK + XUSP_WORDS_AT_CLK) ; w < XUSP_WORDS_PER_FRAME ; w++){
350  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << frameData[w] << " ";
351  }
352  fout << endl;
353  XCAP_IncrementFAR(slr, b, r, c, m);
354  }
355  } else if(regAddr == XCAP::Register::CMD && wordCount == 1){
356  uint32_t writeData = FileIO::read32(fin, loadedBitstreamEndianness);
357  writeXCAPcommandName(fout, static_cast<XCAP::Command>(writeData));
358  fout << ";";
359  if(XCAP::Command::DESYNC == static_cast<XCAP::Command>(writeData)){
360  shadowFrameValid = 0;
361  synched = false;
362  }
363  if(XCAP::Command::WCFG == static_cast<XCAP::Command>(writeData)){
364  shadowFrameValid = 0;
365  fout << " (also clears shadow register)";
366  }
367  fout << endl;
368  } else if(regAddr == XCAP::Register::MAGIC1){
369  uint32_t nextInstr = FileIO::read32(fin, loadedBitstreamEndianness);
370  int nextInstrType = XCAP_getInstructionType(nextInstr);
371  XCAP::Operation nextInstrOP = XCAP_getInstructionOperation(nextInstr);
372  int nextInstrPayload = XCAP_getInstructionPayload(nextInstr);
373  if(2 == nextInstrType && XCAP::Operation::WRITE == nextInstrOP && 0 < nextInstrPayload){
374  slr++;
375  synched = false;
376  aligned = false;
377  fout << "Select next SLR for the next #" << dec << nextInstrPayload << " words." << endl;
378  } else {
379  fout << "Bad MAGIC1 instruction" << endl;
380  fin.seekg(-4, ios::cur);//rewind next instruction if not
381  }
382  } else if((instructionType == 1) && (wordCount == 0)){
383  fout << "Select register @";
384  writeXCAPregisterName(fout, regAddr);
385  fout << endl;
386  } else if(wordCount == 1){
387  uint32_t writeData = FileIO::read32(fin, loadedBitstreamEndianness);
388  fout << "@";
389  writeXCAPregisterName(fout, regAddr);
390  if(regAddr == XCAP::Register::FAR) {
391  XCAP_parseFAR(writeData, slr, b, r, c, m);
392  fout << " = BlockType=" << dec << b << " RowAddress=" << (r-SLRinfo[slr].fromRow) << " MajorAddress=" << c << " MinorAddress=" << m << endl;
393  } else {
394  fout << " = 0x" << uppercase << hex << setw(8) << setfill('0') << writeData << endl;
395  }
396  } else {
397  fout << "0x" << uppercase << hex << setw(8) << setfill('0') << instruction << "(Bad instruction)" << endl;
398  }
399  } // OP_WRITE
400  }// if synched
401  } // if fin is still good
402  } // for(;;)
403 }
#define XUSP_WORDS_AT_CLK
Definition: XUSP_Fabric.h:37
#define XUSP_WORDS_PER_FRAME
Definition: XUSP_Fabric.h:39
#define XUSP_WORDS_BEFORE_CLK
Definition: XUSP_Fabric.h:36
void disassemblerBinToAsm(std::string, std::ifstream &, std::ofstream &)
void assemblerAsmToBit(std::ifstream &, std::ofstream &)
void assembler(std::string, std::string)
void assemblerParseHeader(std::ifstream &)
void assemblerAsmTo(std::ifstream &, std::ofstream &)
void disassemblerBitToAsm(std::ifstream &, std::ofstream &)
void disassemblerToAsm(std::ifstream &, std::ofstream &)
void disassemblerWriteHeader(std::ofstream &)
void assemblerAsmToBin(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