Named buses
This commit is contained in:
parent
5720a51dad
commit
7c99e51b90
|
@ -9,12 +9,12 @@ _desc = [
|
||||||
]
|
]
|
||||||
|
|
||||||
class Master(Simple):
|
class Master(Simple):
|
||||||
def __init__(self):
|
def __init__(self, name=""):
|
||||||
Simple.__init__(self, _desc, False)
|
Simple.__init__(self, _desc, False, name)
|
||||||
|
|
||||||
class Slave(Simple):
|
class Slave(Simple):
|
||||||
def __init__(self):
|
def __init__(self, name=""):
|
||||||
Simple.__init__(self, _desc, True)
|
Simple.__init__(self, _desc, True, name)
|
||||||
|
|
||||||
class Interconnect:
|
class Interconnect:
|
||||||
def __init__(self, master, slaves):
|
def __init__(self, master, slaves):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from migen.fhdl import structure as f
|
||||||
# 1) string: name
|
# 1) string: name
|
||||||
# 2) int: width
|
# 2) int: width
|
||||||
class Simple():
|
class Simple():
|
||||||
def __init__(self, desc, slave):
|
def __init__(self, desc, slave, name):
|
||||||
for signal in desc:
|
for signal in desc:
|
||||||
if signal[0] ^ slave:
|
if signal[0] ^ slave:
|
||||||
suffix = "_o"
|
suffix = "_o"
|
||||||
|
@ -13,5 +13,7 @@ class Simple():
|
||||||
suffix = "_i"
|
suffix = "_i"
|
||||||
modules = self.__module__.split('.')
|
modules = self.__module__.split('.')
|
||||||
busname = modules[len(modules)-1]
|
busname = modules[len(modules)-1]
|
||||||
|
if name:
|
||||||
|
busname += "_" + name
|
||||||
signame = signal[1]+suffix
|
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))
|
||||||
|
|
|
@ -16,9 +16,9 @@ _desc = [
|
||||||
]
|
]
|
||||||
|
|
||||||
class Master(Simple):
|
class Master(Simple):
|
||||||
def __init__(self):
|
def __init__(self, name=""):
|
||||||
Simple.__init__(self, _desc, False)
|
Simple.__init__(self, _desc, False, name)
|
||||||
|
|
||||||
class Slave(Simple):
|
class Slave(Simple):
|
||||||
def __init__(self):
|
def __init__(self, name=""):
|
||||||
Simple.__init__(self, _desc, True)
|
Simple.__init__(self, _desc, True, name)
|
||||||
|
|
Loading…
Reference in New Issue