Remove everything deprecated in nmigen 0.2.
authorwhitequark <whitequark@whitequark.org>
Mon, 6 Jul 2020 16:01:49 +0000 (16:01 +0000)
committerwhitequark <whitequark@whitequark.org>
Tue, 7 Jul 2020 03:38:39 +0000 (03:38 +0000)
nmigen/back/pysim.py
nmigen/test/test_sim.py

index fb651e4d04d939cd7fd74db3d3d9773dbf62cd30..c27ee00d8b90912bbda9ca2111a4d59b3b0bb5bf 100644 (file)
@@ -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()
index 8f48207dd86119699d6ccd44bfd8a3b71792f3fc..adc6c260f00ee450e536050394d591c55ddb3af1 100644 (file)
@@ -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())