Forum Discussion
Altera_Forum
Honored Contributor
16 years agoHi Mig,
Try explicitly casting the expression in brackets to a pointer e.g. *((int*)(custom_component_base + addr)) = data; // read dataread = *((int*)(custom_component_base + addr)); Alternatively, define custom_component_base as a pointer rather than an integer type. If you do that, make sure that the offset that you add to the base address is correct for the pointer type, e.g. int *ptr=1000; *ptr=1; *(ptr+1)=2; would write to addresses 1000 and 1004 because an int is 4 bytes. whereas char *ptr=1000; *ptr=1; *(ptr+1)=2; would write to addresses 1000 and 1001 because a char is 1 byte. Cheers sb