The functionality of the Core Independent Ultrasonic Distance Measurement application is centered around the Configurable Custom Logic (CCL) module. It enables input MUXing to two Lookup-Tables (LUTs) with configurable logic. In this application, one LUT is used to control the transmit line of the ultrasonic transducer, and the other is used to filter the receive line. "Time of flight" can be measured by feeding both LUT outputs into a sequential control block, specifically an SR latch. The result is that the output of the latch indicates "time of flight". This setup can be seen in the figure below.

Figure 1. Ultrasonic Distance Measurement using Configurable Custom Logic Peripheral
The corresponding timing functionality is depicted in the figure below. The first three lines correspond to control of the ultrasonic transducer transmit line: The result is a specifically timed ultrasonic transmission at the PWM frequency. The initial edge of the output will also "reset" the SR latch, and start the timer/counter type D capture counter (the beginning of "time of flight").
The next three lines correspond to the control of the ultrasonic transducer receive line: When the reflected signal is detected by the analog comparator, the first edge will "set" the SR latch, and timer counter type D capture will occur, thereby effectively measuring "time of flight" (SR Latch line in the figure).
Figure 2. Ultrasonic Distance Measurement Timing Diagram