XC Manual/ function source code Topic is solved

New to XMOS and XCore? Get started here.
Post Reply
hessa59
Active Member
Posts: 37
Joined: Sat Mar 18, 2017 7:19 pm

XC Manual/ function source code

Post by hessa59 »

I am trying to understand the exact nature of the sync command.

When I say sync (p) does it just delay outputs that are pending or all subsequent outputs on port p? Is there an unsync()?

I thought I could look it up in a manual that gives a definitions of XC commands like the sync command as opposed to seeing it used in one particular context in a program.
This has come up for me several times when trying to understand various XC commands.

Is there an XC manual of this nature that defines the syntax of unique XC things like interface?

I thought I might look up the definition of the sync command in Xtime Composer. I find the prototype in XS1.h but I am not sure where to find the actual
function source code.

Any help would be greatly appreciated :)


View Solution
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

hessa59
Active Member
Posts: 37
Joined: Sat Mar 18, 2017 7:19 pm

Post by hessa59 »

Hi Mon
Thanks for the quick response. Unfortunately there are some issues with this link.

1) It provides the same example as is given in the XC Programming guide which is the one I am trying to understand by looking up the definition of the command.
2) The links to the graphics ie waveforms are broken
I am assuming there is no actual definition type listing of XC commands.

My conclusion based on the example is that sync affects all subsequent uses of the port p.
I am assuming that the waveform with the broken link is the same one that is in the programming guide.

I have attached a marked up version of the waveform where I have marked all outputs that I think are influenced by the sync in red (p) and the others in blue (q).

If you are familiar with sync could you comment on my diagram please.
Image
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

http://www.xmos.com/download/private/Pr ... ces(1).pdf

shows the same example and details the sync operation on pg 52 & 127.

Do not believe there is an unsync feature. The sync command appears to be sticky once applied.

Let me try to explain in words and feel free to correct if I am mistaken:

This example starts with p port outputting a value of 0 onto the 4 bit wide port p.

Then the sync(p) is applied. This forces the CPU to wait till the CPU clock is reaches the FALLING EDGE of the clock cycle. Note the dotted vertical line in the diagram and the top CPU clock cycle falling edge alignment.

Next, on the first iteration, port p outputs the upper nibble (top 4 bits) onto the 4 bit wide port p right after the CPU falling clock cycle edge.

Respectively, on the first iteration, port q outputs the lower nibble onto the 4 bit wide port q at the same time so is aligned with the above p output. That is the result you are after with the sync feature.

The above 2 values are posted onto the respective port pins till the next falling edge of the clock period.

Then the next iteration repeats in the same manner. The key point is that the output values are able to be placed to the outside world for a full clock period for sampling by your external hardware and aligned to the same edge for the port pins. If you use the sync command, you are able to execute 2 outputs during the same clock period (ie. output by p and output by q).

Hope this helps.

--

Wow - must be late with my typos and usually I am the Spelling Police...time for Amazing Race.
hessa59
Active Member
Posts: 37
Joined: Sat Mar 18, 2017 7:19 pm

Post by hessa59 »

Your explanation confirms my understanding that once sync has been applied to a port all subsequent outputs to that port must wait till the data on the port
has been valid for complete port clock cycle before outputting at the falling edge.

Where in this case the clock for the port is external being set by configure_clock_src.

In my diagram all the p outputs (marked in red) are elongated except for the ones surrounding the sync.

Since all the ps are forced to synchronize with the port clock and the unsynchronized q instruction will always happen in less than a port clock cycle both nibbles will be ready for the next falling edge.

This effectively slows the program loop to the speed of the external clock.
Cool stuff XMOS!

Thanks again mon2
Post Reply