CPLD example: PWM Generator

From DP

This circuit is an 8 bit PWM generator. The desired PWM Duty Cycle is latched and when the counter output is zero the PWM output is set high. When the latched PWM Duty Cycle and the counter are equal the PWM output is set low.