From 98a9744be41d84c98742f7b63cbe12870ad2733a Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 22 Dec 2018 06:03:38 +0000 Subject: [PATCH] =?utf8?q?hdl.xfrm:=20Abstract*Transformer=E2=86=92*Visito?= =?utf8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- nmigen/back/pysim.py | 8 ++++---- nmigen/hdl/xfrm.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nmigen/back/pysim.py b/nmigen/back/pysim.py index 87fef0c..dd8f24a 100644 --- a/nmigen/back/pysim.py +++ b/nmigen/back/pysim.py @@ -7,7 +7,7 @@ from vcd.gtkw import GTKWSave from ..tools import flatten from ..hdl.ast import * -from ..hdl.xfrm import AbstractValueTransformer, AbstractStatementTransformer +from ..hdl.xfrm import ValueVisitor, StatementVisitor __all__ = ["Simulator", "Delay", "Tick", "Passive", "DeadlineError"] @@ -71,7 +71,7 @@ class _State: normalize = Const.normalize -class _RHSValueCompiler(AbstractValueTransformer): +class _RHSValueCompiler(ValueVisitor): def __init__(self, signal_slots, sensitivity=None, mode="rhs"): self.signal_slots = signal_slots self.sensitivity = sensitivity @@ -201,7 +201,7 @@ class _RHSValueCompiler(AbstractValueTransformer): return eval -class _LHSValueCompiler(AbstractValueTransformer): +class _LHSValueCompiler(ValueVisitor): def __init__(self, signal_slots, rhs_compiler): self.signal_slots = signal_slots self.rhs_compiler = rhs_compiler @@ -275,7 +275,7 @@ class _LHSValueCompiler(AbstractValueTransformer): return eval -class _StatementCompiler(AbstractStatementTransformer): +class _StatementCompiler(StatementVisitor): def __init__(self, signal_slots): self.sensitivity = SignalSet() self.rrhs_compiler = _RHSValueCompiler(signal_slots, self.sensitivity, mode="rhs") diff --git a/nmigen/hdl/xfrm.py b/nmigen/hdl/xfrm.py index 3aa10cb..31525d9 100644 --- a/nmigen/hdl/xfrm.py +++ b/nmigen/hdl/xfrm.py @@ -9,13 +9,13 @@ from .cd import * from .ir import * -__all__ = ["AbstractValueTransformer", "ValueTransformer", - "AbstractStatementTransformer", "StatementTransformer", +__all__ = ["ValueVisitor", "ValueTransformer", + "StatementVisitor", "StatementTransformer", "FragmentTransformer", "DomainRenamer", "DomainLowerer", "ResetInserter", "CEInserter"] -class AbstractValueTransformer(metaclass=ABCMeta): +class ValueVisitor(metaclass=ABCMeta): @abstractmethod def on_Const(self, value): pass # :nocov: @@ -91,7 +91,7 @@ class AbstractValueTransformer(metaclass=ABCMeta): return self.on_value(value) -class ValueTransformer(AbstractValueTransformer): +class ValueTransformer(ValueVisitor): def on_Const(self, value): return value @@ -124,7 +124,7 @@ class ValueTransformer(AbstractValueTransformer): self.on_value(value.index)) -class AbstractStatementTransformer(metaclass=ABCMeta): +class StatementVisitor(metaclass=ABCMeta): @abstractmethod def on_Assign(self, stmt): pass # :nocov: @@ -155,7 +155,7 @@ class AbstractStatementTransformer(metaclass=ABCMeta): return self.on_statement(value) -class StatementTransformer(AbstractStatementTransformer): +class StatementTransformer(StatementVisitor): def on_value(self, value): return value -- 2.30.2