Forum Discussion
Altera_Forum
Honored Contributor
20 years agoThis does look like a bug in alt_dcache_flush(). I'll get it fixed. The fix should be to# ifdef out the code that limits len when flushda exists. Here's what what a fixed version looks like:
void alt_dcache_flush (void* start, alt_u32 len) {# if NIOS2_DCACHE_SIZE > 0 char* i; char* end; # ifndef NIOS2_FLUSHDA_SUPPORTED /* * This is the most we would ever need to flush. */ if (len > NIOS2_DCACHE_SIZE) { len = NIOS2_DCACHE_SIZE; }# endif /* NIOS2_FLUSHDA_SUPPORTED */ end = ((char*) start) + len; for (i = start; i < end; i+= NIOS2_DCACHE_LINE_SIZE) { ALT_FLUSH_DATA(i); } /* * For an unaligned flush request, we've got one more line left. * Note that this is dependent on NIOS2_DCACHE_LINE_SIZE to be a * multiple of 2 (which it always is). */ if (((alt_u32) start) & (NIOS2_DCACHE_LINE_SIZE - 1)) { ALT_FLUSH_DATA(i); } # endif /* NIOS2_DCACHE_SIZE > 0 */ } As for the behavior of the flushd instruction when the line is not dirty, it is invalidated.