From: Sebastien Bourdeauducq Date: Sun, 10 Mar 2013 18:47:21 +0000 (+0100) Subject: Fix Register name conflict between Pytholite and Bank X-Git-Tag: 24jan2021_ls180~2099^2~662 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b04275718748023518a7486aa28322804ee11570;p=litex.git Fix Register name conflict between Pytholite and Bank --- diff --git a/migen/bank/description.py b/migen/bank/description.py index 016d830c..106c5dd5 100644 --- a/migen/bank/description.py +++ b/migen/bank/description.py @@ -3,12 +3,12 @@ from copy import copy from migen.fhdl.structure import * from migen.fhdl.specials import Memory -class Register(HUID): +class _Register(HUID): pass -class RegisterRaw(Register): +class RegisterRaw(_Register): def __init__(self, name, size=1): - Register.__init__(self) + _Register.__init__(self) self.name = name self.size = size self.re = Signal() @@ -34,9 +34,9 @@ class Field: self.w = Signal(self.size) self.we = Signal() -class RegisterFields(Register): +class RegisterFields(_Register): def __init__(self, name, fields): - Register.__init__(self) + _Register.__init__(self) self.name = name self.fields = fields @@ -74,7 +74,7 @@ class AutoReg: def get_registers(self): r = [] for k, v in self.__dict__.items(): - if isinstance(v, Register): + if isinstance(v, _Register): r.append(v) elif hasattr(v, "get_registers") and callable(v.get_registers): r += regprefix(k + "_", v.get_registers()) diff --git a/migen/bank/eventmanager.py b/migen/bank/eventmanager.py index 8de35b0a..c85ed6b2 100644 --- a/migen/bank/eventmanager.py +++ b/migen/bank/eventmanager.py @@ -3,16 +3,16 @@ from migen.fhdl.module import Module from migen.bank.description import * from migen.genlib.misc import optree -class EventSource(HUID): +class _EventSource(HUID): def __init__(self): HUID.__init__(self) self.trigger = Signal() self.pending = Signal() -class EventSourcePulse(EventSource): +class EventSourcePulse(_EventSource): pass -class EventSourceLevel(EventSource): +class EventSourceLevel(_EventSource): pass class EventManager(Module, AutoReg): @@ -20,7 +20,7 @@ class EventManager(Module, AutoReg): self.irq = Signal() def do_finalize(self): - sources_u = [v for v in self.__dict__.values() if isinstance(v, EventSource)] + sources_u = [v for v in self.__dict__.values() if isinstance(v, _EventSource)] sources = sorted(sources_u, key=lambda x: x.huid) n = len(sources) self.status = RegisterRaw("status", n) @@ -60,6 +60,6 @@ class EventManager(Module, AutoReg): self.comb += self.irq.eq(optree("|", irqs)) def __setattr__(self, name, value): - if isinstance(value, EventSource) and self.finalized: + if isinstance(value, _EventSource) and self.finalized: raise FinalizeError object.__setattr__(self, name, value)