1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00
2003-05-25 12:27:09 +00:00

34 lines
670 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 ./tb_test.v "
os.system(cmd)
a = Signal(intbv(1))
b = Signal(intbv(2))
c = Signal(intbv(3))
cosim = Cosimulation("vvp -m ../myhdl.vpi tb_test", 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()