Skip to content

Commit 44c60df

Browse files
committed
fix lint issues
1 parent a4cfb9c commit 44c60df

File tree

7 files changed

+23
-21
lines changed

7 files changed

+23
-21
lines changed

chipflow_lib/_appresponse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# SPDX-License-Identifier: BSD-2-Clause
2+
13
from dataclasses import dataclass
24

35
from pydantic import BaseModel, PlainSerializer, model_serializer
@@ -32,7 +34,7 @@ def _serialize(self):
3234
# Run Annotated PlainSerializer
3335
for metadata in self.model_fields[name].metadata:
3436
if isinstance(metadata, PlainSerializer):
35-
value = metadata.func(value)
37+
value = metadata.func(value) # type: ignore
3638

3739
serialized[serialize_key] = value
3840

chipflow_lib/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: BSD-2-Clause
2+
23
import argparse
34
import inspect
45
import sys

chipflow_lib/platforms/_internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__all__ = ['IO_ANNOTATION_SCHEMA', 'IOSignature', 'IOModel',
66
'OutputIOSignature', 'InputIOSignature', 'BidirIOSignature',
77
'load_pinlock', "PACKAGE_DEFINITIONS", 'top_components', 'LockFile',
8-
'Package', 'PortMap', 'Port', 'Process',
8+
'Package', 'PortMap', 'PortDesc', 'Process',
99
'GAPackageDef', 'QuadPackageDef', 'BareDiePackageDef', 'BasePackageDef',
1010
'BringupPins', 'JTAGPins', 'PowerPins',
1111
'SiliconPlatformPort', 'SiliconPlatform',

chipflow_lib/platforms/_packages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .utils import QuadPackageDef, BareDiePackageDef, GAPackageDef, Package
1+
from .utils import QuadPackageDef, BareDiePackageDef, Package
22
from ._openframe import OpenframePackageDef
33

44
# Add any new package types to both PACKAGE_DEFINITIONS and the PackageDef union

chipflow_lib/platforms/silicon.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
from dataclasses import dataclass
1010
from pprint import pformat
11-
from typing import TYPE_CHECKING, List, Dict
11+
from typing import TYPE_CHECKING, List
1212

13-
from amaranth import Module, Signal, Cat, ClockDomain, ClockSignal, ResetSignal
13+
from amaranth import Module, Signal, ClockDomain, ClockSignal, ResetSignal
1414

1515
from amaranth.lib import wiring, io
1616
from amaranth.lib.cdc import FFSynchronizer
1717
from amaranth.lib.wiring import Component, In, PureInterface
1818

19-
from amaranth.back import rtlil
19+
from amaranth.back import rtlil #type: ignore[reportAttributeAccessIssue]
2020
from amaranth.hdl import Fragment
2121
from amaranth.hdl._ir import PortDirection
2222

@@ -63,7 +63,7 @@ def elaborate(self, platform):
6363
heartbeat_ctr = Signal(self.counter_size)
6464
getattr(m.d, self.clock_domain).__iadd__(heartbeat_ctr.eq(heartbeat_ctr + 1))
6565

66-
heartbeat_buffer = io.Buffer("o", self.ports.heartbeat)
66+
heartbeat_buffer = io.Buffer(io.Direction.Output, self.ports.heartbeat)
6767
m.submodules.heartbeat_buffer = heartbeat_buffer
6868
m.d.comb += heartbeat_buffer.o.eq(heartbeat_ctr[-1]) # type: ignore
6969
return m
@@ -240,10 +240,10 @@ def __init__(self,
240240
self._ie = None
241241

242242
if self._oe is not None:
243-
self._oe_n = Signal(self._oe.width, name=f"{self._name}$oeb")
243+
self._oe_n = Signal(self._oe.shape().width, name=f"{self._name}$oeb")
244244
self._signals.append((self._oe_n, PortDirection.Output))
245245
if self._i is not None:
246-
self._ie = Signal(self._i.width, name=f"{self._name}$inp_dis")
246+
self._ie = Signal(self._i.shape().width, name=f"{self._name}$inp_dis")
247247
self._signals.append((self._ie, PortDirection.Input))
248248

249249
# Port Configuration
@@ -387,7 +387,7 @@ def elaborate(self, platform):
387387
class SiliconPlatform:
388388
def __init__(self, config: 'Config'):
389389
if not config.chipflow.silicon:
390-
raise ChipFlowError(f"I can't build for silicon without a [chipflow.silicon] section to guide me!")
390+
raise ChipFlowError("I can't build for silicon without a [chipflow.silicon] section to guide me!")
391391
self._config = config
392392
self._ports = {}
393393
self._files = {}
@@ -411,16 +411,16 @@ def instantiate_ports(self, m: Module):
411411
print(pformat(self._ports))
412412
for clock in pinlock.port_map.get_clocks():
413413
assert 'clock_domain' in clock.iomodel
414-
domain = name=clock.iomodel['clock_domain']
414+
domain = clock.iomodel['clock_domain']
415415
setattr(m.domains, domain, ClockDomain(name=domain))
416-
clk_buffer = io.Buffer("i", self._ports[clock.port_name])
416+
clk_buffer = io.Buffer(io.Direction.Input, self._ports[clock.port_name])
417417
setattr(m.submodules, "clk_buffer_" + domain, clk_buffer)
418418
m.d.comb += ClockSignal().eq(clk_buffer.i) #type: ignore[reportAttributeAccessIssue]
419419

420420
for reset in pinlock.port_map.get_resets():
421421
assert 'clock_domain' in reset.iomodel
422-
domain = name=reset.iomodel['clock_domain']
423-
rst_buffer = io.Buffer("i", self._ports[reset.port_name])
422+
domain = reset.iomodel['clock_domain']
423+
rst_buffer = io.Buffer(io.Direction.Input, self._ports[reset.port_name])
424424
setattr(m.submodules, reset.port_name, rst_buffer)
425425
setattr(m.submodules, reset.port_name + "_sync", FFSynchronizer(rst_buffer.i, ResetSignal())) #type: ignore[reportAttributeAccessIssue]
426426

chipflow_lib/steps/silicon.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,12 @@ def network_err(e):
173173
fh.close()
174174
exit(1)
175175

176-
sp.info(f"> Submitting {submission_name} for project {self.config.chipflow.project_name} to ChipFlow Cloud {self._chipflow_api_origin}")
176+
sp.info(f"> Submitting {submission_name} for project {self.config.chipflow.project_name} to ChipFlow Cloud {build_submit_url}")
177177
sp.start("Sending design to ChipFlow Cloud")
178178

179-
build_submit_url = f"{self._chipflow_api_origin}/build/submit"
179+
build_submit_url = f"{build_submit_url}/build/submit"
180180

181181
assert self._chipflow_api_key
182-
assert self._chipflow_api_origin
183182
try:
184183
resp = requests.post(
185184
build_submit_url,
@@ -210,9 +209,9 @@ def network_err(e):
210209
# Handle response based on status code
211210
if resp.status_code == 200:
212211
logger.debug(f"Submitted design: {resp_data}")
213-
self._build_url = f"{self._chipflow_api_origin}/build/{resp_data['build_id']}"
214-
self._build_status_url = f"{self._chipflow_api_origin}/build/{resp_data['build_id']}/status"
215-
self._log_stream_url = f"{self._chipflow_api_origin}/build/{resp_data['build_id']}/logs?follow=true"
212+
self._build_url = f"{build_submit_url}/build/{resp_data['build_id']}"
213+
self._build_status_url = f"{build_submit_url}/build/{resp_data['build_id']}/status"
214+
self._log_stream_url = f"{build_submit_url}/build/{resp_data['build_id']}/logs?follow=true"
216215

217216
sp.succeed(f"✅ Design submitted successfully! Build URL: {self._build_url}")
218217

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test.cmd = "pytest"
7171
test-cov.cmd = "pytest --cov=chipflow_lib --cov-report=term"
7272
test-cov-html.cmd = "pytest --cov=chipflow_lib --cov-report=html"
7373
test-docs.cmd = "sphinx-build -b doctest docs/ docs/_build"
74-
lint.composite = [ "ruff check", "pyright chipflow_lib"]
74+
lint.composite = [ "./tools/license_check.sh", "ruff check", "pyright chipflow_lib"]
7575
docs.cmd = "sphinx-build docs/ docs/_build/ -W --keep-going"
7676
test-silicon.cmd = "pytest tests/test_silicon_platform.py tests/test_silicon_platform_additional.py tests/test_silicon_platform_amaranth.py tests/test_silicon_platform_build.py tests/test_silicon_platform_port.py --cov=chipflow_lib.platforms.silicon --cov-report=term"
7777
_check-project.call = "tools.check_project:main"

0 commit comments

Comments
 (0)