sim: fix ValueCastable not being recognized as a coroutine command

This commit is contained in:
Jaro Habiger 2024-01-05 14:57:27 +01:00 committed by Catherine
parent 4014aef033
commit ded84fe9d6
2 changed files with 24 additions and 1 deletions

View file

@ -1,7 +1,7 @@
import inspect
from ..hdl import *
from ..hdl.ast import Statement, SignalSet
from ..hdl.ast import Statement, SignalSet, ValueCastable
from .core import Tick, Settle, Delay, Passive, Active
from ._base import BaseProcess
from ._pyrtl import _ValueCompiler, _RHSValueCompiler, _StatementCompiler
@ -66,6 +66,8 @@ class PyCoroProcess(BaseProcess):
command = self.default_cmd
response = None
if isinstance(command, ValueCastable):
command = Value.cast(command)
if isinstance(command, Value):
exec(_RHSValueCompiler.compile(self.state, command, mode="curr"),
self.exec_locals)