In 1-step insertion mode, egress PTP packets are modified in flight with a calculated timestamp. The PTP Timestamper logic takes in packet data from the TX interface, locates the embedded PTP packet, inserts the timestamp, (optionally) recalculates the UDP checksum, and recalculates the Ethernet FCS field.
ctl_tx_ptp_1step_enable= 0 field of the CONFIGURATION_1588_REG is set to 0, the timestamp insertion block is bypassed to minimize the latency through the TX MAC. Insertion is not supported for preempted packets (used in TSN).
- Ordinary/Boundary Clock Mode
- The time-of-day timestamp is inserted into a combination of the Timestamp and the Correction field of the PTP packet.
- Transparent Clock
- The Correction field contains a residence time which is calculated by subtracting the ingress timestamp and adding the egress timestamp (the difference is the residence time).
The MRMAC performs packet-level
timestamp insertion using a read-modify-write method. When an outbound packet passes through
the TX PTP Insert logic, the existing value in the Correction Field is located using the
offset provided to the command port
The current timestamp, TS’egress, (provided by the PTP Timer
logic) is added to the value discovered in the PTP Correction field. The PTP packet
Timestamp field is left untouched.
The following table depicts the handling of the two PTP timestamp fields for each available timestamping mode. The Timestamp Field and Incoming Correction Field columns contain the values that should be seeded into outbound PTP frames by the user logic. The Outgoing Correction Field column is what is placed into the outbound Correction Field by the MRMAC logic.
|Mode||Timestamp Field||Incoming Correction Field||Outgoing Correction Field|
|Transparent||TSorig||CFingress - TS'ingress||CFingress - TS'ingress + TS'egress|
|Ordinary/Boundary||TScurr||-TS'curr||- TS'curr + TS'egress|
From this table, it is apparent that the MRMAC logic does not need to be aware of the selected timestamp mode, as it behaves the same way regardless of the selected mode. The user logic is responsible for setting appropriate initial timestamp values in both the Timestamp and Correction fields of outbound PTP packets.
MRMAC supports different modes to handle wraparound or saturation in the outgoing Correction Field when adding TS’egress would cause an overflow. Setting ctl_tx_ptp_sat_enable=0 will cause the result to wrap around (0x7FFFFFFF_FFFFFFFF -> 0x80000000_00000000). Setting ctl_tx_ptp_sat_enable=1 will cause the result to saturate to maximum positive (0x7FFFFFFFF_FFFFFFFF). Wraparound or saturation is normally used to handle the condition when the incoming Correction Field is a large positive number and TS’egress is large enough to cause an overflow. However, if the TS'egress timestamp has wrapped around while TS’ingress/TS’curr hasn’t (MRMAC assumes TS'egress will be later in time than TS'ingress/TS'curr), this can also cause an overflow condition. MRMAC can detect and adjust for the wraparound by setting ctl_tx_ptp_sat_enable=2. To support this detection, extra information must be added to the incoming Correction Field. Bit 0 should be set to the value of bit 62 of TS’ingress/TS’curr. Bit 1 should be set to 1 for bourdary/ordinary clock mode, or when in transparent mode, set to 1 when ingress correction field bit [63:62] != 2’b01 (where bit 63 is the sign bit and bit 62 is the next MSB) If the result is still an actual overflow condition, the outgoing Correction Field is saturated. In this mode, bits [1:0] are cleared in the outgoing Correction Field.