Skip to content

External memory and AHB-lite bridge #57

Answered by stnolting
GTrannoy asked this question in Q&A
Discussion options

You must be logged in to vote

This is strange.

I just tried your function using the ext_ram_c memory in the default testbench (this memory is located at base address F000.0000).

HW_set_16bit_reg(0xF0000000UL, 0x1234);
HW_set_16bit_reg(0xF0000002UL, 0x5678);
HW_set_16bit_reg(0xF0000004UL, 0xabcd);
HW_set_16bit_reg(0xF0000006UL, 0x0e0f);

I don't get any address alignment exceptions there... 🤔

Anyway. At first you should use IO_REG16 in your function since you only want to access 16-bit portions of memory. In your version you are writing 16-bit data to a 32-bit "pointer", which will make the compiler create "read-mask-modify-mask-write" memory operations. This works, but it is veeeery slow. So better use:

void HW_set_16b…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
7 replies
@stnolting
Comment options

@GTrannoy
Comment options

@stnolting
Comment options

@stnolting
Comment options

@GTrannoy
Comment options

Answer selected by stnolting
Comment options

You must be logged in to vote
2 replies
@stnolting
Comment options

@GTrannoy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants