byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
Functions
inlineChange.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ensureSelectedEndianness (Endianness newEndianness)
 
void setBitstreamWord (std::string params)
 

Function Documentation

◆ ensureSelectedEndianness()

void ensureSelectedEndianness ( Endianness  newEndianness)
inline

Definition at line 17 of file inlineChange.h.

17  {
18  ensureInitializedBitstreamArrays();//initialize bitstream arrays before modifications
19  Endianness endiannessConvertion = Endian::diff(loadedBitstreamEndianness, newEndianness);
20  if(endiannessConvertion == Endianness::NATIVE)// if there is no actual convertion needed
21  return;
22  int bitstreamSize = bitstreamEnd - bitstreamBegin;
23 
24  if(endiannessConvertion == Endianness::BE)
25  for( int i = 0 ; i < bitstreamSize ; i++)
26  bitstreamBegin[i] = Endian::NativeToBigEndian32(bitstreamBegin[i]);
27 
28  if(endiannessConvertion == Endianness::LE)
29  for( int i = 0 ; i < bitstreamSize ; i++)
30  bitstreamBegin[i] = Endian::NativeToLittleEndian32(bitstreamBegin[i]);
31 
32  if(endiannessConvertion == Endianness::BE_BS)
33  for( int i = 0 ; i < bitstreamSize ; i++)
34  bitstreamBegin[i] = Endian::BitSwap32(Endian::NativeToBigEndian32(bitstreamBegin[i]));
35 
36  if(endiannessConvertion == Endianness::LE_BS)
37  for( int i = 0 ; i < bitstreamSize ; i++)
38  bitstreamBegin[i] = Endian::BitSwap32(Endian::NativeToLittleEndian32(bitstreamBegin[i]));
39 
40  loadedBitstreamEndianness = newEndianness;
41 }
Endianness
< Endianness in byteman is represented not only by big/little endian, but also by potential bit swapp...
Definition: Endianness.h:47
@ BE_BS
Big endian with bit swaps inside each byte.
@ LE_BS
Little endian with bit swaps inside each byte.
@ LE
Little endian ("LE" instead of full-er name, so it does not conflict with linux's reserved endianess ...
@ BE
Big endian ("BE" instead of full-er name, so it does not conflict with linux's reserved endianess wor...
@ NATIVE
System native will always be the fastest endianess to process.
uint32_t NativeToLittleEndian32(uint32_t x)
Definition: Endianness.h:169
uint32_t NativeToBigEndian32(uint32_t x)
Definition: Endianness.h:152
uint32_t BitSwap32(uint32_t x)
Definition: Endianness.h:220
Endianness diff(Endianness e1, Endianness e2)
Definition: Endianness.h:117

References BE, BE_BS, Endian::BitSwap32(), Endian::diff(), LE, LE_BS, NATIVE, Endian::NativeToBigEndian32(), and Endian::NativeToLittleEndian32().

Referenced by XilinxSeries7::change(), XilinxUltraScale::change(), XilinxUltraScalePlus::change(), readBitstreamMain(), and readBitstreamRBDMain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBitstreamWord()

void setBitstreamWord ( std::string  params)
inline

Definition at line 43 of file inlineChange.h.

43  {
44  ensureInitializedBitstreamArrays();//initialize bitstream arrays before modifications
45  uint32_t r, y, c, b, m, w, mask, newVal;
46  str::parse::multipleUints(params, y, c, b, m, w, mask, newVal);
47  mask = Endian::NativeToAnyEndianness32(mask, loadedBitstreamEndianness);
48  newVal = Endian::NativeToAnyEndianness32(newVal, loadedBitstreamEndianness);
49  r = y / CLB_PER_CLOCK_REGION;
50  if(b == BLOCKTYPE_LOGIC){
51  bitstreamCLB[r][c][m*WORDS_PER_FRAME + w] = (mask & newVal) | ((mask^0xFFFFFFFF) & bitstreamCLB[r][c][m*WORDS_PER_FRAME + w]);
52  } else if(b == BLOCKTYPE_BLOCKRAM){
53  bitstreamBRAM[r][numberOfBRAMsBeforeCol[r][c]][m*WORDS_PER_FRAME + w] = (mask & newVal) | ((mask^0xFFFFFFFF) & bitstreamBRAM[r][numberOfBRAMsBeforeCol[r][c]][m*WORDS_PER_FRAME + w]);
54  }
55  bitstreamHasValidData = true;
56 }
uint32_t NativeToAnyEndianness32(uint32_t x, Endianness e)
Definition: Endianness.h:246
bool multipleUints(std::stringstream &ss)
Definition: parse.h:229

References str::parse::multipleUints(), and Endian::NativeToAnyEndianness32().

Referenced by XilinxSeries7::change(), XilinxUltraScale::change(), and XilinxUltraScalePlus::change().

Here is the call graph for this function:
Here is the caller graph for this function: