Skip to content

Commit

Permalink
Fix handling of fields with reset value as a reference
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Mar 30, 2024
1 parent bed2881 commit cf961d8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/peakrdl_ipxact/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.4.3"
__version__ = "3.4.4"
2 changes: 1 addition & 1 deletion src/peakrdl_ipxact/__peakrdl__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def is_compatible(self, path: str) -> bool:
with open(path, "r", encoding="utf-8") as f:
if re.search(r"<(spirit|ipxact):component\b", f.read()):
return True
return False
return False # type: ignore [unreachable]

def add_importer_arguments(self, arg_group: 'argparse.ArgumentParser') -> None:
arg_group.add_argument(
Expand Down
4 changes: 2 additions & 2 deletions src/peakrdl_ipxact/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def add_register(self, parent: minidom.Element, node: RegNode) -> None:
mask = 0
for field in node.fields(skip_not_present=False):
field_reset = field.get_property("reset")
if field_reset is not None:
if isinstance(field_reset, int):
field_mask = ((1 << field.width) - 1) << field.lsb
field_reset = (field_reset << field.lsb) & field_mask
reset |= field_reset
Expand Down Expand Up @@ -439,7 +439,7 @@ def add_field(self, parent: minidom.Element, node: FieldNode) -> None:

if self.standard >= Standard.IEEE_1685_2014:
reset = node.get_property("reset")
if reset is not None:
if isinstance(reset, int):
resets_el = self.doc.createElement(self.ns + "resets")
field.appendChild(resets_el)
reset_el = self.doc.createElement(self.ns + "reset")
Expand Down
2 changes: 1 addition & 1 deletion src/peakrdl_ipxact/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def parse_integer(self, s: str) -> int:
v *= multiplier[m.group(2).upper()]
return v

m = re.fullmatch(r"\d*'h([0-9a-f]+)", s, re.I)
m = re.fullmatch(r"\d*'h([0-9a-f]+)", s, re.I) # type: ignore [unreachable]
if m:
return int(m.group(1), 16)

Expand Down

0 comments on commit cf961d8

Please sign in to comment.