Hi,
I am facing issue in the assembly translation of a structure parsing code on a Turbo Nyquist processor using compiler version 7.3.5
The code bit looks something like this.
-----------Global declarations--------
typedef struct
{
uint16 a;
uint16 b;
uint16 c;
}structtype1;
typedef struct
{
uint16 p;
uint16 q;
uint16 r;
}structtype2;
structtype1 demo1; // cacheable memory
structtype2 demo2; // cacheable memory
-------------end---------------------------
main()
{
demo1.a = 1;
demo1.b = 2;
demo1.c = 3;
Parse_demo2(&demo1);
}
Parse_demo2(structtype1* demoptr1)
{
structtype2* demoptr2 = &demo2;
cacheWritebackandInvalidate(demoptr2, sizeof(structtype2));
demoptr2->p = demoptr1->a; // line 1
demoptr2->q = demoptr1->b; // line 2
demoptr2->r = demoptr2->p + (demoptr2->q > 0); // line 3
cacheWriteback(demoptr2, sizeof(structtype2));
}
On executing the code I always see the result to be 0.
On analysing the assembly it is seen that before line 1 and line 2 assignments are completed, line 3 fetches the operands from the memory in line 1 and line 2.