spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
|
NN packet handling for SC&MP. More...
Data Structures | |
struct | nn_desc_t |
Nearest neighbour protocol state. More... | |
Macros | |
#define | BC_TABLE_SIZE 16 |
Number of packets to allocate for the nearest neighbour protocols. | |
#define | PART_ID (CHIP_ID_CODE & 0xfff00000) |
Device identifier (0x591 << 28 , for SpiNNaker) | |
#define | P2PB_STOP_BIT 0x400 |
Set to stop propagation. | |
Enumerations | |
enum | ff_states { FF_ST_IDLE = 0 , FF_ST_EXBLK = 1 , FF_ST_INBLK = 2 } |
Flood fill states. More... | |
enum | sig0_operations { SIG0_FWD_RTRY , SIG0_LEDS , SIG0_GTP , SIG0_ID , SIG0_LEVEL , SIG0_APP , SIG0_TP , SIG0_RST , SIG0_DOWN , SIG0_UP } |
Operation codes for nn_cmd_sig0() More... | |
enum | sig1_operations { SIG1_WRITE } |
Operation codes for nn_cmd_sig1() More... | |
Functions | |
void | send_nn_links (uint) |
void | nn_init (void) |
Initialise the nearest-neighbour data structures. | |
void | compute_eth (void) |
Computes where our board's ethernet chip is. | |
void | peek_ack_pkt (uint link, uint data, uint key) |
Initialises peek_pkt to contain the given arguments (presumably an acknowledge) | |
void | poke_ack_pkt (uint link, uint data, uint key) |
Initialises poke_pkt to contain the given arguments (presumably an acknowledge) | |
uint | link_read_word (uint addr, uint link, uint *buf, uint timeout) |
Read a word from the chip (or device) over a link. | |
uint | link_write_word (uint addr, uint link, uint *buf, uint timeout) |
Write a word to the chip (or device) over a link. | |
pkt_buf_t * | pkt_buf_get (void) |
Allocate a packet (getting one from the free list, pkt_buf_list). | |
void | pkt_buf_free (pkt_buf_t *pkt) |
Add packet to free list (pkt_buf_list), "freeing" it. | |
void | nn_mark (uint key) |
Mark an ID as discovered. | |
static void | nn_cmd_rtrc (uint data) |
Write the Router Control Register. | |
uint | nn_cmd_sig0 (uint data) |
SIG0 does simple commands whose data fits into 28 bits. | |
static void | nn_cmd_mem (uint data, uint key) |
Memory write operations. | |
void | nn_cmd_sig1 (uint data, uint key) |
SIG1 does simple commands with a payload whose control fits in 20 bits. | |
static uint | nn_cmd_p2pb (uint id, uint data, uint link) |
P2P Broadcast, used to propagate P2P addresses and maintain the P2P routing table. | |
static void | proc_pkt_bc (uint i_pkt, uint count) |
Nearest neighbour packet broadcast handler. | |
void | nn_rcv_pkt (uint link, uint data, uint key) |
Nearest-neighbour packet received handler. | |
Flood fill | |
uint | next_id (void) |
Get the next flood-fill identifier we should use. | |
void | ff_nn_send (uint key, uint data, uint fwd_rty, uint add_id) |
Flood fill NN packet sender. | |
static void | nn_cmd_ffs (uint data, uint key) |
Flood fill start. | |
static uint | nn_cmd_ffcs (uint data, uint key) |
Flood fill core select. | |
static uint | nn_cmd_fbs (uint id, uint data, uint key) |
Flood fill block start. | |
static uint | nn_cmd_fbd (uint id, uint data, uint key) |
Flood fill block data. | |
static uint | nn_cmd_fbe (uint id, uint data, uint key) |
Flood fill block end. | |
static uint | nn_cmd_ffe (uint id, uint data, uint key) |
Flood fill end. | |
Board information flood fill | |
uint | next_biff_id (void) |
Get the next board info flood-fill identifier we should use. | |
void | biff_nn_send (uint data) |
Board information flood fill packet sender. | |
void | nn_cmd_biff (uint x, uint y, uint data) |
Board information flood fill command handler. | |
void | nn_rcv_biff_pct (uint link, uint data, uint key) |
void | send_nn_netinit (uint netinit_level) |
P2PC | |
void | p2pc_addr_nn_send (uint arg1, uint arg2) |
Transmit our current best guess of coordinates to all neighbouring chips. | |
void | p2pc_new_nn_send (uint x, uint y) |
Broadcast the existence of a new P2P coordinate having been discovered. | |
void | p2pc_dims_nn_send (uint arg1, uint arg2) |
Transmit our current best guess of coordinates to all neighbouring chips. | |
void | p2pc_reth_nn_send (uint eth, uint arg2) |
Transmit our address back to an Ethernet. | |
void | p2pb_nn_send (uint arg1, uint arg2) |
Transmit "P2PB" table generating packets. | |
static void | nn_rcv_p2pc_addr_pct (uint link, uint data, uint key) |
Update our current best guess of our coordinates based on a packet from a neighbour. | |
static void | nn_rcv_p2pc_new_pct (uint link, uint data, uint key) |
A new P2P coordinate has been broadcast to us. | |
static void | nn_rcv_p2pc_dims_pct (uint link, uint data, uint key) |
A neighbour has reported their P2P coordinates to us. | |
static void | nn_rcv_p2pc_reth_pct (uint link, uint data, uint key) |
A P2P address to link back to Ethernet has been sent. | |
void | nn_rcv_p2pc_pct (uint link, uint data, uint key) |
Handle P2PC packet. | |
Variables | |
pkt_buf_t | pkt_buf_table [BC_TABLE_SIZE] |
Storage for packets used in pkt_buf_list. | |
pkt_buf_t * | pkt_buf_list |
Free list of packets. | |
uint | pkt_buf_count |
Number of packets (in pkt_buf_table) not on free list (pkt_buf_list) | |
uint | pkt_buf_max |
Statistics: maximum value of pkt_buf_count. | |
uint * | hop_table |
Table "hop_table" has entries of type (id << 24, hops) for each possible P2P address. | |
uchar | core_app [MAX_CPUS] |
What application (or at least AppID) is running on each core. | |
uint | app_mask [256] |
Unused? | |
static nn_desc_t | nn_desc |
Nearest neighbour protocol state. | |
pkt_buf_t | peek_pkt |
Packet reserved for performing P2P peeks. | |
pkt_buf_t | poke_pkt |
Packet reserved for performing P2P pokes. | |
uint | mon_del = 0 |
delegate blacklisted monitor | |
volatile uint | neighbour_netinit_level [NUM_LINKS] |
neighbour over link netinit level | |
volatile uint | neighbour_links_enabled [NUM_LINKS] |
neighbour over link links enabled | |
uint | pp_ping_count [NUM_LINKS] |
uint | mc_ping_count [NUM_LINKS] |
Reserved for performing MC and P2P pings. | |
char | eth_map [12][12] |
Local ethernet chip locator map. | |
Level deltas | |
Given a packet arriving from a given direction which is labelled with an X and Y coordinate, gives the dx, dy to get the current chip's coordinate. | |
const signed char | lx [6] = {-1, -1, 0, +1, +1, 0} |
X deltas, by link ID. | |
const signed char | ly [6] = { 0, -1, -1, 0, +1, +1} |
Y deltas, by link ID. | |
NN packet handling for SC&MP.
struct nn_desc_t |
Nearest neighbour protocol state.
Data Fields | ||
---|---|---|
uchar | state | FF state (see ff_states enum) |
uchar | error | Error flag. |
uchar | forward | Rebroadcast code. |
uchar | retry | Rebroadcast retry. |
uchar | id | ID of current FF. |
uchar | block_len | Block length. |
uchar | block_count | Block count. |
uchar | block_num | Block number. |
uchar | app_id | AppID. |
uchar | load | Whether to load locally. |
ushort | srce_addr | P2P of sender. |
ushort | word_len | Number of words in block. |
ushort | word_count | Count of received words. |
uint | gidr_id | GIDR ID. |
uint | sum | Checksum. |
uint | cores | Selected cores to load. |
uint * | aplx_addr | APLX block addr. |
uint | load_addr | Block load base. |
uint | id_set[4] | ID bitmap (128 bits) |
uint | biff_id_set[4] | Board-level flood-fill ID bitmap (128 bits) |
uint | fbs_set[8] | Block bitmap for FBS (must be >= 8 words) |
uint | fbd_set[8] | Word bitmap for FBD (must be >= 8 words) |
uint | fbe_set[8] | Block bitmap for FBE (must be >= 8 words) |
uint | stats[16] | Counters for each packet type. |
uint | errors | Counter for bad checksums. |
uint | buf[SDP_BUF_SIZE/4] | Holding buffer. |
uint64 | last_ffcs | Index of the last FFCS packet. |
enum ff_states |
enum sig0_operations |
Operation codes for nn_cmd_sig0()
Enumerator | |
---|---|
SIG0_FWD_RTRY | Set forward and retry. |
SIG0_LEDS | Set LEDs (call sark_led_set()) |
SIG0_GTP | Global Time Phase. |
SIG0_ID | ID set/reset. |
SIG0_LEVEL | Trigger level_config() _(unimplemented)_. |
SIG0_APP | Signal application (call signal_app()) |
SIG0_TP | Router time phase period _(unimplemented)_. |
SIG0_RST | Shut down APs _(unimplemented)_. |
SIG0_DOWN | Minimum power mode _(unimplemented)_. |
SIG0_UP | Operational mode _(unimplemented)_. |
enum sig1_operations |
Operation codes for nn_cmd_sig1()
Enumerator | |
---|---|
SIG1_WRITE | Memory write. |
Initialises peek_pkt to contain the given arguments (presumably an acknowledge)
[in] | link | Which link to send the packet on |
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Initialises poke_pkt to contain the given arguments (presumably an acknowledge)
[in] | link | Which link to send the packet on |
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Read a word from the chip (or device) over a link.
[in] | addr | The address to read from |
[in] | link | The link to use |
[out] | buf | The data that has been read (4 byte buffer) |
[in] | timeout | How long to wait for the other side to respond |
Write a word to the chip (or device) over a link.
[in] | addr | The address to write to |
[in] | link | The link to use |
[in] | buf | The data that is to be written (buffer containing 4 bytes) |
[in] | timeout | How long to wait for the other side to respond |
pkt_buf_t * pkt_buf_get | ( | void | ) |
Allocate a packet (getting one from the free list, pkt_buf_list).
NULL
if none available void pkt_buf_free | ( | pkt_buf_t * | pkt | ) |
Add packet to free list (pkt_buf_list), "freeing" it.
[in] | pkt | Packet to free. |
uint next_id | ( | void | ) |
Get the next flood-fill identifier we should use.
uint next_biff_id | ( | void | ) |
Get the next board info flood-fill identifier we should use.
void nn_mark | ( | uint | key | ) |
Mark an ID as discovered.
[in] | key | The key from the NN packet |
Flood fill NN packet sender.
[in] | key | The key to use |
[in] | data | The data to use |
[in] | fwd_rty | Forward/delay/retry configuration |
[in] | add_id | Whether to merge the next_id() result into the key |
void biff_nn_send | ( | uint | data | ) |
Board information flood fill packet sender.
[in] | data | The payload of the packet to send. |
Transmit our current best guess of coordinates to all neighbouring chips.
arg1 | unused |
arg2 | unused |
Broadcast the existence of a new P2P coordinate having been discovered.
[in] | x | X coordinate |
[in] | y | Y coordinate |
Transmit our current best guess of coordinates to all neighbouring chips.
arg1 | unused |
arg2 | unused |
Transmit our address back to an Ethernet.
eth | The Ethernet address to send to |
arg2 | unused |
Transmit "P2PB" table generating packets.
arg1 | unused |
arg2 | unused |
Update our current best guess of our coordinates based on a packet from a neighbour.
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
A new P2P coordinate has been broadcast to us.
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
A neighbour has reported their P2P coordinates to us.
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
A P2P address to link back to Ethernet has been sent.
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
Handle P2PC packet.
Delegates to:
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
|
static |
Write the Router Control Register.
[in] | data | payload from the NN packet. Various fields may be selected using 'spare' bits in the word. The field is updated if the bit is set. bit 5 — Wait2 bit 4 — Wait1 bit 3 — W bit bit 2 — MP field bit 1 — TP field |
SIG0 does simple commands whose data fits into 28 bits.
Delegates to:
[in] | data | The message payload |
Memory write operations.
[in] | data | The data to write |
[in] | key | The key from the NN packet. Encodes where to write relative to (sv, sysram, sc, or sv_t::mem_ptr), what the offset should be, and how much to write (1, 2 or 4 bytes). |
SIG1 does simple commands with a payload whose control fits in 20 bits.
Delegates to:
[in] | data | The payload from the NN packet |
[in] | key | The key from the NN packet |
P2P Broadcast, used to propagate P2P addresses and maintain the P2P routing table.
Table "hop_table" has entries of type (id << 24, hops) for each possible P2P address. Field "hops" contains the number of hops to the address (initialised to 65535) and "id" contains the ID of the last packet used to update the table (initialised to 128).
An update occurs when a packet with a lower hop count than the current one arrives via an enabled link. The link on which the packet arrived is used to update the P2P routing table.
[in] | id | The ID from the key of the packet |
[in] | data | The payload of the packet |
[in] | link | What route the packet came from |
data
, with P2P_STOP_BIT set if the packet should not be propagated Flood fill start.
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Flood fill core select.
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Flood fill block start.
[in] | id | The ID from the key of the packet |
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Flood fill block data.
[in] | id | The ID from the key of the packet |
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Flood fill block end.
[in] | id | The ID from the key of the packet |
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Flood fill end.
[in] | id | The ID from the key of the packet |
[in] | data | The payload of the packet |
[in] | key | The key of the packet |
Nearest neighbour packet broadcast handler.
[in] | i_pkt | (Type-punned) pkt_buf_t pointer |
[in] | count | Number of times to try; should be at least 1 |
Board information flood fill command handler.
Can be invoked directly during setup, or in response to a BIFF message.
[in] | x | The believed X coordinate |
[in] | y | The believed Y coordinate |
[in] | data | The payload word from the message |
Board info flood fill packet receiver
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
Nearest-neighbour packet received handler.
[in] | link | What link was the packet received on |
[in] | data | The payload from the packet |
[in] | key | The key from the packet |
uint* hop_table |
Table "hop_table" has entries of type (id << 24, hops)
for each possible P2P address.
Field "hops" contains the number of hops to the address (initialised to 65535) and "id" contains the ID of the last packet used to update the table (initialised to 128). These are packed into a word.
Stored in SYSRAM so visible to all cores. Should only be updated by SCAMP
char eth_map[12][12] |
Local ethernet chip locator map.
Given a P2P address, compute P2P address of chip with Ethernet interface on same PCB. Table is for standard 48-chip boards only. Will work with 4-chip boards - may not work for more exotic combinations! Also computes the position of the chip on the PCB as offset from (0,0)
Each byte in this table is a pair of X,Y values which are subtracted from a P2P address to give the address of the Ethernet-attached chip on the same 48-chip PCB.