Emit error if field that is asynchronously reset uses a dynamic reset value. #129

This commit is contained in:
Alex Mykyta
2025-03-07 19:20:44 -08:00
parent d3cd51f500
commit 6430dd4914
4 changed files with 63 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ class DesignValidator(RDLListener):
"""
def __init__(self, exp:'RegblockExporter') -> None:
self.exp = exp
self.ds = exp.ds
self.msg = self.top_node.env.msg
self._contains_external_block_stack = [] # type: List[bool]
@@ -152,6 +153,23 @@ class DesignValidator(RDLListener):
node.inst.inst_src_ref
)
# Check for unsynthesizable reset
reset = node.get_property("reset")
if not (reset is None or isinstance(reset, int)):
# Has reset that is not a constant value
resetsignal = node.get_property("resetsignal")
if resetsignal:
is_async_reset = resetsignal.get_property("async")
else:
is_async_reset = self.ds.default_reset_async
if is_async_reset:
self.msg.error(
"A field that uses an asynchronous reset cannot use a dynamic reset value. This is not synthesizable.",
node.inst.inst_src_ref
)
def exit_AddressableComponent(self, node: AddressableNode) -> None:
if not isinstance(node, RegNode):
# Exiting block-like node