This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dm8168 iram问题



软件环境:dvr_rdk2.0    dsp-C674x

问题:在dm8168中,将程序完全放入iram中运行和在dsp外部内存中运行,耗时基本一致,why????

在cfg中,iram部分的内存配置如下:

Program.sectMap[".internalHeap"]              = "DSP_L2_RAM";  

heapMemParams.size = 0x00020000;
heapMemParams.sectionName = ".internalHeap";
var heap1 = HeapMem.create(heapMemParams);

Program.global.DSP_HEAPINT_MEM = heap1;

/* Configure DSKT2 heaps and scratch */
DSKT2.ALLOW_EXTERNAL_SCRATCH = false;

DSKT2.DARAM0 = "DSP_HEAPINT_MEM";

["DSP_L2_RAM", {
comment: "DSP_L2_RAM",
name: "DSP_L2_RAM",
base: 0x10800000,
len: 0x00020000
}],

l1PMode: "32k",
l1DMode: "32k",
l2Mode: "128k"

  • 你好,

    我认为是cache的原因。你可以disable 所有的cache,然后比较,应该是DDR比较慢。

  • 你 好,

    cache我是有开的,开启如下:

    var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
    /* Disable caching for HWspinlock addresses */
    Cache.MAR0_31    = 0x00000000;
    Cache.MAR32_63   = 0x00000000;
    /* Config/EDMA registers cache disabled */
    Cache.MAR64_95   = 0x00000000;
    Cache.MAR96_127  = 0x00000000;
    Cache.MAR128_159 = 0xff800000;
    /* TILER memory cache disabled  - 0xA0000000*/
    Cache.MAR160_191 = 0x00000000;
    /* memory cache disabled  - 0xC0000000*/
    Cache.MAR192_223 = 0x00000000;
    /* memory cache disabled  - 0xE0000000*/
    Cache.MAR224_255 = 0x00000000;
    
    Cache .initSize =  {
          l1pSize: Cache.L1Size_32K,
          l1dSize: Cache.L1Size_32K,
          l2Size: Cache.L2Size_128K
    };
    不开启Cache .initSize的内容的话,的确会比开启的慢一点,但是效果还是不明显,这不应该呀,iram开启的话,效率应该是有很大的提升的,我测试iram和外部内存效率的程序如下:
        unsigned long long tDiff = 0;
        unsigned long long t;
        unsigned char * ptrBuf =  shareMemoryParams->byBuf; //指向外部内存
        unsigned char * ptrIram = iram_ctx->byReusable; //指向iram
        unsigned char tmp ;
        int j;
        memset(ptrBuf , 255 ,imgWH* sizeof(unsigned char));
        memset(ptrIram , 255 ,imgWH* sizeof(unsigned char));
        //int nSum , x1,y1;
        t = Utils_getCurTimeInUsec();
        PRINT("ptrIram t1 = %ld \n",t );
    
        for(i = 0;i < imgWH -1;i++)
        {
            tmp =  ptrIram[i] - 1 ;
            ptrIram[i] = tmp;
        }
    
        PRINT("ptrIram t2= %ld \n",Utils_getCurTimeInUsec() );
        tDiff = Utils_getCurTimeInUsec() - t  ;
        PRINT("ptrIram tDiff2 = %ld \n",tDiff );
    
        t = Utils_getCurTimeInUsec();
        PRINT("ptrBuf t1 = %ld \n",t );
    
        for(i = 0;i < imgWH -1;i++)
        {
            tmp =  ptrBuf[i] - 1;
            ptrBuf[i] = tmp;
        }
    
    
        PRINT("ptrBuf t2= %ld \n",Utils_getCurTimeInUsec() );
        tDiff = Utils_getCurTimeInUsec() - t;
    
        PRINT("ptrBuf tDiff1 = %ld \n",tDiff);