Skip to content

Commit 81b3b40

Browse files
committed
wip on chipflow.power.map
1 parent d1b6c81 commit 81b3b40

22 files changed

+327
-288
lines changed

chipflow_lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import TYPE_CHECKING
1212

1313
if TYPE_CHECKING:
14-
from .config_models import Config
14+
from ._config_models import Config
1515

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

chipflow_lib/_config_models.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-License-Identifier: BSD-2-Clause
2+
from typing import Dict, Optional, Literal, Any, List
3+
4+
from pydantic import BaseModel
5+
6+
from .platforms._utils import Process, PowerConfig
7+
8+
Voltage = float
9+
10+
class SiliconConfig(BaseModel):
11+
"""Configuration for silicon in chipflow.toml."""
12+
process: 'Process'
13+
package: Literal["caravel", "cf20", "pga144"]
14+
power: Dict[str, Voltage] = {}
15+
debug: Optional[Dict[str, bool]] = None
16+
17+
class ChipFlowConfig(BaseModel):
18+
"""Root configuration for chipflow.toml."""
19+
project_name: str
20+
top: Dict[str, Any] = {}
21+
steps: Optional[Dict[str, str]] = None
22+
silicon: Optional[SiliconConfig] = None
23+
clock_domains: Optional[List[str]] = None
24+
power: Optional[PowerConfig] = None
25+
26+
27+
class Config(BaseModel):
28+
"""Root configuration model for chipflow.toml."""
29+
chipflow: ChipFlowConfig

chipflow_lib/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pydantic import ValidationError
77

88
from . import ChipFlowError
9-
from .config_models import Config
9+
from ._config_models import Config
1010

1111
def get_dir_models():
1212
return os.path.dirname(__file__) + "/models"

chipflow_lib/config_models.py

Lines changed: 0 additions & 74 deletions
This file was deleted.

chipflow_lib/pin_lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pprint import pformat
77

88
from . import _parse_config, _ensure_chipflow_root, ChipFlowError
9-
from .platforms import top_components, LockFile, PACKAGE_DEFINITIONS
9+
from .platforms._utils import top_components, LockFile, PACKAGE_DEFINITIONS
1010

1111
# logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
1212
logger = logging.getLogger(__name__)
@@ -41,7 +41,7 @@ def lock_pins() -> None:
4141
for name, component in top.items():
4242
package_def.register_component(name, component)
4343

44-
newlock = package_def.allocate_pins(config, process, oldlock)
44+
newlock = package_def._allocate_pins(config, process, oldlock)
4545

4646
with open(lockfile, 'w') as f:
4747
f.write(newlock.model_dump_json(indent=2, serialize_as_any=True))

chipflow_lib/platforms/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88

99
from .silicon import *
1010
from .sim import *
11-
from .utils import *
11+
from ._utils import (
12+
IO_ANNOTATION_SCHEMA, IOSignature, IOModel,
13+
OutputIOSignature, InputIOSignature, BidirIOSignature,
14+
PACKAGE_DEFINITIONS, Process,
15+
GAPackageDef, QuadPackageDef, BareDiePackageDef,
16+
BringupPins, JTAGPins, PowerPins
17+
)
1218

1319
__all__ = ['IO_ANNOTATION_SCHEMA', 'IOSignature', 'IOModel',
1420
'OutputIOSignature', 'InputIOSignature', 'BidirIOSignature',
15-
'load_pinlock', "PACKAGE_DEFINITIONS", 'top_components', 'LockFile',
16-
'Package', 'PortMap', 'Port', 'Process',
17-
'GAPackageDef', 'QuadPackageDef', 'BareDiePackageDef', 'BasePackageDef',
21+
'PACKAGE_DEFINITIONS', 'Process',
22+
'GAPackageDef', 'QuadPackageDef', 'BareDiePackageDef',
1823
'BringupPins', 'JTAGPins', 'PowerPins',
1924
'SiliconPlatformPort', 'SiliconPlatform',
2025
'SimPlatform']

0 commit comments

Comments
 (0)