Fix Register name conflict between Pytholite and Bank
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 10 Mar 2013 18:47:21 +0000 (19:47 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 10 Mar 2013 18:47:21 +0000 (19:47 +0100)
migen/bank/description.py
migen/bank/eventmanager.py

index 016d830c70795cde931d07aa28be9f70f8665644..106c5dd56b57a92a470daaf556637e72e2ca372b 100644 (file)
@@ -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())
index 8de35b0ab1370cdcd51a5b522a6671a5155631c1..c85ed6b2f3e835edce3504e145950dead3a8391c 100644 (file)
@@ -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)