[21369] Erroneous results for memcpy to/from external memory

Hello,

I'm having issues when using 'memcpy' to and from external memory on my ADSP-21369.

When SIMD optimization are enabled (e.g. in Release mode), only every other element seems to be copied (as seen in the ?

I get the same behavior when using #pragma SIMD_for on a for loop between internal and external memory.

When profiling the copy, I get half the cycles compared to no optimization or #pragma vector_for.

Is this the expected behavior?

Note: I'm copying vectors of 32-bit integer or float.



Added data type (float & int)
[edited by: ClementLebar at 1:37 AM (GMT 0) on 2 May 2019]
  • For info, the PLL init is the following

    void Init_PLL_SDRAM(void)
    {
    	
    	int temp,i;
    	
    	int* temp1=(int*)0x8000000;
    	
    	*pPMCTL=PLLM27|INDIV|SDCKR2_5|DIVEN;
    	
    	temp=*pPMCTL;
    	temp|=PLLBP;
    	temp^=DIVEN;
    	*pPMCTL=temp;
    	
    	for(i=0;i<=5000;i++);
    	
    	*pPMCTL^=PLLBP;
    	
    	*pSYSCTL|=MSEN;
    	
    	*pEPCTL|=B2SD;
    	
    	#ifdef OPTIMIZE
    		
    		*pSDRRC=0x814|SDROPT|(1<<17);
    		
    	#else
    		
    		*pSDRRC=0x814;
    	
    	#endif
    	
    	*pSDCTL=SDCL3|DSDCLK1|SDPSS|SDCAW8|SDRAW12|SDTRAS7|SDTRP3|SDTWR2|SDTRCD3;
    	
    	temp=*temp1;
    	
    }

    Read optimization is enabled and the behavior is the same regardless.

  • 0
    •  Analog Employees 
    on Jun 8, 2019 12:31 PM over 1 year ago in reply to ClementLebar
    Hello ,

    Apologies for the delay. Were you able to get going.
    Usually for SIMD instructions to be generated you have to call an Analog Devices DSP function call (like an FFT or vmult or something like that) or specify a loop of instructions to be SIMD enabled by using a #pragma SIMD_for.  It will automatically generate SIMD code on for loops if it knows the alignment of the data in the loops.  You can also do a file specific settings and just disable SIMD for those files have accesses to external memory.

    As far as accessing external memory you setup your Linker Definition File (.ldf) to tell the linker where your memory is and give the memory segments names.  Once you do this you can map global and static variables to external memory and then just use them as a normal variable.  Of course I am assuming you are doing all this in C.  If you code in assembly then you just access the memory with the addresses at which your memory is located.

    I hope this helps a bit.

    Regards,
    Lalitha.S