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

19 lines
339 B
Python

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