1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00
myhdl/example/manual/ClkDriver.py

19 lines
339 B
Python
Raw Normal View History

2016-03-21 16:31:42 +01:00
from myhdl import block, delay, instance
@block
def ClkDriver(clk, period=20):
lowTime = int(period / 2)
highTime = period - lowTime
@instance
def drive_clk():
while True:
yield delay(lowTime)
clk.next = 1
yield delay(highTime)
clk.next = 0
return drive_clk