Source code for hwt.serializer.verilog.context

from hdlConvertorAst.to.verilog.constants import SIGNAL_TYPE


[docs]class SignalTypeSwap(): """ An object which is used as a context manager for signalType inside of :class:`hwt.serializer.verilog.serializer.ToHdlAstVerilog` """
[docs] def __init__(self, ctx, signalType: SIGNAL_TYPE): self.ctx = ctx self.signalType = signalType
def __enter__(self): self.orig = self.ctx.signalType self.ctx.signalType = self.signalType def __exit__(self, exc_type, exc_val, exc_tb): self.ctx.signalType = self.orig