DSPRelated.com
Forums

Efficient memory usage

Started by tun875 November 7, 2006
Hi everyone,

I am programming for the VC33 and want to optimize the way memory is
currently being used for a large amount of C code. I have a couple
of questions on how to make the best use of the memory capabilities
of the VC33:

1) How do I ensure that two accesses occur per cycle in dual access
memory? If I'm doing something like repetitive calculations on
matrices, it would be nice to have those two accesses at once. Does
this happen automatically for all data stored in RAM0 and RAM1, or
does it need to be done manually by doing the calculations in
assembly?

2) Regarding parallel operations, it appears from the documentation
that the ordering of the operands can have an effect on the cycle
count. For example, if src1 is in internal memory and src2 is in
external memory, the two accesses take 1 cycle. If the ordering is
reversed, however, it takes 2 cycles. Does the C programmer have any
control over the ordering? Since linking occurs after compiling, I
assume the compiler cannot know where data resides in memory, and as
such cannot order the operands itself. Can this ordering, therefore,
only take place in assembly?

Thanks in advance,

Jenny
Hi Jenny

Yes, you would be correct that to get this kind of performance you will
need to write your routine in ASM. This is not so bad. Start with
plain C and have the compiler keep the resulting ASM (-k option ?).
This should be enough for you to figure out how to get started. Also
have a look at the C compiler guide. In it you will find a list of what
registers do and do not require preservation during a call.

Best regards,
Keith Larson

DSP and Analog Consultant home.comcast.net/~klarsondsp
CTO Smith & Larson Audio www.woofertester.com
Lincoln, Ma 01773
tun875 wrote:

> Hi everyone,
>
> I am programming for the VC33 and want to optimize the way memory is
> currently being used for a large amount of C code. I have a couple
> of questions on how to make the best use of the memory capabilities
> of the VC33:
>
> 1) How do I ensure that two accesses occur per cycle in dual access
> memory? If I'm doing something like repetitive calculations on
> matrices, it would be nice to have those two accesses at once. Does
> this happen automatically for all data stored in RAM0 and RAM1, or
> does it need to be done manually by doing the calculations in
> assembly?
>
> 2) Regarding parallel operations, it appears from the documentation
> that the ordering of the operands can have an effect on the cycle
> count. For example, if src1 is in internal memory and src2 is in
> external memory, the two accesses take 1 cycle. If the ordering is
> reversed, however, it takes 2 cycles. Does the C programmer have any
> control over the ordering? Since linking occurs after compiling, I
> assume the compiler cannot know where data resides in memory, and as
> such cannot order the operands itself. Can this ordering, therefore,
> only take place in assembly?
>
> Thanks in advance,
>
> Jenny
>
>