Trouble Reading A11 Register

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User19424
Level 3
Level 3
First solution authored First like received
Hello
I am having trouble reading the A11 Register.
I tried:


__mfcr(CPU_A11)
(&CPU0_A11)->B.ADDR
*((unsigned int *)&CPU0_A11)

//Also Tried with inline assembly
int *res;
__asm__ volatile ("mov.aa %0, %%a11": "=a" (res) : :"a11");
return res;


But none seem to work. Can someone please help me?
Thank you very much.
0 Likes
8 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
This didn't work?


int res;
res = __mfcr( CPU_A11 );


What value did you get? What were you expecting?
0 Likes
User19424
Level 3
Level 3
First solution authored First like received
UC_wrangler wrote:
This didn't work?


int res;
res = __mfcr( CPU_A11 );


What value did you get? What were you expecting?


I get 0
I was expecting to get the address located in a11, but the mnemonic places 0 into d15, instead of the expected address.

I noticed from reading the documentation that __mfcr is only intended for CSFR Registers. Could this be why it doesn't work for General Purpose ones?
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
I think you're right about __mfcr and general registers - coffee hasn't kicked in yet :).

How about this:

register int res asm("d0");
__asm__ ("mov.d %d0, %a11" );
0 Likes
User19424
Level 3
Level 3
First solution authored First like received
UC_wrangler wrote:
I think you're right about __mfcr and general registers - coffee hasn't kicked in yet :).

How about this:

register int res asm("d0");
__asm__ ("mov.d %d0, %a11" );


I may also be making a silly mistake, but doing this gives me

syntax error - token ";" inserted before "asm"


Is there something I have to import for this to work properly?

Thought maybe a "=" was missing but that just gives me linker errors
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Sorry - which compiler are you using here? The one I posted was gcc (Hightec) syntax.
0 Likes
User19424
Level 3
Level 3
First solution authored First like received
UC_wrangler wrote:
Sorry - which compiler are you using here? The one I posted was gcc (Hightec) syntax.


Tasking 🙂
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
And here I went to all the work of installing GCC just to answer 😛

In Tasking, it's:

volatile int res;
__asm( "mov.d %0,a11" : "=d"(res) );
0 Likes
User19424
Level 3
Level 3
First solution authored First like received
UC_wrangler wrote:
And here I went to all the work of installing GCC just to answer 😛

In Tasking, it's:

volatile int res;
__asm( "mov.d %0,a11" : "=d"(res) );


This works. Thank you! 😄
0 Likes