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
def my_generator():
for x in range(100):
def my_generator_r():
for x in range(50):
t = TRead(x)
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():
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()
logger = DFILogger(dut.dfi)
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() + \
Fragment(sim=[end_simulation])
sim = Simulator(fragment, Runner(), TopLevel("my.vcd"))
sim.run()
sim.run(700)
main()