Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions chipflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-License-Identifier: BSD-2-Clause
"""
Chipflow library

This is the main entry point for the ChipFlow library, providing tools for
building ASIC designs using the Amaranth HDL framework.
"""

import importlib.metadata
from typing import TYPE_CHECKING

# Import core utilities
from .utils import (
ChipFlowError,
ensure_chipflow_root,
get_cls_by_reference,
get_src_loc,
)

if TYPE_CHECKING:
from .config import Config

__version__ = importlib.metadata.version("chipflow")


# Maintain backward compatibility with underscore-prefixed names
_get_cls_by_reference = get_cls_by_reference
_ensure_chipflow_root = ensure_chipflow_root
_get_src_loc = get_src_loc


def _parse_config() -> 'Config':
"""Parse the chipflow.toml configuration file."""
from .config.parser import _parse_config as config_parse
return config_parse()


__all__ = [
'__version__',
'ChipFlowError',
'ensure_chipflow_root',
]
File renamed without changes.
2 changes: 1 addition & 1 deletion chipflow_lib/_pin_lock.py → chipflow/_pin_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Backward compatibility shim for pin lock functionality.

This module re-exports pin lock functionality from the packaging module.
New code should import directly from chipflow_lib.packaging instead.
New code should import directly from chipflow.packaging instead.
"""

# Re-export from packaging module for backward compatibility
Expand Down
6 changes: 3 additions & 3 deletions chipflow_lib/cli.py → chipflow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class UnexpectedError(ChipFlowError):


DEFAULT_STEPS = {
"silicon": "chipflow_lib.steps.silicon:SiliconStep",
"sim": "chipflow_lib.steps.sim:SimStep",
"software": "chipflow_lib.steps.software:SoftwareStep"
"silicon": "chipflow.steps.silicon:SiliconStep",
"sim": "chipflow.steps.sim:SimStep",
"software": "chipflow.steps.software:SoftwareStep"
}


Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions chipflow/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: BSD-2-Clause
"""
Backward compatibility shim for config parsing.

This module re-exports config parsing utilities from the config module.
New code should import directly from chipflow.config instead.
"""

# Re-export from config.parser module for backward compatibility
from .config.parser import ( # noqa: F401
get_dir_models,
get_dir_software,
_parse_config_file,
)

__all__ = [
'get_dir_models',
'get_dir_software',
'_parse_config_file',
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Backward compatibility shim for config models.

This module re-exports configuration models from the config module.
New code should import directly from chipflow_lib.config instead.
New code should import directly from chipflow.config instead.
"""

# Re-export from config module for backward compatibility
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from ..utils import top_components, get_software_builds

__all__ = [
# Steps (primarily accessed via chipflow_lib.steps.*)
# Steps (primarily accessed via chipflow.steps.*)
'SiliconStep',
'SimStep',
'SoftwareStep',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _unpack_dict(d: dict) -> str:
It is expected that a model that takes parameters is implmemted as a template, with the parameters in the order
given.
"""
def simulatable_interface(base="com.chipflow.chipflow_lib"):
def simulatable_interface(base="com.chipflow.chipflow"):
def decorate(klass):
assert _VALID_UID(base)
dec = amaranth_annotate(SimInterface, SIM_ANNOTATION_SCHEMA)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion chipflow_lib/platform/sim.py → chipflow/platform/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def build(self, e, top):


env = Environment(
loader=PackageLoader("chipflow_lib", "common/sim"),
loader=PackageLoader("chipflow", "common/sim"),
autoescape=select_autoescape()
)
template = env.get_template("main.cc.jinja")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

@contextmanager
def common():
chipflow_lib = importlib.resources.files('chipflow_lib')
common = chipflow_lib.joinpath('common', 'sim')
chipflow = importlib.resources.files('chipflow')
common = chipflow.joinpath('common', 'sim')
with importlib.resources.as_file(common) as f:
yield f

Expand Down
File renamed without changes.
Binary file added chipflow/platforms/.__init__.py.swp
Binary file not shown.
66 changes: 66 additions & 0 deletions chipflow/platforms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"""
Backward compatibility shim for platforms module.

This module re-exports platform functionality from the platform module.
New code should import directly from chipflow.platform instead.

Platform definitions
--------------------

This module defines the functionality you use in your code to target the ChipFlow platform
"""

# Re-export from platform module for backward compatibility
from ..platform import ( # noqa: F401
SiliconPlatformPort,
SiliconPlatform,
SimPlatform,
SoftwarePlatform,
IO_ANNOTATION_SCHEMA,
IOSignature,
IOModel,
IOTripPoint,
IOModelOptions,
OutputIOSignature,
InputIOSignature,
BidirIOSignature,
JTAGSignature,
SPISignature,
I2CSignature,
UARTSignature,
GPIOSignature,
QSPIFlashSignature,
attach_data,
SoftwareDriverSignature,
SoftwareBuild,
Sky130DriveMode,
)

# Package definitions still live in platforms._packages
from ._packages import PACKAGE_DEFINITIONS # noqa: F401

__all__ = [
'IO_ANNOTATION_SCHEMA',
'IOSignature',
'IOModel',
'IOModelOptions',
'IOTripPoint',
'OutputIOSignature',
'InputIOSignature',
'BidirIOSignature',
'SiliconPlatformPort',
'SiliconPlatform',
'SimPlatform',
'SoftwarePlatform',
'JTAGSignature',
'SPISignature',
'I2CSignature',
'UARTSignature',
'GPIOSignature',
'QSPIFlashSignature',
'attach_data',
'SoftwareDriverSignature',
'SoftwareBuild',
'Sky130DriveMode',
'PACKAGE_DEFINITIONS',
]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Backward compatibility shim for platforms.silicon module.

This module re-exports silicon platform functionality from the platform module.
New code should import directly from chipflow_lib.platform instead.
New code should import directly from chipflow.platform instead.
"""

# Re-export from platform module for backward compatibility
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions chipflow/steps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
Backward compatibility shim for steps module.

This module re-exports step functionality from the platform module.
New code should import directly from chipflow.platform instead.

Steps provide an extensible way to modify the `chipflow` command behavior for a given design
"""

# Re-export from platform module for backward compatibility
from ..platform import ( # noqa: F401
StepBase,
setup_amaranth_tools,
SiliconStep,
SimStep,
SoftwareStep,
BoardStep,
)

from ..platform import IOSignature # noqa: F401

__all__ = [
'StepBase',
'setup_amaranth_tools',
'SiliconStep',
'SimStep',
'SoftwareStep',
'BoardStep',
'IOSignature',
]
File renamed without changes.
15 changes: 15 additions & 0 deletions chipflow/steps/board.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Backward compatibility shim for steps.board module.

This module re-exports board step functionality from the platform module.
New code should import directly from chipflow.platform instead.
"""

# Re-export from platform module for backward compatibility
from ..platform import ( # noqa: F401
BoardStep,
)

__all__ = [
'BoardStep',
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Backward compatibility shim for steps.silicon module.

This module re-exports silicon step functionality from the platform module.
New code should import directly from chipflow_lib.platform instead.
New code should import directly from chipflow.platform instead.
"""

# Re-export from platform module for backward compatibility
Expand Down
17 changes: 17 additions & 0 deletions chipflow/steps/sim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Backward compatibility shim for steps.sim module.

This module re-exports sim step functionality from the platform module.
New code should import directly from chipflow.platform instead.
"""

# Re-export from platform module for backward compatibility
from ..platform import ( # noqa: F401
SimStep,
)
from ..platform.sim import SimPlatform # noqa: F401

__all__ = [
'SimStep',
'SimPlatform',
]
17 changes: 17 additions & 0 deletions chipflow/steps/software.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Backward compatibility shim for steps.software module.

This module re-exports software step functionality from the platform module.
New code should import directly from chipflow.platform instead.
"""

# Re-export from platform module for backward compatibility
from ..platform import ( # noqa: F401
SoftwareStep,
)
from ..platform.software import SoftwarePlatform # noqa: F401

__all__ = [
'SoftwareStep',
'SoftwarePlatform',
]
File renamed without changes.
54 changes: 22 additions & 32 deletions chipflow_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
# SPDX-License-Identifier: BSD-2-Clause
"""
Chipflow library
Backward compatibility module for chipflow_lib.

This is the main entry point for the ChipFlow library, providing tools for
building ASIC designs using the Amaranth HDL framework.
This module has been renamed to 'chipflow'. This compatibility layer
will be maintained for some time but is deprecated. Please update your
imports to use 'chipflow' instead of 'chipflow_lib'.

All functionality is re-exported from the chipflow module.
"""

import importlib.metadata
from typing import TYPE_CHECKING
import warnings

# Import core utilities
from .utils import (
ChipFlowError,
ensure_chipflow_root,
get_cls_by_reference,
get_src_loc,
# Issue deprecation warning
warnings.warn(
"The 'chipflow_lib' package has been renamed to 'chipflow'. "
"Please update your imports to use 'chipflow' instead of 'chipflow_lib'. "
"This compatibility shim will be removed in a future version.",
DeprecationWarning,
stacklevel=2
)

if TYPE_CHECKING:
from .config import Config

__version__ = importlib.metadata.version("chipflow_lib")


# Maintain backward compatibility with underscore-prefixed names
_get_cls_by_reference = get_cls_by_reference
_ensure_chipflow_root = ensure_chipflow_root
_get_src_loc = get_src_loc


def _parse_config() -> 'Config':
"""Parse the chipflow.toml configuration file."""
from .config.parser import _parse_config as config_parse
return config_parse()
# Re-export only the symbols actually used by chipflow-digital-ip and chipflow-examples
# Top-level exports (used by chipflow-examples)
from chipflow import ChipFlowError # noqa: F401, E402
from chipflow import __version__ # noqa: F401, E402

# Internal API (used by tests and CLI)
from chipflow import _parse_config, _get_cls_by_reference, _ensure_chipflow_root, _get_src_loc # noqa: F401, E402

__all__ = [
'__version__',
'ChipFlowError',
'ensure_chipflow_root',
]
# Note: Submodule imports (chipflow_lib.platforms, chipflow_lib.steps, chipflow_lib.config)
# are handled by stub modules in their respective subdirectories
Loading
Loading