Chanend usage increased by 1?

Technical questions regarding the XTC tools and programming with XMOS.
MyKeys
Active Member
Posts: 35
Joined: Mon Jul 03, 2017 9:41 am

Chanend usage increased by 1?

Post by MyKeys »

Why does the following line increase the chanend usage count by 1:

Code: Select all

read_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG2_NUM, d);
Complete minimal example:

Code: Select all

int main (void)
{
    unsigned d;
    read_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG2_NUM, d);

    return 0;
}
I don't understand how only 1 chanend can ever make sense?

Tools version v15.3.0 (latest as time of writing)

Constraint check for tile[0]:
Cores available: 8, used: 1 . OKAY
Timers available: 10, used: 1 . OKAY
Chanends available: 32, used: 1 . OKAY
Memory available: 524288, used: 1892 . OKAY
(Stack: 348, Code: 1284, Data: 260)
Constraints checks PASSED.
User avatar
xhuw
Verified
Member++
Posts: 22
Joined: Wed May 22, 2024 2:36 pm

Post by xhuw »

This is an interesting detail of the xcore architecture hidden underneath that API.

As you know a channel is made of 2 chanends, each setting its destination ID to the ID of the other. Assuming the other chanend is on another tile this requires creating a route through the source tile's link, the Node's switch, and the destination tile's link.

Each link and switch has multiple configuration registers. In the xcore these registers are set by sending messages via a chanend to the switch. Therefore the destination is not one of the allocatable chanends in the tile, but a fixed destination in the link.

This doc, section 3.6.2 has more details: https://www.xmos.com/download/XS1-L-Sys ... 1151A).pdf

The XS3 has roughly the same protocol as is described there.
XMOS Software Engineer

Image
MyKeys
Active Member
Posts: 35
Joined: Mon Jul 03, 2017 9:41 am

Post by MyKeys »

Thank you for the quick reply and pointer to the relevant info!