1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00
2005-10-03 15:49:36 +00:00

34 lines
677 B
Python

from __future__ import generators
from myhdl import Signal, Simulation, Cosimulation
from myhdl import delay, intbv, now
import os
cmd = "iverilog -o tb_test.o ./tb_test.v "
os.system(cmd)
a = Signal(intbv(1))
b = Signal(intbv(2))
c = Signal(intbv(3))
cosim = Cosimulation("vvp -v -m ../myhdl.vpi tb_test.o", a=a, b=b, c=c)
def stimulus(a, b):
for i in range(10):
yield delay(10)
# print "Python a=%s b=%s" % (a, b)
a.next = a + 1
b.next = b + 2
def response(c):
while 1:
yield c
print "Python: %s %s %s %s" % (now(), c, a, b)
sim = Simulation(stimulus(a=a, b=b), response(c=c), cosim)
sim.run()