1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00
myhdl/example/manual/hello1.py

24 lines
337 B
Python
Raw Normal View History

2005-12-05 12:22:35 +00:00
from myhdl import Signal, delay, always, now, Simulation
2003-02-04 22:32:10 +00:00
2005-12-06 22:14:55 +00:00
def HelloWorld():
2005-12-11 16:30:52 +00:00
interval = delay(10)
2005-12-05 12:22:35 +00:00
2005-12-11 16:30:52 +00:00
@always(interval)
2005-12-06 22:14:55 +00:00
def sayHello():
2003-02-04 22:32:10 +00:00
print "%s Hello World!" % now()
2005-12-06 22:14:55 +00:00
return sayHello
2005-12-05 12:22:35 +00:00
2003-06-30 14:24:23 +00:00
def main():
2005-12-06 22:14:55 +00:00
inst = HelloWorld()
2005-12-05 16:25:46 +00:00
sim = Simulation(inst)
2003-06-30 14:24:23 +00:00
sim.run(30)
2005-12-05 12:22:35 +00:00
2003-06-30 14:24:23 +00:00
if __name__ == '__main__':
main()
2003-02-04 22:32:10 +00:00