spp_encapsulation is the transfer layer of OpenSPP on SpaceWire (blocks EN-1 and EN-2 of the architecture): the
SpaceWire CCSDS Packet Transfer Protocol of ECSS-E-ST-50-53C. The encapsulation puts every Space Packet into a CPTP
packet for the destination of its APID; the decapsulation checks a received CPTP packet and passes its Space Packet
and User Application value to the receiving end.
The encapsulation shall take Space Packets and give CPTP packets as AXI4-Streams of DataWidth_g bits with Keep and Last; TUser bit 0 flags an error end of packet with the last beat, bits 4:1 hold the destination index.
CPTP 5.4.1.8
EN-IF-02
The decapsulation shall take CPTP packets with the error end of packet flag in TUser and give Space Packets with the error end of packet flag (bit 0, last beat) and the User Application value (bits 8:1) in TUser.
CPTP 5.2.3.2
EN-IF-03
Every packet discarded by the decapsulation shall be reported as a one-cycle event with its reason.
CPTP 5.1.3, 5.5.4.3b
EN-IF-04
The reset input shall return both blocks from any state to the reception of a new packet.
A CPTP packet shall consist of the Target SpaceWire Address of the destination (0 to SpwAddrBytes_g bytes), its Target Logical Address, the Protocol Identifier 0x02, the Reserved field 0x00, its User Application value and the Space Packet, first byte first, ended like the Space Packet (EOP, or EEP).
The destination shall be the entry of the destination index of the packet in the destination table of NumDest_g entries; an index beyond the table selects destination 0, an address length beyond SpwAddrBytes_g is limited to it.
The decapsulation shall remove Cfg_RxStrip leading bytes (0 to 15) and the CPTP header and pass the Space Packet with the User Application value of the header.
CPTP 5.3.1, 5.5.4.2
EN-RX-02
A packet shall be discarded when it has no byte beyond the CPTP header (0x14), when its Protocol Identifier is not 2 (0x11), when its Reserved field is not zero (0x12), or, with the filter enabled, when its Target Logical Address is neither Cfg_Tla nor 0xFE (0x13); a discarded packet terminated by an EEP is reported as 0x10.
CPTP 5.3.2, 5.5.4.1, 5.5.4.3a, 5.5.4.4
EN-RX-03
A packet terminated by an EEP that passes the checks shall be passed on with the error end of packet flag, so that the reception discards it.