Fix status checks: lint, format, typecheck, and tests (#8)
* Initial plan * Initial assessment - identifying issues to fix Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * Fix type check and test issues to pass all status checks Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * Add coverage.xml to .gitignore and remove from tracking Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * Use more specific pattern for coverage.xml in .gitignore Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,6 +12,7 @@
|
||||
**/*.pb
|
||||
**/.Xil
|
||||
**/.coverage.*
|
||||
coverage.xml
|
||||
|
||||
build/
|
||||
dist/
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from typing import Protocol, Self
|
||||
from typing import Protocol
|
||||
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
class SupportsStr(Protocol):
|
||||
|
||||
@@ -2,7 +2,8 @@ from __future__ import annotations
|
||||
|
||||
from textwrap import indent
|
||||
from types import EllipsisType
|
||||
from typing import Self
|
||||
|
||||
from typing_extensions import Self
|
||||
|
||||
from .body import Body, SupportsStr
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class APB3Cpuif(BaseCpuif):
|
||||
|
||||
# Only add array dimensions if this should be treated as an array
|
||||
if self.check_is_array(child):
|
||||
assert child.array_dimensions is not None
|
||||
return f"{base} {''.join(f'[{dim}]' for dim in child.array_dimensions)}"
|
||||
|
||||
return base
|
||||
|
||||
@@ -19,6 +19,7 @@ class APB4Cpuif(BaseCpuif):
|
||||
|
||||
# Only add array dimensions if this should be treated as an array
|
||||
if self.check_is_array(child):
|
||||
assert child.array_dimensions is not None
|
||||
return f"{base} {''.join(f'[{dim}]' for dim in child.array_dimensions)}"
|
||||
|
||||
return base
|
||||
|
||||
@@ -19,6 +19,7 @@ class AXI4LiteCpuif(BaseCpuif):
|
||||
|
||||
# Only add array dimensions if this should be treated as an array
|
||||
if self.check_is_array(child):
|
||||
assert child.array_dimensions is not None
|
||||
return f"{base} {''.join(f'[{dim}]' for dim in child.array_dimensions)}"
|
||||
|
||||
return base
|
||||
|
||||
@@ -19,6 +19,7 @@ class AXI4LiteCpuifFlat(BaseCpuif):
|
||||
|
||||
# Only add array dimensions if this should be treated as an array
|
||||
if self.check_is_array(child):
|
||||
assert child.array_dimensions is not None
|
||||
return f"{base} {''.join(f'[{dim}]' for dim in child.array_dimensions)}"
|
||||
|
||||
return base
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections import deque
|
||||
from enum import Enum
|
||||
from typing import cast
|
||||
|
||||
from systemrdl.node import AddressableNode
|
||||
from systemrdl.walker import WalkerAction
|
||||
@@ -101,7 +102,8 @@ class DecodeLogicGenerator(BusDecoderListener):
|
||||
self._decode_stack.append(IfBody())
|
||||
elif isinstance(self._decode_stack[-1], IfBody):
|
||||
# non-arrayed component with if-body
|
||||
with self._decode_stack[-1].cm(condition) as b:
|
||||
ifb = cast(IfBody, self._decode_stack[-1])
|
||||
with ifb.cm(condition) as b:
|
||||
b += f"{self._flavor.cpuif_select}.{get_indexed_path(self._ds.top_node, node)} = 1'b1;"
|
||||
else:
|
||||
raise RuntimeError("Invalid decode stack state")
|
||||
@@ -128,7 +130,8 @@ class DecodeLogicGenerator(BusDecoderListener):
|
||||
continue
|
||||
|
||||
if isinstance(self._decode_stack[-1], IfBody):
|
||||
with self._decode_stack[-1].cm(self._cond_stack.pop()) as parent_b:
|
||||
ifb = cast(IfBody, self._decode_stack[-1])
|
||||
with ifb.cm(self._cond_stack.pop()) as parent_b:
|
||||
parent_b += b
|
||||
else:
|
||||
self._decode_stack[-1] += b
|
||||
|
||||
@@ -56,11 +56,13 @@ def ref_is_internal(top_node: AddrmapNode, ref: Node | PropertyReference) -> boo
|
||||
|
||||
For the sake of this exporter, root signals are treated as internal.
|
||||
"""
|
||||
current_node: Node | None
|
||||
if isinstance(ref, PropertyReference):
|
||||
current_node = ref.node
|
||||
else:
|
||||
current_node = ref
|
||||
|
||||
# pyrefly: ignore[bad-assignment] - false positive due to circular type checking
|
||||
while current_node is not None:
|
||||
if current_node == top_node:
|
||||
# reached top node without finding any external components
|
||||
|
||||
@@ -33,7 +33,7 @@ def test_unroll_disabled_creates_array_interface(sample_rdl):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
exporter = BusDecoderExporter()
|
||||
exporter.export(
|
||||
sample_rdl.top,
|
||||
sample_rdl,
|
||||
tmpdir,
|
||||
cpuif_cls=APB4Cpuif,
|
||||
cpuif_unroll=False,
|
||||
@@ -61,7 +61,7 @@ def test_unroll_enabled_creates_individual_interfaces(sample_rdl):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
exporter = BusDecoderExporter()
|
||||
exporter.export(
|
||||
sample_rdl.top,
|
||||
sample_rdl,
|
||||
tmpdir,
|
||||
cpuif_cls=APB4Cpuif,
|
||||
cpuif_unroll=True,
|
||||
@@ -95,7 +95,7 @@ def test_unroll_with_apb3(sample_rdl):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
exporter = BusDecoderExporter()
|
||||
exporter.export(
|
||||
sample_rdl.top,
|
||||
sample_rdl,
|
||||
tmpdir,
|
||||
cpuif_cls=APB3Cpuif,
|
||||
cpuif_unroll=True,
|
||||
@@ -138,7 +138,7 @@ def test_unroll_multidimensional_array(multidim_array_rdl):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
exporter = BusDecoderExporter()
|
||||
exporter.export(
|
||||
multidim_array_rdl.top,
|
||||
multidim_array_rdl,
|
||||
tmpdir,
|
||||
cpuif_cls=APB4Cpuif,
|
||||
cpuif_unroll=True,
|
||||
|
||||
Reference in New Issue
Block a user