AnsweredAssumed Answered

encapsulation for Harvard memory architecture

Question asked by bookevg on Sep 23, 2012
Latest reply on Oct 1, 2012 by bookevg

I like C++ encapsulation, but C++ of VDSP++ and CCES isn't really usable for Harvard memory architecture, because I can't place class data in different segments. It's bad. I sure to allocate the memory in constructor, but I don't get used to allocate (new, malloc) in real-time motor control system.

It would be super if AD solve this problem

My code:


typedef struct tHarvardMem_Tst_Reg


     #pragma section(seg_pmda,PM)

     int pm k[512];

     #pragma section(seg_dmda,DM)

     int dm x[512];

     #pragma section(seg_dmda,DM)

     int dm y[512];



class CHarvardMem_Tst



     CHarvardMem_Tst ()     {// do something}

     ~CHarvardMem_Tst ()   {// do something}

     void Run(void)              {     for (int i = 0; i < 512; i++)     {Sig.y[i]     += __builtin_RxR(Sig.k[i],Sig.x[i]);} }

     THarvardMem_Tst_Reg Sig;


The compiler out maximum perfomance using SIMD and synchronous k and x from pm and dm without stall.

So it would be good for 40-bit float point:


typedef struct tHarvardMem_Integrator_Reg


     #pragma section(seg_pmda_32bit,PM)

     float pm k;

     #pragma section(seg_dmda_32bit,DM)

     float dm In;

     #pragma section(seg_dmda_40bit,DM)

     float dm Out;


class CHarvardMem_Integrator



     CHarvardMem_Integrator()     {// do something}

     ~CHarvardMem_Integrator()   {// do something}

     void Run(float in)



         Sig.In = in;

          Sig.Out = Sig.k * in;



     CHarvardMem_Integrator Sig;