Updated Clock to cycle given number of times.
@@ -78,9 +78,18 @@ class Clock(BaseClock):
this.
Args:
- cycles (int, optional): Not Implemented. Defaults to 0.
+ cycles (int, optional): Cycle clock ``cycles`` number of times.
+ Defaults to 0, meaning will cycle forever.
"""
t = Timer(self.half_period)
+ if cycles > 0:
+ while cycles:
+ self.signal <= 1
+ yield t
+ self.signal <= 0
+ yield t
+ cycles -= 1
+ else:
while True:
self.signal <= 1
yield t
