asm for getts

Technical questions regarding the XTC tools and programming with XMOS.
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

asm for getts

Post by JohnR »

Hi,

I have tried to call the getts function from XC using

asm ("getts %0, %1" : "=r"( tStop ) : "r"(val));

where tStop and val are integers but get the following error message

Error: no format matching for instruction 'getts'.

At the present I am omitting this line from the xc code, compiling to assembler and adding the call manually to the .S file.

What is the correct way to call getts?

Thanks,

John,


User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Check page 15 in http://www.xmos.com/system/files/xas99.pdf

I believe it's:

getts d,res [†r]
(not getts d,r)‡

"There are two ways to specify an instruction:
by writing its mnemonic in uppercase
followed by a comma-separated list of its operands , or by using a lowercase notation
that more clearly expresses its behaviour"
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

Post by skoe »

Hihi, the same kind of mistake I did yesterday.

Really: That's the first processor I know with a different syntax in the assembler as in the architecture manual.

To summarize it up: The architecture documents like xs1_en.pdf explain the machine opcodes from the technical point of view. But the assembler accepts a syntax which can be found in the Assembly Language Manual (xas99.pdf). Confusing, eh?
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

I tried to write asm on XMOS before the Asm manual was released. That was problematic for me.
Have you tried the upper case - I just found those lines.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

Post by skoe »

lilltroll wrote:I tried to write asm on XMOS before the Asm manual was released. That was problematic for me.
I see :)
Have you tried the upper case - I just found those lines.
Edit: Oh, now I understand... Interesting... A bit confusing, these two ways...
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Maybe the Wiki for XMOS would be the thing to find the info that we need when we search it.
More and more info are released in the docs from XMOS, but it is not always easy to know where to look for it.
Probably not the most confused programmer anymore on the XCORE forum.
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Post by JohnR »

Thanks for the suggestions but I still cannot get this code or other variants to work

Code: Select all

void stop_channel(in port  stop, streaming chanend c_stop)
{
	int  tStop;
........................
	asm ("getts %0, %1" : "=r"( tStop ) : "r"(stop));
..............................
}		

[/

The error is still Error: no format matching for instruction 'getts'.

I thought I had followed the instructions in Section 19.2 in the tools user guide. The description
getts d; res(r) imples that the destination is a 16 bit value but I have tried declaring tStop as a short but still get the same error.

Once again any help is appreciated.

John.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

Post by skoe »

Try this:

Code: Select all

asm ("getts %0, res[%1]" : "=r"( tStop ) : "r"(stop));
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Post by JohnR »

Hi Skoe,

Thanks so much - that was the trick. How did you come up with the correct invocation - was it obvious or is it documented somewhere?

In any case this example maybe could be added to Section 19.2 in the tools user guide?

John.
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

Inline assembly in general is documented in section 19.2 of the Tools User Guide at http://www.xmos.com/system/files/toolsuser_en_ch19.pdf

Hope that helps