You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had cause to refactor some test code and was no longr using a #define to access the register bank, which lead to some errors.
After some initial head scratching, it was obvious as to what was happening. Due to the refactored code, the compiler could no longer be certain of the alignment of the "big struct" which resulted in all register accesses be decomposed into byte accesses. The fix is simple, it is to add an aligned attribute in addition to the packed attribute.
SystemRDL/PeakRDL has rules regarding alignment, so I guess it is possible to add the appropriate alignment attribute.
I have been meaning to raise an issue, but wanted to take the time to put together a test case etc. but... I just got bitten by this issue again today after forgetting to add the attribute after regenerating a resgister block for the first time for a little while.
This showed up as a subtle bug where a wide (buffered write) register updated very strangely due to the buffered section hiding the non-atomic update of the lower 4 bytes but then the upper bytes updating one at a time.
If a better explanantion is required, or a test case let me know. But hopefully the proposed change in straightforward enough and non-controversial they aren't required.
The text was updated successfully, but these errors were encountered:
I had cause to refactor some test code and was no longr using a
#define
to access the register bank, which lead to some errors.After some initial head scratching, it was obvious as to what was happening. Due to the refactored code, the compiler could no longer be certain of the alignment of the "big struct" which resulted in all register accesses be decomposed into byte accesses. The fix is simple, it is to add an aligned attribute in addition to the packed attribute.
SystemRDL/PeakRDL has rules regarding alignment, so I guess it is possible to add the appropriate alignment attribute.
becomes (32bit alignment)
I have been meaning to raise an issue, but wanted to take the time to put together a test case etc. but... I just got bitten by this issue again today after forgetting to add the attribute after regenerating a resgister block for the first time for a little while.
This showed up as a subtle bug where a wide (buffered write) register updated very strangely due to the buffered section hiding the non-atomic update of the lower 4 bytes but then the upper bytes updating one at a time.
If a better explanantion is required, or a test case let me know. But hopefully the proposed change in straightforward enough and non-controversial they aren't required.
The text was updated successfully, but these errors were encountered: