From c1041b9a5f3c38d1d1a3f8c46c54428153dcffdb Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 8 Dec 2011 23:06:04 +0100 Subject: [PATCH] simplebus: export GetSigName function --- migen/bus/simple.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/migen/bus/simple.py b/migen/bus/simple.py index fdf3fb71..5b578f97 100644 --- a/migen/bus/simple.py +++ b/migen/bus/simple.py @@ -1,5 +1,12 @@ from migen.fhdl import structure as f +def GetSigName(signal, slave): + if signal[0] ^ slave: + suffix = "_o" + else: + suffix = "_i" + return signal[1] + suffix + # desc is a list of tuples, each made up of: # 0) boolean: "master to slave" # 1) string: name @@ -7,13 +14,9 @@ from migen.fhdl import structure as f class Simple(): def __init__(self, desc, slave, name): for signal in desc: - if signal[0] ^ slave: - suffix = "_o" - else: - suffix = "_i" modules = self.__module__.split('.') busname = modules[len(modules)-1] if name: busname += "_" + name - signame = signal[1]+suffix + signame = GetSigName(signal, slave) setattr(self, signame, f.Signal(f.BV(signal[2]), busname + "_" + signame)) -- 2.30.2