back.pysim: simplify.
Compiled process names were never particularly useful (comments in the source would make more sense for debugging), and coroutine process names were actually source locations.
This commit is contained in:
parent
c9030eb3cd
commit
cee43f0de1
|
@ -175,10 +175,6 @@ class _Process:
|
||||||
def run(self):
|
def run(self):
|
||||||
raise NotImplementedError # :nocov:
|
raise NotImplementedError # :nocov:
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
raise NotImplementedError # :nocov:
|
|
||||||
|
|
||||||
|
|
||||||
class _SignalState:
|
class _SignalState:
|
||||||
__slots__ = ("signal", "curr", "next", "waiters", "pending")
|
__slots__ = ("signal", "curr", "next", "waiters", "pending")
|
||||||
|
@ -652,12 +648,11 @@ class _StatementCompiler(StatementVisitor, _Compiler):
|
||||||
|
|
||||||
|
|
||||||
class _CompiledProcess(_Process):
|
class _CompiledProcess(_Process):
|
||||||
__slots__ = ("state", "comb", "name", "run")
|
__slots__ = ("state", "comb", "run")
|
||||||
|
|
||||||
def __init__(self, state, *, comb, name):
|
def __init__(self, state, *, comb):
|
||||||
self.state = state
|
self.state = state
|
||||||
self.comb = comb
|
self.comb = comb
|
||||||
self.name = name
|
|
||||||
self.run = None # set by _FragmentCompiler
|
self.run = None # set by _FragmentCompiler
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
|
@ -683,8 +678,7 @@ class _FragmentCompiler:
|
||||||
|
|
||||||
for domain_name, domain_signals in fragment.drivers.items():
|
for domain_name, domain_signals in fragment.drivers.items():
|
||||||
domain_stmts = LHSGroupFilter(domain_signals)(fragment.statements)
|
domain_stmts = LHSGroupFilter(domain_signals)(fragment.statements)
|
||||||
domain_process = _CompiledProcess(self.state, comb=domain_name is None,
|
domain_process = _CompiledProcess(self.state, comb=domain_name is None)
|
||||||
name=".".join((*hierarchy, "<{}>".format(domain_name or "comb"))))
|
|
||||||
|
|
||||||
emitter = _Emitter()
|
emitter = _Emitter()
|
||||||
emitter.append(f"def run():")
|
emitter.append(f"def run():")
|
||||||
|
@ -778,8 +772,7 @@ class _CoroutineProcess(_Process):
|
||||||
}
|
}
|
||||||
self.waits_on = set()
|
self.waits_on = set()
|
||||||
|
|
||||||
@property
|
def src_loc(self):
|
||||||
def name(self):
|
|
||||||
coroutine = self.coroutine
|
coroutine = self.coroutine
|
||||||
while coroutine.gi_yieldfrom is not None:
|
while coroutine.gi_yieldfrom is not None:
|
||||||
coroutine = coroutine.gi_yieldfrom
|
coroutine = coroutine.gi_yieldfrom
|
||||||
|
@ -831,7 +824,7 @@ class _CoroutineProcess(_Process):
|
||||||
else:
|
else:
|
||||||
raise NameError("Received command {!r} that refers to a nonexistent "
|
raise NameError("Received command {!r} that refers to a nonexistent "
|
||||||
"domain {!r} from process {!r}"
|
"domain {!r} from process {!r}"
|
||||||
.format(command, command.domain, self.name))
|
.format(command, command.domain, self.src_loc()))
|
||||||
self.get_in_signal(domain.clk, trigger=1 if domain.clk_edge == "pos" else 0)
|
self.get_in_signal(domain.clk, trigger=1 if domain.clk_edge == "pos" else 0)
|
||||||
if domain.rst is not None and domain.async_reset:
|
if domain.rst is not None and domain.async_reset:
|
||||||
self.get_in_signal(domain.rst, trigger=1)
|
self.get_in_signal(domain.rst, trigger=1)
|
||||||
|
@ -858,11 +851,11 @@ class _CoroutineProcess(_Process):
|
||||||
raise TypeError("Received default command from process {!r} that was added "
|
raise TypeError("Received default command from process {!r} that was added "
|
||||||
"with add_process(); did you mean to add this process with "
|
"with add_process(); did you mean to add this process with "
|
||||||
"add_sync_process() instead?"
|
"add_sync_process() instead?"
|
||||||
.format(self.name))
|
.format(self.src_loc()))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise TypeError("Received unsupported command {!r} from process {!r}"
|
raise TypeError("Received unsupported command {!r} from process {!r}"
|
||||||
.format(command, self.name))
|
.format(command, self.src_loc()))
|
||||||
|
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
self.passive = True
|
self.passive = True
|
||||||
|
|
Loading…
Reference in a new issue