mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
21 lines
331 B
Python
21 lines
331 B
Python
from myhdl import block, Signal, delay, always, now
|
|
|
|
@block
|
|
def HelloWorld():
|
|
|
|
clk = Signal(0)
|
|
|
|
@always(delay(10))
|
|
def drive_clk():
|
|
clk.next = not clk
|
|
|
|
@always(clk.posedge)
|
|
def say_hello():
|
|
print("%s Hello World!" % now())
|
|
|
|
return drive_clk, say_hello
|
|
|
|
|
|
inst = HelloWorld()
|
|
inst.run_sim(50)
|