tb/asmicon: concurrent reads and writes

This commit is contained in:
Sebastien Bourdeauducq 2012-08-03 22:09:23 +02:00
parent bf8f387324
commit 5bbdab1fd6
1 changed files with 14 additions and 6 deletions

View File

@ -7,25 +7,33 @@ from milkymist.asmicon import *
from common import sdram_phy, sdram_geom, sdram_timing, DFILogger from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
def my_generator(): def my_generator_r():
for x in range(100): for x in range(50):
t = TRead(x) t = TRead(x)
yield t yield t
print("reads done")
def my_generator_w():
for x in range(50):
t = TWrite(x, x)
yield t
print("writes done")
def main(): def main():
dut = ASMIcon(sdram_phy, sdram_geom, sdram_timing) dut = ASMIcon(sdram_phy, sdram_geom, sdram_timing)
initiator = Initiator(dut.hub.get_port(), my_generator()) initiator1 = Initiator(dut.hub.get_port(), my_generator_r())
initiator2 = Initiator(dut.hub.get_port(), my_generator_w())
dut.finalize() dut.finalize()
logger = DFILogger(dut.dfi) logger = DFILogger(dut.dfi)
def end_simulation(s): def end_simulation(s):
s.interrupt = initiator.done s.interrupt = initiator1.done and initiator2.done
fragment = dut.get_fragment() + initiator.get_fragment() + \ fragment = dut.get_fragment() + initiator1.get_fragment() + initiator2.get_fragment() + \
logger.get_fragment() + \ logger.get_fragment() + \
Fragment(sim=[end_simulation]) Fragment(sim=[end_simulation])
sim = Simulator(fragment, Runner(), TopLevel("my.vcd")) sim = Simulator(fragment, Runner(), TopLevel("my.vcd"))
sim.run() sim.run(700)
main() main()