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

24 lines
435 B
Python
Raw Normal View History

2003-01-30 23:04:36 +00:00
from __future__ import generators
from myhdl import Signal, delay, posedge, now, Simulation
clk = Signal(0)
def clkGen():
while 1:
yield delay(10)
clk.next = 1
yield delay(10)
clk.next = 0
def sayHello():
while 1:
yield posedge(clk)
print "%s Hello World!" % now()
2003-06-30 14:24:23 +00:00
def main():
sim = Simulation(clkGen(), sayHello())
sim.run(50)
2003-01-30 23:04:36 +00:00
2003-06-30 14:24:23 +00:00
if __name__ == '__main__':
main()