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.

re-use L1D in C6455 DSP

Hi There:

I am try to make a program in C6455 DSP. However, I need to allocate more than 32KB (0x8000) Cache, which is uplimit in the C6455. However, I know I do not have to use these data structures at the same time. For example

at time 1 (I need 0x7000 L1D)

#pragma DATA_SECTION(data1, ".l1d:tsd_0");
#pragma DATA_SECTION(data2, ".l1d:tsd_1");
#pragma DATA_SECTION(input_l1d, ".l1d:input_0");
#pragma DATA_ALIGN(data1, 8);
#pragma DATA_ALIGN(data2, 8);
#pragma DATA_ALIGN(input_l1d, 8);

int data1[2048];
int data2[2048];
short input_l1d[6*1024];

at time 2 (I need 0x6000 L1D)

#pragma DATA_SECTION(pingpong_buffer, ".l1d:l1d_sect0");
#pragma DATA_ALIGN(pingpong_buffer, 8);

unsigned short pingpong_buffer[12*1024];

Obviosly, the total amount of the L1D request exceeds the 0x8000 size limit. Then I tried the  following to reuse the L1D at time 2. This method does not work because the program is running abnormally without finishing. I assume the data 1, data 2 and input_l1d are allocated in the L1D at time 1 and my method is re-using the L1D from the very beginning.

pingpong_buffer = (unsigned short *)data1;

Can you give me suggestions why I failed to re-use the L1D here?

Thank you very much,

Renaissance

  • You probably have already figured out the answer yourself.

    Renaissance said:
    unsigned short pingpong_buffer[12*1024];

    This line needs to be changed to

    unsigned short *pingpong_buffer;

    Then your assignment statement in red will do what you want it to do.

  • Thank you.  THis is one factor.

    One other reason I found out is althouth I declare data1 data2 and input_l1d in l1d. In fact, the input_l1d is at the beginging of the l1d. So, instead of using

    pingpong_buffer = (unsigned short *)data1;

    I should do pingpong_buffer = (unsigned short *)input_l1d to make sure the size from the beginning of the l1d is enough for pingpong_buffer.

    Thank you

  • Not to throw too many options at you, but you might be interested in the linker UNION and GROUP statements. You can find complete descriptions of them and the correct syntax in the Assembly Language Tools User's Guide SPRU186 .

    GROUP allows you to make sure the different memory elements are allocated in a specific order.

    UNION allows you to overlay different memory elements.