Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12742 Discussions

Does alt_dcache_flush_all() work right?

Altera_Forum
Honored Contributor II
1,683 Views

Hi: 

I want to flush all dcache of niosII/f core, I find a function in kitsv1.1\nios2\components\altera_nios2\HAL\src\alt_dcache_flush_all.c , but I wonder if it is correct. the function is like that: 

 

/* 

* alt_dcache_flush_all() is called to flush the entire data cache. 

*/ 

 

void alt_dcache_flush_all (void) 

{# if NIOS2_DCACHE_SIZE > 0 

alt_dcache_flush (0, NIOS2_DCACHE_SIZE);# endif 

 

I read the src of function alt_dcache_flush (void* start, alt_u32 len) in alt_dcache_flush.c. the first param is an address second is a size. we can invoke it like that alt_dcache_flush(&iVal , sizeof(iVal) ), but what does it mean to pass a zero to it as first param just like alt_dcache_flush_all() does? Is it correct? 

 

I am anxious to know the answer. Who can give me some advice? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
773 Views

Yes, this is correct. 

The Nios II FLUSHD instruction ignores the tag portion of the memory address (the top bits). 

This means that a FLUSHD to address 0x0000 is the same as a FLUSHD to address 0x1000, 0x2000, 0x3000, etc. for a 4096 byte D-cache. 

 

+james+
0 Kudos
Altera_Forum
Honored Contributor II
773 Views

I got it!thanks ! 

I may have read the describtion of flushd and initd instruction, but I ignore the sentence"Ignore the tag,flushd identifies the cache line associated with the computed effective address". because I don&#39;t know what the tag refer to.  

 

thanks again. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Reply