2013-07-15 11:45:55 -04:00
|
|
|
from migen.fhdl.std import *
|
2015-02-27 10:55:27 -05:00
|
|
|
from migen.bus import wishbone
|
2013-07-15 11:45:55 -04:00
|
|
|
from migen.bus.transactions import *
|
2014-01-28 07:50:01 -05:00
|
|
|
from migen.sim.generic import run_simulation
|
2013-07-15 11:45:55 -04:00
|
|
|
|
2015-09-22 12:35:02 -04:00
|
|
|
from misoc.mem.sdram.core import lasmibus
|
|
|
|
from misoc.mem.sdram.core.lasmicon import *
|
|
|
|
from misoc.mem.sdram.frontend import wishbone2lasmi
|
2013-07-15 11:45:55 -04:00
|
|
|
|
|
|
|
from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
|
|
|
|
|
2015-04-13 11:16:12 -04:00
|
|
|
l2_size = 8192 # in bytes
|
2013-07-15 11:45:55 -04:00
|
|
|
|
2015-04-13 10:47:22 -04:00
|
|
|
|
2013-07-15 11:45:55 -04:00
|
|
|
def my_generator():
|
2015-04-13 10:19:55 -04:00
|
|
|
for x in range(20):
|
|
|
|
t = TWrite(x, x)
|
|
|
|
yield t
|
|
|
|
print(str(t) + " delay=" + str(t.latency))
|
|
|
|
for x in range(20):
|
|
|
|
t = TRead(x)
|
|
|
|
yield t
|
|
|
|
print(str(t) + " delay=" + str(t.latency))
|
|
|
|
for x in range(20):
|
|
|
|
t = TRead(x+l2_size//4)
|
|
|
|
yield t
|
|
|
|
print(str(t) + " delay=" + str(t.latency))
|
2013-07-15 11:45:55 -04:00
|
|
|
|
2015-04-13 10:47:22 -04:00
|
|
|
|
2013-07-15 11:45:55 -04:00
|
|
|
class TB(Module):
|
2015-04-13 10:19:55 -04:00
|
|
|
def __init__(self):
|
|
|
|
self.submodules.ctler = LASMIcon(sdram_phy, sdram_geom, sdram_timing)
|
|
|
|
self.submodules.xbar = lasmibus.Crossbar([self.ctler.lasmic], self.ctler.nrowbits)
|
|
|
|
self.submodules.logger = DFILogger(self.ctler.dfi)
|
|
|
|
self.submodules.bridge = wishbone2lasmi.WB2LASMI(l2_size//4, self.xbar.get_master())
|
|
|
|
self.submodules.initiator = wishbone.Initiator(my_generator())
|
|
|
|
self.submodules.conn = wishbone.InterconnectPointToPoint(self.initiator.bus, self.bridge.wishbone)
|
2013-07-15 11:45:55 -04:00
|
|
|
|
2014-01-28 07:50:01 -05:00
|
|
|
if __name__ == "__main__":
|
2015-04-13 10:19:55 -04:00
|
|
|
run_simulation(TB(), vcd_name="my.vcd")
|