cores/pwm: Simplify pwm generation and avoid potential glitch on reset.

This commit is contained in:
Florent Kermarrec 2023-06-19 23:02:50 +02:00
parent 298ec03dae
commit 7b5515ced4

View file

@ -47,14 +47,7 @@ class PWM(Module, AutoCSR):
]
# PWM Width logic.
sync += [
pwm.eq(0),
If(self.enable & ~self.reset,
If(counter < self.width,
pwm.eq(1)
)
)
]
sync += pwm.eq(self.enable & (counter < self.width))
if with_csr:
self.add_csr(clock_domain)