27 #include "../../../Common/str.h"
41 if(initializedResourceStringShortPartName ==
"")
42 throw runtime_error(
"The target device needs to be known, before you can manipulate any bitstream!");
43 if(initializedBitstreamParamsShortPartName != initializedResourceStringShortPartName){
44 initializedBitstreamParamsShortPartName = initializedResourceStringShortPartName;
45 for(
int r = 0 ; r < numberOfRows ; r++){
46 for((numberOfCols[r] = 0, numberOfFramesBeforeCol[r][0] = 0, numberOfBRAMCols[r] = 0) ; (uint8_t)resourceString[r][numberOfCols[r]] ; numberOfCols[r]++){
47 numberOfFramesBeforeCol[r][numberOfCols[r] + 1] = numberOfFramesBeforeCol[r][numberOfCols[r]] + LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[r][numberOfCols[r]]];
48 numberOfBRAMsBeforeCol[r][numberOfCols[r]] = numberOfBRAMCols[r];
49 if(
str::iff::charIs(resourceString[r][numberOfCols[r]],
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'4'))
50 numberOfBRAMCols[r]++;
52 numberOfFramesPerRow[r] = numberOfFramesBeforeCol[r][numberOfCols[r]];
54 for(
int c = numberOfCols[r] + 1 ; c <
XS7_MAX_COLS ; c++){
55 numberOfFramesBeforeCol[r][c] = numberOfFramesBeforeCol[r][c - 1];
58 numberOfBRAMsBeforeCol[r][c] = numberOfBRAMsBeforeCol[r][c - 1];
63 maxNumberOfCols = numberOfCols[0];
64 maxNumberOfBRAMCols = numberOfBRAMCols[0];
65 for(
int r = 1 ; r < numberOfRows ; r++){
66 if(maxNumberOfCols < numberOfCols[r])
67 maxNumberOfCols = numberOfCols[r];
68 if(maxNumberOfBRAMCols < numberOfBRAMCols[r])
69 maxNumberOfBRAMCols = numberOfBRAMCols[r];
75 if(initializedResourceStringShortPartName ==
"")
76 throw runtime_error(
"The target device needs to be known, before you can manipulate any bitstream!");
77 if(initializedBitstreamShortPartName != initializedResourceStringShortPartName){
78 initializedBitstreamShortPartName = initializedResourceStringShortPartName;
79 if(bitstreamBegin !=
nullptr)
80 delete bitstreamBegin;
82 initializeResourceStringParameters();
84 int bramPlaneSize = 0;
86 for(
int r = 0 ; r < numberOfRows ; r++){
88 clbPlaneSize += numberOfWordsPerRow[r];
90 bitstreamBegin =
new uint32_t[clbPlaneSize + bramPlaneSize];
95 for(
int slr = 0 ; slr < numberOfSLRs ; slr++){
96 int fromGlobalRowTop = SLRinfo[slr].fromRow + SLRinfo[slr].rowsInBottomHalf;
97 int toGlobalRowTop = SLRinfo[slr].toRow;
98 int fromGlobalRowBottom = SLRinfo[slr].fromRow + SLRinfo[slr].rowsInBottomHalf - 1;
99 int toGlobalRowBottom = SLRinfo[slr].fromRow;
100 for(
int r = fromGlobalRowTop ; r <= toGlobalRowTop ; r++){
101 for(
int c = 0 ; c < numberOfCols[r] ; c++){
102 bitstreamCLB[r][c] = &bitstreamBegin[offset];
103 offset += LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[r][c]] *
XS7_WORDS_PER_FRAME;
106 for(
int r = fromGlobalRowBottom ; r >= toGlobalRowBottom ; r--){
107 for(
int c = 0 ; c < numberOfCols[r] ; c++){
108 bitstreamCLB[r][c] = &bitstreamBegin[offset];
109 offset += LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[r][c]] *
XS7_WORDS_PER_FRAME;
112 for(
int r = fromGlobalRowTop ; r <= toGlobalRowTop ; r++){
113 for(
int c = 0 ; c < numberOfBRAMCols[r] ; c++){
114 bitstreamBRAM[r][c] = &bitstreamBegin[offset];
117 bitstreamBRAM[r][numberOfBRAMCols[r]] = &bitstreamBegin[offset];
120 for(
int r = fromGlobalRowBottom ; r >= toGlobalRowBottom ; r--){
121 for(
int c = 0 ; c < numberOfBRAMCols[r] ; c++){
122 bitstreamBRAM[r][c] = &bitstreamBegin[offset];
125 bitstreamBRAM[r][numberOfBRAMCols[r]] = &bitstreamBegin[offset];
130 bitstreamEnd = &bitstreamBegin[offset];
131 bitstreamHasValidData =
false;
132 log(
"Reserved " +
to_string(clbPlaneSize + bramPlaneSize) +
" words for the bitstream buffers of device \"" + partName +
"\"");
138 return "BlockRAM Contents";
140 return LUT_typeOfFrameForResourceLetter[(uint8_t)resourceString[rowAddress][columnAddress]];
#define XS7_EXTRA_FRAMES_PER_ROW
#define XS7_WORDS_PER_FRAME
#define XS7_FRAMES_PER_BRAM_CONTENT_COLUMN
#define XS7_BLOCKTYPE_BLOCKRAM
#define XS7_BLOCKTYPE_LOGIC
std::string getFrameType(int, int, int) override
void ensureInitializedBitstreamArrays() override
void initializeResourceStringParameters() override
std::string to_string(Endianness e)
bool charIs(char checkedChar)
Returns false. End of recursion for template.