tb/asmicon: concurrent reads and writes
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 3 Aug 2012 20:09:23 +0000 (22:09 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 3 Aug 2012 20:09:23 +0000 (22:09 +0200)
tb/asmicon/asmicon.py

index c973e6f7a4513b645437e97e27e4ce8f9941b80a..415afe58ce2b466246b96ff45dc7d8e0d5a99905 100644 (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()