The invention discloses a CPLD-based
clock counting method and device, and a medium. The method comprises the following steps: acquiring an event duration of a CPLD, and setting
layers representing counting cycles according to the event duration, wherein the
layers at least comprise two
layers, the lowest layer represents a
system cycle, durations of the counting cycles are positively related to layer levels, and the counting cycle represented by a higher layer is an integer multiple of the counting cycle represented by a lower layer; starting counting by using the counting cycle represented by the lowest of the layers as a
current cycle, and using a target counting cycle represented by a next layer as the
current cycle to continue the counting when a counting duration reaches the target counting cycle, until the
current cycle is identical to the counting cycle represented by the highest of the layers; and continuing the counting according to the current cycle to reach the event duration. Therefore, the method provided by the invention has the beneficial effect that the overall work efficiency of the CPLD during
clock counting is relatively improved. Moreover, the invention furtherprovides the CPLD-based
clock counting device, and the medium, which achieve the above beneficial effect.