Forum Discussion
Altera_Forum
Honored Contributor
11 years agoI assume you are reading from it using Nios II. I would use this macro assuming it's a 32-bit slave port (and include io.h):
IORD_32DIRECT(BASE, OFFSET); The BASE would be 5040, but I would get that from system.h so that it's not hardcoded. The OFFSET field is a multiple of 4 since it's a 32-bit read macro. So if you have 32-bit registers in the component called A, B, C, D you would use offsets 0, 4, 8, and 12 to access them individually. The reason why you use macros like these is it ensures that Nios II data cache (if present) is bypassed and the access reaches the slave port. Even if you don't have a data cache I recommend using these macros so that your software is portable to Nios II CPUs that contain a data cache.