18 int srcRA = (src.
row + offsetRow) / CLB_PER_CLOCK_REGION;
19 int dstRA = (dst.
row + offsetRow) / CLB_PER_CLOCK_REGION;
20 for(
int c = 0 ; c < sizeCol ; c++){
21 if(resourceString[srcRA][src.
col + c] != resourceString[dstRA][dst.
col + c]){
22 if(LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[srcRA][src.
col + c]] != LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[dstRA][dst.
col + c]]){
24 throw std::runtime_error(std::string(
"Please check your merge coordinates. Tried to merge incompatible resources (from \"").append(LUT_typeOfFrameForResourceLetter[(uint8_t)resourceString[srcRA][src.
col + c]]).append(
"\" to \"").append(LUT_typeOfFrameForResourceLetter[(uint8_t)resourceString[dstRA][dst.
col + c]]).append(
"\")."));
27 warn(
"Relocating from frame type " + std::string(LUT_typeOfFrameForResourceLetter[(uint8_t)resourceString[srcRA][src.
col + c]]) +
" to frame type " + std::string(LUT_typeOfFrameForResourceLetter[(uint8_t)resourceString[dstRA][dst.
col + c]]) +
".");
34 for(
int r = 0 ; r < src.
size.
row ; ){
36 if( ((src.
position.
row + r) % CLB_PER_CLOCK_REGION) == (CLB_PER_CLOCK_REGION-1) ) {
38 }
else if( ((src.
position.
row + r) % CLB_PER_CLOCK_REGION) == 0 ) {
39 r += (CLB_PER_CLOCK_REGION - 2);
41 r += (CLB_PER_CLOCK_REGION - 1 - ((src.
position.
row + r) % CLB_PER_CLOCK_REGION));
52 log(
"fastMerge function called");
53 int srcRA = src.
position.
row / CLB_PER_CLOCK_REGION;
54 int sizeR = src.
size.
row / CLB_PER_CLOCK_REGION;
55 int dstRA = dst.
row / CLB_PER_CLOCK_REGION;
57 for(
int r = 0 ; r < sizeR ; r++){
58 for(
int c = 0 ; c < src.
size.
col ; c++){
59 for(
int m = 0 ; m < LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[dstRA + r][dst.
col + c]] ; m++){
60 if(selectedOptions.clb && selectedOptions.clk){
61 memcpy(&bitstreamCLB[dstRA + r][dst.
col + c][m*WORDS_PER_FRAME] , &srcBitstream->
bitstreamCLB[srcRA + r][src.
position.
col + c][m*WORDS_PER_FRAME], WORDS_PER_FRAME*4);
63 if(selectedOptions.clb){
64 memcpy(&bitstreamCLB[dstRA + r][dst.
col + c][m*WORDS_PER_FRAME] , &srcBitstream->
bitstreamCLB[srcRA + r][src.
position.
col + c][m*WORDS_PER_FRAME], WORDS_BEFORE_CLK*4);
65 memcpy(&bitstreamCLB[dstRA + r][dst.
col + c][m*WORDS_PER_FRAME + WORDS_BEFORE_CLK + WORDS_AT_CLK] , &srcBitstream->
bitstreamCLB[srcRA + r][src.
position.
col + c][m*WORDS_PER_FRAME + WORDS_BEFORE_CLK + WORDS_AT_CLK], WORDS_AFTER_CLK*4);
67 if(selectedOptions.clk){
68 for(
int w = WORDS_BEFORE_CLK ; w < (WORDS_BEFORE_CLK + WORDS_AT_CLK) ; w++)
69 bitstreamCLB[dstRA + r][dst.
col + c][m*WORDS_PER_FRAME + w] = srcBitstream->
bitstreamCLB[srcRA + r][src.
position.
col + c][m*WORDS_PER_FRAME + w];
75 if(selectedOptions.bram){
76 for(
int r = 0 ; r < sizeR ; r++){
78 int srcCol = numberOfBRAMsBeforeCol[r][src.
position.
col];
79 int dstCol = numberOfBRAMsBeforeCol[r][dst.
col];
80 memcpy(&bitstreamBRAM[dstRA + r][dstCol][0] , &srcBitstream->
bitstreamBRAM[srcRA + r][srcCol][0], bramCols * FRAMES_PER_BRAM_CONTENT_COLUMN * WORDS_PER_FRAME * 4);
83 bitstreamHasValidData =
true;
87 log(
"flexiMerge function called");
88 ensureInitializedBitstreamArrays();
90 int srcRA = src.
position.
row / CLB_PER_CLOCK_REGION;
91 int sizeR = src.
size.
row / CLB_PER_CLOCK_REGION;
92 int dstRA = dst.
row / CLB_PER_CLOCK_REGION;
94 for(
int r = 0 ; r < sizeR ; r++){
95 for(
int c = 0 ; c < src.
size.
col ; c++){
96 for(
int m = 0 ; m < LUT_numberOfFramesForResourceLetter[(uint8_t)resourceString[dstRA + r][dst.
col + c]] ; m++){
97 for(
int w = 0 ; w < WORDS_PER_FRAME ; w++){
98 if(WORDS_BEFORE_CLK <= w && (WORDS_BEFORE_CLK + WORDS_AT_CLK) > w){
99 if(!selectedOptions.clk)
102 if(!selectedOptions.clb)
105 switch(selectedOptions.op){
123 if(selectedOptions.bram){
124 for(
int r = 0 ; r < sizeR ; r++){
126 int srcCol = numberOfBRAMsBeforeCol[r][src.
position.
col];
127 int dstCol = numberOfBRAMsBeforeCol[r][dst.
col];
128 for(
int c = 0 ; c < bramCols ; c++){
129 for(
int w = 0 ; w < WORDS_PER_FRAME * FRAMES_PER_BRAM_CONTENT_COLUMN ; w++){
130 switch(selectedOptions.op){
148 bitstreamHasValidData =
true;
Endianness
< Endianness in byteman is represented not only by big/little endian, but also by potential bit swapp...
virtual void ensureInitializedBitstreamArrays()=0
uint32_t * bitstreamCLB[MAX_ROWS][MAX_COLS]
uint32_t * bitstreamBRAM[MAX_ROWS][MAX_BRAM_COLS]
void ensureRegionCompatibility(Rect2D src, Coord2D dst)
void fastMerge(XilinxConfigurationAccessPort *srcBitstream, Rect2D src, Coord2D dst)
void flexiMerge(XilinxConfigurationAccessPort *srcBitstream, Endianness endianConversionNeeded, Rect2D src, Coord2D dst)
void ensureRowCompatibility(Coord2D src, int offsetRow, int sizeCol, Coord2D dst)
uint32_t NativeToAnyEndianness32(uint32_t x, Endianness e)