1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00
myhdl/example/manual/hello2.py
2016-05-11 21:02:34 +02:00

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)