SpW Terminals

SpaceWire is another protocol supported by TEMU. Although the SpaceWire wire protocol is byte oriented, individual byte handling is in simulation terms only needed for simulating the SpW link state automata. The TEMU SpW model is simplified into a packet based model, however to properly connect in a SpW network, the SpW link state simulation must be implemented.

The SpW protocol uses the temu_Buff copy-on-write type, this is useful as a device may queue up buffers with virtually zero copying. The buff type also provides ability to shrink the buffer from the head or the tail,without any overhead. Removing bytes from the head is very useful in SpW for the simulation of wormhole routing. As noted, TEMU does not transfer control characters (NULL, FCT), so the state machine is simulated through the following functions of the SpaceWire port interface (temu_SpwPortIface):

  • void (signalLinkStateChange)(void Device, temu_SpwLinkState LinkState)

  • temu_SpwLinkState (getOtherSideLinkState)(void Device)

The idea is that the each device can communicate its change of state to the other side calling signalLinkStateChange function on the other side port and get the other side state calling getOtherSideLinkState function on the other side port. Therefore, each device can implement its custom state machine (i.e. customized version of how to control the way that the system enter the started state), based on its current state and the state changes notified by the other side.

From a software developer point there is not much interest in phases other then Run and Ready. As such, the GRSPW2 for example, supports only Ready, Connecting and Run states at present.

The GRSPW2 will stay in Ready state if the link is disabled.

It will go and stay into connecting state if allowed to connect (LS bit set to 1) or the autostart bit is set and the other end signal a change in state to connecting.

It will go into run state if receiving a run state or a connecting from the other end while being in connecting state.

It will go into ready state if link is disabled.

It will go into connecting state if it is in run state and the other side signal a disconnection through any phase other then run or connecting.

A working SpaceWire terminal example is provided in the examples directory.