From: whitequark Date: Mon, 6 Jul 2020 16:01:49 +0000 (+0000) Subject: Remove everything deprecated in nmigen 0.2. X-Git-Tag: 24jan2021_ls180~36 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=23758e30bc5721b6a7e303caa4a8ae16c4e08c89;p=nmigen.git Remove everything deprecated in nmigen 0.2. --- diff --git a/nmigen/back/pysim.py b/nmigen/back/pysim.py index fb651e4..c27ee00 100644 --- a/nmigen/back/pysim.py +++ b/nmigen/back/pysim.py @@ -915,28 +915,17 @@ class _WaveformContextManager: class Simulator: - def __init__(self, fragment, **kwargs): + def __init__(self, fragment): self._state = _SimulatorState() self._signal_names = SignalDict() self._fragment = Fragment.get(fragment, platform=None).prepare() self._processes = _FragmentCompiler(self._state, self._signal_names)(self._fragment) - if kwargs: # :nocov: - # TODO(nmigen-0.3): remove - self._state.start_waveform(_VCDWaveformWriter(self._signal_names, **kwargs)) self._clocked = set() def _check_process(self, process): if not (inspect.isgeneratorfunction(process) or inspect.iscoroutinefunction(process)): - if inspect.isgenerator(process) or inspect.iscoroutine(process): - warnings.warn("instead of generators, use generator functions as processes; " - "this allows the simulator to be repeatedly reset", - DeprecationWarning, stacklevel=3) - def wrapper(): - yield from process - return wrapper - else: - raise TypeError("Cannot add a process {!r} because it is not a generator function" - .format(process)) + raise TypeError("Cannot add a process {!r} because it is not a generator function" + .format(process)) return process def _add_coroutine_process(self, process, *, default_cmd): @@ -1107,13 +1096,3 @@ class Simulator: waveform_writer = _VCDWaveformWriter(self._signal_names, vcd_file=vcd_file, gtkw_file=gtkw_file, traces=traces) return _WaveformContextManager(self._state, waveform_writer) - - # TODO(nmigen-0.3): remove - @deprecated("instead of `with Simulator(fragment, ...) as sim:`, use " - "`sim = Simulator(fragment); with sim.write_vcd(...):`") - def __enter__(self): # :nocov: - return self - - # TODO(nmigen-0.3): remove - def __exit__(self, *args): # :nocov: - self._state.finish_waveform() diff --git a/nmigen/test/test_sim.py b/nmigen/test/test_sim.py index 8f48207..adc6c26 100644 --- a/nmigen/test/test_sim.py +++ b/nmigen/test/test_sim.py @@ -547,9 +547,8 @@ class SimulatorIntegrationTestCase(FHDLTestCase): def test_add_process_wrong_generator(self): with self.assertSimulation(Module()) as sim: - with self.assertWarns(DeprecationWarning, - msg="instead of generators, use generator functions as processes; " - "this allows the simulator to be repeatedly reset"): + with self.assertRaisesRegex(TypeError, + r"^Cannot add a process <.+?> because it is not a generator function$"): def process(): yield Delay() sim.add_process(process())