Skip to content

Commit

Permalink
Add RegNode.is_halt_reg property
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Jan 20, 2022
1 parent 28a43cf commit 7a52f3b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
8 changes: 4 additions & 4 deletions systemrdl/core/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,15 +1642,15 @@ def validate(self, node: m_node.Node, value: Any) -> None:
self.env.msg.error(
"Use of a hardware write-enable on field '%s' does not make "
"sense because it is defined as 'sticky'. Sticky fields already "
"define their own hardware write-enable behavior."
"implicitly control their hardware write-enable behavior based on the input value."
% (node.inst_name),
node.inst.property_src_ref.get('we', node.inst.inst_src_ref)
)
if node.get_property('wel'):
self.env.msg.error(
"Use of a hardware write-enable on field '%s' does not make "
"sense because it is defined as 'sticky'. Sticky fields already "
"define their own hardware write-enable behavior."
"implicitly control their hardware write-enable behavior based on the input value."
% (node.inst_name),
node.inst.property_src_ref.get('wel', node.inst.inst_src_ref)
)
Expand Down Expand Up @@ -1686,15 +1686,15 @@ def validate(self, node: m_node.Node, value: Any) -> None:
self.env.msg.error(
"Use of a hardware write-enable on field '%s' does not make "
"sense because it is defined as 'stickybit'. Stickybit fields already "
"define their own hardware write-enable behavior."
"implicitly control their hardware write-enable behavior based on the input value."
% (node.inst_name),
node.inst.property_src_ref.get('we', node.inst.inst_src_ref)
)
if node.get_property('wel'):
self.env.msg.error(
"Use of a hardware write-enable on field '%s' does not make "
"sense because it is defined as 'stickybit'. Stickybit fields already "
"define their own hardware write-enable behavior."
"implicitly control their hardware write-enable behavior based on the input value."
% (node.inst_name),
node.inst.property_src_ref.get('wel', node.inst.inst_src_ref)
)
Expand Down
17 changes: 16 additions & 1 deletion systemrdl/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,8 @@ def has_hw_readable(self) -> bool:
@property
def is_interrupt_reg(self) -> bool:
"""
Register contains one or more interrupt fields.
Register contains one or more interrupt fields and therefore produces an
interrupt output signal.
.. versionadded:: 1.22
Expand All @@ -1230,6 +1231,20 @@ def is_interrupt_reg(self) -> bool:
return True
return False

@property
def is_halt_reg(self) -> bool:
"""
Register contains one or more interrupt fields that use ``haltenable``
or ``haltmask`` and therefore produces a halt output signal.
.. versionadded:: 1.22
"""
for field in self.fields():
if field.get_property('haltenable') or field.get_property('haltmask'):
return True
return False

#===============================================================================
class RegfileNode(AddressableNode):

Expand Down

0 comments on commit 7a52f3b

Please sign in to comment.