Named buses
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 8 Dec 2011 18:16:08 +0000 (19:16 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 8 Dec 2011 18:16:08 +0000 (19:16 +0100)
migen/bus/csr.py
migen/bus/simple.py
migen/bus/wishbone.py

index f4fdcad0a002bb7087c870fcb770b86a761fd8e4..297bd4e4f6d14413ebdc2507a55e30b2c0e35f6b 100644 (file)
@@ -9,12 +9,12 @@ _desc = [
 ]
 
 class Master(Simple):
-       def __init__(self):
-               Simple.__init__(self, _desc, False)
+       def __init__(self, name=""):
+               Simple.__init__(self, _desc, False, name)
 
 class Slave(Simple):
-       def __init__(self):
-               Simple.__init__(self, _desc, True)
+       def __init__(self, name=""):
+               Simple.__init__(self, _desc, True, name)
 
 class Interconnect:
        def __init__(self, master, slaves):
index 8ca279922d255a5d9737accd5bcf9afeb4739f68..fdf3fb714f75e084971d10db1434553d5090051c 100644 (file)
@@ -5,7 +5,7 @@ from migen.fhdl import structure as f
 # 1) string: name
 # 2) int: width
 class Simple():
-       def __init__(self, desc, slave):
+       def __init__(self, desc, slave, name):
                for signal in desc:
                        if signal[0] ^ slave:
                                suffix = "_o"
@@ -13,5 +13,7 @@ class Simple():
                                suffix = "_i"
                        modules = self.__module__.split('.')
                        busname = modules[len(modules)-1]
+                       if name:
+                               busname += "_" + name
                        signame = signal[1]+suffix
-                       setattr(self, signame, f.Signal(f.BV(signal[2]), busname+"_"+signame))
+                       setattr(self, signame, f.Signal(f.BV(signal[2]), busname + "_" + signame))
index 05deddee8ec5e04f51819b160ab5050720f68707..b92d5c59983c52b67a4d040a21d5bfb3eaa916a1 100644 (file)
@@ -16,9 +16,9 @@ _desc = [
 ]
 
 class Master(Simple):
-       def __init__(self):
-               Simple.__init__(self, _desc, False)
+       def __init__(self, name=""):
+               Simple.__init__(self, _desc, False, name)
 
 class Slave(Simple):
-       def __init__(self):
-               Simple.__init__(self, _desc, True)
+       def __init__(self, name=""):
+               Simple.__init__(self, _desc, True, name)