Remove everything deprecated in nmigen 0.2.
This commit is contained in:
parent
3a4576e033
commit
23758e30bc
|
@ -915,26 +915,15 @@ class _WaveformContextManager:
|
||||||
|
|
||||||
|
|
||||||
class Simulator:
|
class Simulator:
|
||||||
def __init__(self, fragment, **kwargs):
|
def __init__(self, fragment):
|
||||||
self._state = _SimulatorState()
|
self._state = _SimulatorState()
|
||||||
self._signal_names = SignalDict()
|
self._signal_names = SignalDict()
|
||||||
self._fragment = Fragment.get(fragment, platform=None).prepare()
|
self._fragment = Fragment.get(fragment, platform=None).prepare()
|
||||||
self._processes = _FragmentCompiler(self._state, self._signal_names)(self._fragment)
|
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()
|
self._clocked = set()
|
||||||
|
|
||||||
def _check_process(self, process):
|
def _check_process(self, process):
|
||||||
if not (inspect.isgeneratorfunction(process) or inspect.iscoroutinefunction(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"
|
raise TypeError("Cannot add a process {!r} because it is not a generator function"
|
||||||
.format(process))
|
.format(process))
|
||||||
return process
|
return process
|
||||||
|
@ -1107,13 +1096,3 @@ class Simulator:
|
||||||
waveform_writer = _VCDWaveformWriter(self._signal_names,
|
waveform_writer = _VCDWaveformWriter(self._signal_names,
|
||||||
vcd_file=vcd_file, gtkw_file=gtkw_file, traces=traces)
|
vcd_file=vcd_file, gtkw_file=gtkw_file, traces=traces)
|
||||||
return _WaveformContextManager(self._state, waveform_writer)
|
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()
|
|
||||||
|
|
|
@ -547,9 +547,8 @@ class SimulatorIntegrationTestCase(FHDLTestCase):
|
||||||
|
|
||||||
def test_add_process_wrong_generator(self):
|
def test_add_process_wrong_generator(self):
|
||||||
with self.assertSimulation(Module()) as sim:
|
with self.assertSimulation(Module()) as sim:
|
||||||
with self.assertWarns(DeprecationWarning,
|
with self.assertRaisesRegex(TypeError,
|
||||||
msg="instead of generators, use generator functions as processes; "
|
r"^Cannot add a process <.+?> because it is not a generator function$"):
|
||||||
"this allows the simulator to be repeatedly reset"):
|
|
||||||
def process():
|
def process():
|
||||||
yield Delay()
|
yield Delay()
|
||||||
sim.add_process(process())
|
sim.add_process(process())
|
||||||
|
|
Loading…
Reference in a new issue