cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
alh1027
Participant
Participant
511 Views
Registered: ‎05-31-2019

HLS DATA_PACK alignment issues with AXI Master interface

I understand that the HLS tool wants the total struct bit width to be a power of 2. That makes sense.  (Although making the requirement that the struct is 8bit aligned and generating a byte packer/unpacker would be more powerful, it is probably low in utility). 

What makes less sense is that EVERY FIELD in a struct must ALSO be 8-bit aligned.  This makes DATA_PACK a bit less useful on the m_axi interface and seems like a shortcoming of the tool considering fixed bit selects are trivial in RTL.   

Added to this curiosity, the ap_fixed data types are aligned to a power of 2 address.  So that 18 bit number you want to load takes up 32 in a C++ packed struct instead of 24 in your HLS packed struct.

 

That being the case, can anyone recommend a method for manually packing a struct or manipulating another data type. With bit manipulation on uint or with bitset?

 

Tags (2)
0 Kudos
2 Replies
u4223374
Advisor
Advisor
464 Views
Registered: ‎04-26-2015

I just define a suitably wide integer on the interface and then use either an appropriate union or just the bit-select functions (eg. range()) to pull out the relevant sections. It should all synthesize to exactly the same thing anyway, so it's really just a matter of what is easiest to use.

wenchen
Moderator
Moderator
428 Views
Registered: ‎05-27-2018

Hi @alh1027 ,

I hope that extracting the data from the packed struct using the data range class could be an option for you to operate with bitset.

rgb.PNG

Wen

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 Kudos