2016-03-21 16:31:42 +01:00
|
|
|
from myhdl import block, Signal, delay, always, now
|
2003-01-30 23:04:36 +00:00
|
|
|
|
2016-03-21 16:31:42 +01:00
|
|
|
@block
|
|
|
|
def HelloWorld():
|
2003-01-30 23:04:36 +00:00
|
|
|
|
2016-03-21 16:31:42 +01:00
|
|
|
clk = Signal(0)
|
2005-12-11 16:30:52 +00:00
|
|
|
|
2016-03-21 16:31:42 +01:00
|
|
|
@always(delay(10))
|
|
|
|
def drive_clk():
|
2005-12-09 17:01:07 +00:00
|
|
|
clk.next = not clk
|
2003-01-30 23:04:36 +00:00
|
|
|
|
2005-12-09 17:01:07 +00:00
|
|
|
@always(clk.posedge)
|
2016-03-21 16:31:42 +01:00
|
|
|
def say_hello():
|
2016-05-11 12:08:15 +02:00
|
|
|
print("%s Hello World!" % now())
|
2003-01-30 23:04:36 +00:00
|
|
|
|
2016-03-21 16:31:42 +01:00
|
|
|
return drive_clk, say_hello
|
2005-12-09 17:01:07 +00:00
|
|
|
|
|
|
|
|
2016-03-21 16:31:42 +01:00
|
|
|
inst = HelloWorld()
|
|
|
|
inst.run_sim(50)
|