2012-04-01 17:23:45 -04:00
|
|
|
from migen.fhdl.structure import *
|
|
|
|
from migen.bus.asmibus import *
|
|
|
|
from migen.sim.generic import Simulator, TopLevel
|
|
|
|
|
|
|
|
from milkymist.asmicon import *
|
|
|
|
|
|
|
|
from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
|
|
|
|
|
2012-08-03 16:09:23 -04:00
|
|
|
def my_generator_r():
|
|
|
|
for x in range(50):
|
2012-04-01 17:23:45 -04:00
|
|
|
t = TRead(x)
|
|
|
|
yield t
|
2012-08-03 16:09:23 -04:00
|
|
|
print("reads done")
|
|
|
|
|
|
|
|
def my_generator_w():
|
|
|
|
for x in range(50):
|
|
|
|
t = TWrite(x, x)
|
|
|
|
yield t
|
|
|
|
print("writes done")
|
2012-04-01 17:23:45 -04:00
|
|
|
|
|
|
|
def main():
|
|
|
|
dut = ASMIcon(sdram_phy, sdram_geom, sdram_timing)
|
2012-11-17 13:43:30 -05:00
|
|
|
initiator1 = Initiator(my_generator_r(), dut.hub.get_port())
|
|
|
|
initiator2 = Initiator(my_generator_w(), dut.hub.get_port())
|
2012-04-01 17:23:45 -04:00
|
|
|
dut.finalize()
|
|
|
|
|
|
|
|
logger = DFILogger(dut.dfi)
|
|
|
|
|
|
|
|
def end_simulation(s):
|
2012-08-03 16:09:23 -04:00
|
|
|
s.interrupt = initiator1.done and initiator2.done
|
2012-04-01 17:23:45 -04:00
|
|
|
|
2012-08-03 16:09:23 -04:00
|
|
|
fragment = dut.get_fragment() + initiator1.get_fragment() + initiator2.get_fragment() + \
|
2012-04-01 17:23:45 -04:00
|
|
|
logger.get_fragment() + \
|
|
|
|
Fragment(sim=[end_simulation])
|
2013-02-09 11:09:29 -05:00
|
|
|
sim = Simulator(fragment, TopLevel("my.vcd"))
|
2012-08-03 16:09:23 -04:00
|
|
|
sim.run(700)
|
2012-04-01 17:23:45 -04:00
|
|
|
|
|
|
|
main()
|