10-27-2020 10:19 PM
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?
10-30-2020 05:11 AM
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.
11-02-2020 02:00 AM
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.
**~ Got a minute? Answer our Vitis HLS survey here! ~**