-
Hi, So I try to do a Wishbone-AHBLite bridge. I did it easily without special lock or burst and for 32bits.
I tried in a test program the following function to write a half-word only:
But I have an error 'Store address misaligned'. Have you any idea on how to proceed, pls ? I precise that address is in the Data_address_space.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
This is strange. I just tried your function using the 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 void HW_set_16bit_reg(uint32_t reg_addr, uint16_t value) {
(*(IO_REG16 reg_addr)) = value;
} Second, you need to make sure that the address you are passing in
By the way... |
Beta Was this translation helpful? Give feedback.
-
If it can help you, find attached the small bridge for wb to ahblite bus I made. |
Beta Was this translation helpful? Give feedback.
This is strange.
I just tried your function using the
ext_ram_c
memory in the default testbench (this memory is located at base addressF000.0000
).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: