mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
19 lines
339 B
Python
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
|