Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AHB memory non-full word transactions #9

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

HaMeNopeDiot
Copy link

The behavior of non-full word writes and reads in the AHBLiteSlaveRAM class differs from the AHB memory provided by cmsdk (e.g. https://github.com/ForrestBlue/cortexm0ds/blob/master/logical/models/memories/cmsdk_ahb_ram.v). The main difference lies in active byte lanes. For example, in the case of the data bus width of 32 bits, AHBLiteSlaveRAM, when being written a half-word to an address 'h6, expects data to appear in lower bytes of the data bus. While the implementation by cmsdk expects the data in upper bytes.

I believe that AHBLiteSlaveRAM uses little-endian (because it is the most common).

Furthermore, AMBA AHB Specification (ARM IHI revision 0033C - ID090921) specifies the byte lane output in Table 6-1 in “6.2 Endianess”. It defines which byte lanes are used in HR(HW)DATA.

So I fixed the _rd and _wr methods in the AHBLiteSlaveRAM class. And since the behavior of _rd and _wr methods was changed, tests had to be fixed as well.

Also, the new implementation of _rd and _wr now supports a data bus width different from 32 or 64. The AMBA AHB Specification (ARM IHI revision 0033C (ID090921)) “2.2 Manager signals” Table 2-2 describes HRDATA and HWDATA as such:

DATA_WIDTH can be 8, 16, 32, 64, 128, 256, 512, or 1024.
However, any value smaller than 32 or larger than 256 is not recommended.

Therefore, support for other sizes was added to the commit.

@aignacio
Copy link
Owner

Thanks @HaMeNopeDiot for the contribution, will update the version and merge.

@aignacio aignacio merged commit 6d9f965 into aignacio:master Jan 25, 2025
8 of 9 checks passed
aignacio added a commit that referenced this pull request Jan 25, 2025
Signed-off-by: Anderson Ignacio da Silva <anderson@aignacio.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants