use new lasmibus.Crossbar master API
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 23 Nov 2013 16:51:41 +0000 (17:51 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 23 Nov 2013 16:51:41 +0000 (17:51 +0100)
tb/lasmicon/lasmicon.py
tb/lasmicon/lasmicon_df.py
tb/lasmicon/lasmicon_wb.py
top.py

index 6915693801e68fbec30b17f22c25e418c1e88c5d..7ce009a0533c3265114b0f04a865a4e42263ca7c 100644 (file)
@@ -27,11 +27,12 @@ def my_generator(n):
 class TB(Module):
        def __init__(self):
                self.submodules.dut = LASMIcon(sdram_phy, sdram_geom, sdram_timing)
-               self.submodules.xbar = lasmibus.Crossbar([self.dut.lasmic], 6, self.dut.nrowbits)
+               self.submodules.xbar = lasmibus.Crossbar([self.dut.lasmic], self.dut.nrowbits)
                self.submodules.logger = DFILogger(self.dut.dfi)
 
+               masters = [self.xbar.get_master() for i in range(6)]
                self.initiators = [Initiator(my_generator(n), master)
-                       for n, master in enumerate(self.xbar.masters)]
+                       for n, master in enumerate(masters)]
                self.submodules += self.initiators
 
        def do_simulation(self, s):
index c34c8fad487e63ce05d2a9cf4d6da69593b73ddc..512c942499976cefc4dbe5d47e13a3a2d49d33a0 100644 (file)
@@ -10,10 +10,10 @@ from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
 class TB(Module):
        def __init__(self):
                self.submodules.ctler = LASMIcon(sdram_phy, sdram_geom, sdram_timing)
-               # FIXME: remove dummy master
-               self.submodules.xbar = lasmibus.Crossbar([self.ctler.lasmic], 2, self.ctler.nrowbits)
+               self.submodules.xbar = lasmibus.Crossbar([self.ctler.lasmic], self.ctler.nrowbits)
+               self.xbar.get_master() # FIXME: remove dummy master
                self.submodules.logger = DFILogger(self.ctler.dfi)
-               self.submodules.writer = dma_lasmi.Writer(self.xbar.masters[0])
+               self.submodules.writer = dma_lasmi.Writer(self.xbar.get_master())
 
                self.comb += self.writer.address_data.stb.eq(1)
                pl = self.writer.address_data.payload
index ad2f429bcf6a3c8f13b593719429f27bd35591b2..89b5fa33459e4295d6152090b4dc5db58001324c 100644 (file)
@@ -26,10 +26,10 @@ def my_generator():
 class TB(Module):
        def __init__(self):
                self.submodules.ctler = LASMIcon(sdram_phy, sdram_geom, sdram_timing)
-               # FIXME: remove dummy master
-               self.submodules.xbar = lasmibus.Crossbar([self.ctler.lasmic], 2, self.ctler.nrowbits)
+               self.submodules.xbar = lasmibus.Crossbar([self.ctler.lasmic], self.ctler.nrowbits)
+               self.xbar.get_master() # FIXME: remove dummy master
                self.submodules.logger = DFILogger(self.ctler.dfi)
-               self.submodules.bridge = wishbone2lasmi.WB2LASMI(l2_size//4, self.xbar.masters[0])
+               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)
 
diff --git a/top.py b/top.py
index 321b87c8929adc1e941c0197e6d48a754c871ecc..50a6502be2a91b54c3e27fd6c2e24a70db3c39a4 100644 (file)
--- a/top.py
+++ b/top.py
@@ -105,24 +105,14 @@ class SoC(Module):
                self.submodules.lasmicon = lasmicon.LASMIcon(self.ddrphy.phy_settings, sdram_geom, sdram_timing)
                self.submodules.dficon1 = dfi.Interconnect(self.lasmicon.dfi, self.dfii.slave)
 
-               n_lasmims = 1 # wishbone bridging
+               self.submodules.lasmixbar = lasmibus.Crossbar([self.lasmicon.lasmic], self.lasmicon.nrowbits)
+               lasmim_wb = self.lasmixbar.get_master()
                if platform_name == "mixxeo":
-                       n_lasmims += 4 # framebuffer (2-channel mixing) + 2 DVI samplers
+                       lasmim_fb0, lasmim_fb1, lasmim_dvi0, lasmim_dvi1 = (self.lasmixbar.get_master() for i in range(4))
                if platform_name == "m1":
-                       n_lasmims += 1 # framebuffer (single channel)
+                       lasmim_fb = self.lasmixbar.get_master()
                if with_memtest:
-                       n_lasmims += 2 # writer + reader
-               self.submodules.lasmixbar = lasmibus.Crossbar([self.lasmicon.lasmic], n_lasmims, self.lasmicon.nrowbits)
-
-               lasmims = list(self.lasmixbar.masters)
-               lasmim_wb = lasmims.pop()
-               if platform_name == "mixxeo":
-                       lasmim_fb0, lasmim_fb1, lasmim_dvi0, lasmim_dvi1 = (lasmims.pop() for i in range(4))
-               if platform_name == "m1":
-                       lasmim_fb = lasmims.pop()
-               if with_memtest:
-                       lasmim_mtw, lasmim_mtr = lasmims.pop(), lasmims.pop()
-               assert(not lasmims)
+                       lasmim_mtw, lasmim_mtr = self.lasmixbar.get_master(), self.lasmixbar.get_master()
 
                #
                # WISHBONE