From 5bbdab1fd6b1ab54d92baba3867310bff44bc3c4 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 3 Aug 2012 22:09:23 +0200 Subject: [PATCH] tb/asmicon: concurrent reads and writes --- tb/asmicon/asmicon.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tb/asmicon/asmicon.py b/tb/asmicon/asmicon.py index c973e6f7a..415afe58c 100644 --- a/tb/asmicon/asmicon.py +++ b/tb/asmicon/asmicon.py @@ -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()