Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
5eba3b5
chore: add humanize and superpowers dir to .gitignore
Emin017 May 1, 2026
f4692b3
docs: add cli specifications
Emin017 May 1, 2026
6e9211a
chore: bump ecc submodule
Emin017 May 1, 2026
cf9241a
chore: add .humanize to .gitignore
Emin017 May 1, 2026
68b43d8
feat: implement Phase 1 project-oriented CLI
Emin017 May 1, 2026
60f51f0
fix: address Codex review findings for CLI Phase 1
Emin017 May 1, 2026
7f74aad
fix: emit actual file paths in ecc log no-step output
Emin017 May 1, 2026
b159749
fix: resolve pdk.root, preserve filelist detection, catch flow errors
Emin017 May 1, 2026
3855d5b
fix: update Nix CLI entrypoint and use basename for init templates
Emin017 May 1, 2026
291ef0b
fix: handle log JSONL no-step, propagate project in overwrite, catch …
Emin017 May 1, 2026
7996cae
fix: allow empty pdk.root with env fallback, expand env vars and ~ in…
Emin017 May 1, 2026
34e3997
fix: add legacy CLI compat, reject RTL directories, add cli script alias
Emin017 May 1, 2026
dcce4db
fix: reject RTL directory paths in config validation
Emin017 May 1, 2026
df078d7
fix: treat all-Unstart flows as unstarted, quote project paths in dis…
Emin017 May 1, 2026
51f1c72
fix(cli): remove ineffective --errors flag from run failure disclosure
Emin017 May 1, 2026
9e6b0e4
fix(cli): guard against non-dict TOML sections and non-object flow.json
Emin017 May 1, 2026
c3574f3
fix(cli): normalize Bazel PDK root, surface ongoing runs, fix JSON di…
Emin017 May 1, 2026
3c40918
fix(cli): coerce non-list/non-string rtl values in config parsing
Emin017 May 1, 2026
d35dc29
fix(cli): validate PDK contents during ecc check
Emin017 May 1, 2026
5aa3b9b
fix(cli): validate steps structure in flow.json, escape quotes in tex…
Emin017 May 1, 2026
0140636
fix(cli): extract _safe_steps to normalize steps in all status builders
Emin017 May 1, 2026
5fb172a
fix(cli): remove m from metric normalizer regex, coerce non-string co…
Emin017 May 1, 2026
26da09c
docs: remove ecc open from phase 2 checklist
Emin017 May 1, 2026
94271c3
refactor(cli): simplify CLI code before finalization
Emin017 May 1, 2026
a295b57
feat(cli): add artifacts, config --resolved, diagnose, and --run-id s…
Emin017 May 2, 2026
08df9ca
fix(cli): address Codex review findings for artifacts, config, diagno…
Emin017 May 2, 2026
413ab59
fix(cli): correct run-id resolution to project-root relative, use val…
Emin017 May 2, 2026
2e1e30f
fix(cli): issue-specific diagnose evidence, absolute run_dir.value, c…
Emin017 May 2, 2026
c3fa6de
fix(cli): use item-specific inspect_cmd in config text, add invalid_f…
Emin017 May 2, 2026
8317fde
fix(cli): resolve RTL with _resolve_path, distinguish corrupt flow.js…
Emin017 May 2, 2026
447f2e5
chore: gitignore codex review artifacts
Emin017 May 2, 2026
b4bfc38
fix(cli): report pending steps in diagnose, add kind to missing-run J…
Emin017 May 2, 2026
cce7074
fix(cli): tighten log error matching to avoid false positives from cl…
Emin017 May 2, 2026
d36ff37
docs: update README for project-oriented CLI
Emin017 May 2, 2026
95e4227
fix(cli): validate filelist contents during ecc check
Emin017 May 2, 2026
461e12e
fix(cli): catch filelist parse errors during ecc check instead of cra…
Emin017 May 2, 2026
1e03891
refactor(cli): simplify CLI modules - remove dead code, deduplicate, …
Emin017 May 2, 2026
339b87e
refactor(nix): migrate to latest codebase
Emin017 May 2, 2026
68fa6ca
fix(cli): handle read-only directories when overwriting runs
Emin017 May 2, 2026
154dd3a
fix(cli): make run tree writable before rmtree on overwrite
Emin017 May 2, 2026
6086804
fix(flow): keep copied config files writable
Emin017 May 2, 2026
43211c7
refactor(cli): implement functional command pipeline
Emin017 May 2, 2026
5ec1597
refactor(cli): remove dead project.py module
Emin017 May 2, 2026
8cfc1c8
fix(cli): add _cmd suffix stripping and kind=error for missing config
Emin017 May 2, 2026
d7a846f
test(cli): add missing-config regression tests for config and check
Emin017 May 2, 2026
ade5c6a
test(cli): assert disclosure command in config missing-config text test
Emin017 May 2, 2026
29b911e
fix(cli): handle known flow steps without directories and nested arti…
Emin017 May 2, 2026
0209a8e
fix(cli): only suppress zero-count clean summaries in error filter
Emin017 May 3, 2026
178214f
fix(cli): treat pending steps as ongoing in run status
Emin017 May 3, 2026
13c88ea
fix(cli): handle step dirs absent from flow.json and init on existing…
Emin017 May 3, 2026
a36b5e8
refactor(cli): remove unused import and dead code
Emin017 May 3, 2026
220b377
feat(cli): add interactive run progress and machine-readable run modes
Emin017 May 3, 2026
3545bd5
feat(cli): add live log tailing and log section markers to progress e…
Emin017 May 3, 2026
48c9479
fix(cli): use contract transient line format and exception-safe monit…
Emin017 May 3, 2026
5b26a3d
fix(cli): open tool logs with errors=replace to handle non-UTF8 bytes
Emin017 May 3, 2026
f58ed18
refactor(cli): simplify progress module and deduplicate test helpers
Emin017 May 3, 2026
f5bad8a
refactor(cli): apply code-simplifier review to progress module
Emin017 May 3, 2026
a34da0a
feat(cli): polish interactive progress output with per-step blocks an…
Emin017 May 3, 2026
8034ffa
fix(cli): style active step marker in cyan and make color tests deter…
Emin017 May 3, 2026
942a19c
fix(cli): add clean-line newline after clearing transient before stab…
Emin017 May 3, 2026
12ebdae
refactor(cli): hoist repeated test imports to module level
Emin017 May 3, 2026
ad80dee
feat(cli): add parameter discovery, validation, and run overrides
Emin017 May 3, 2026
1821eb7
fix(cli): address param validation, pretty output, resolved list, and…
Emin017 May 3, 2026
a6a9040
fix(cli): native TOML type validation, scoped TOML edit, CLI provenance
Emin017 May 3, 2026
1eb7ec4
fix(cli): param handlers reject invalid TOML, indented key edits, pro…
Emin017 May 3, 2026
4a3f69d
fix(cli): disclosure commands in param show, safe TOML section parsin…
Emin017 May 3, 2026
b821233
feat(cli): refactor ecc log output with complete content, classificat…
Emin017 May 4, 2026
d4a0842
fix(cli): address Codex review gaps in log output refactoring
Emin017 May 4, 2026
cf022d4
fix(cli): no-colon traceback terminators and stable plain output path
Emin017 May 4, 2026
ec45068
fix(cli): listing plain fallback for ecc log --plain without step
Emin017 May 4, 2026
6630832
fix(cli): route placement params to DreamPlace, reject zero freq, sur…
Emin017 May 4, 2026
6efffcf
fix(cli): add log --json flag, align target_density default with Drea…
Emin017 May 4, 2026
d9989d6
fix(cli): handle multiline TOML values in param set/unset edits
Emin017 May 4, 2026
6c716e2
fix(cli): seed design frequency in config --resolved param records
Emin017 May 4, 2026
9dc9995
fix(cli): treat non-dict flow.json as corrupt, recognize flow-only st…
Emin017 May 4, 2026
b7b9944
refactor(cli): simplify code across 8 CLI modules
Emin017 May 4, 2026
5d23bf0
feat(cli): add pretty output rendering for all CLI commands
Emin017 May 4, 2026
a6588a3
fix(cli): consolidate color gating and fix multi-record error rendering
Emin017 May 4, 2026
be21120
fix(cli): use shared ANSI constants in colorized log listing renderer
Emin017 May 4, 2026
457d52b
fix(cli): preserve newline after multiline TOML value replacement
Emin017 May 5, 2026
16d3309
fix(cli): restore legacy CLI compat and scripts.cli alias
Emin017 May 5, 2026
48182e2
fix(cli): handle --flag=value syntax and filelist routing in legacy c…
Emin017 May 5, 2026
37f7046
fix(cli): restore extensionless filelist detection in legacy compat
Emin017 May 5, 2026
c0f23f9
fix(cli): restore argument validation in legacy invocation path
Emin017 May 5, 2026
2b6b58e
fix(cli): wrap legacy cli entrypoint in Nix, recognize flow-only step…
Emin017 May 5, 2026
ec47aa9
fix(cli): skip symlinks when chmodding run tree on overwrite
Emin017 May 5, 2026
125660e
refactor(cli): remove duplicate quoting functions and simplify log pl…
Emin017 May 5, 2026
a771cb9
chore: remove old cli python entrypoint
Emin017 May 6, 2026
663cc6b
fix(nix): use latest nix build from source
Emin017 May 6, 2026
063461d
fix(params): set Target density to 0.2
Emin017 May 7, 2026
cc1fac9
nix(ecc-tools): fix iNO memory leak
Emin017 May 8, 2026
54af9c5
nix(ecc-dreamplace): fix NCTUgr permission error
Emin017 May 8, 2026
5a0acae
chore: bump ecc-dreamplace to 0.1.0a2
Emin017 May 8, 2026
b997d31
chore: bump ecc and ecc-dreamplace
Emin017 May 8, 2026
e1eaf8a
feat(cli): color error codes/lines red and add failure context to ecc…
Emin017 May 8, 2026
3a651d2
fix(cli): normalize log line terminators for compact context block
Emin017 May 8, 2026
b5c2627
test(cli): tighten context block regression to inspect unfiltered rows
Emin017 May 8, 2026
62e80df
chore: bump ecc-dreamplace submodule
Emin017 May 8, 2026
667edd7
fix(build): update DreamPlace uv source URL to match 0.1.0a2 pin
Emin017 May 8, 2026
0bd8681
refactor(cli): deduplicate kind label/color mappings between log_view…
Emin017 May 8, 2026
daefa88
feat(cli): add flow-ordered log listing with tail previews
Emin017 May 8, 2026
efdc930
fix(cli): correct listing shape, sanitization, and unreadable coverage
Emin017 May 8, 2026
c9a1b8f
fix(nix): pass callPackages from overlay to ecc-tools derivation
Emin017 May 9, 2026
e8966b9
fix(params): align target_density default across template, registry, …
Emin017 May 9, 2026
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
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,11 @@ bazel-*
# Generated from uv.lock, not committed
requirements_lock.txt

chipcompiler/tools/ecc_dreamplace/dreamplace
chipcompiler/tools/ecc_dreamplace/dreamplace

.humanize/
humanize-*
docs/superpowers/
findings.md
progress.md
task_plan.md
48 changes: 33 additions & 15 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,48 @@ ECOS Chip Compiler 是一个**开源芯片设计自动化解决方案**,集成
GUI(ECOS Studio)已迁移至 [ecos-studio](https://github.com/0xharry/ecos-studio) 仓库。

**使用方式:**
- **CLI (`cli`)** - 命令行流程执行
- **CLI (`ecc`)** - 面向项目的命令行流程执行
- **Python API** - 将 `chipcompiler` 作为库使用


## 快速开始

### CLI 流程运行

可以使用 `nix run .#cli -- ...` 直接创建 workspace 并执行完整 RTL2GDS 流程。
可以使用 `nix run .#cli -- ...` 创建 ECC 项目,校验 `ecc.toml`,并执行完整 RTL2GDS 流程。

```bash
nix run .#cli -- --workspace ./ws \
--rtl ./rtl/top.v \
--design top \
--top top \
--clock clk \
--pdk-root /path/to/ics55
nix run .#cli -- --workspace ./ws \
--rtl ./rtl/filelist.f \
--design top \
--top top \
--clock clk \
--pdk-root /path/to/ics55 \
--freq 200
nix run .#cli -- init gcd
cp ./rtl/gcd.v gcd/rtl/gcd.v
```

编辑 `gcd/ecc.toml`:

```toml
[design]
name = "gcd"
top = "gcd"
rtl = ["rtl/gcd.v"]
clock_port = "clk"
frequency_mhz = 100.0

[pdk]
name = "ics55"
root = "/path/to/ics55"

[flow]
preset = "rtl2gds"
run = "default"
```

然后校验并运行:

```bash
nix run .#cli -- check --project gcd
nix run .#cli -- run --project gcd
nix run .#cli -- status --project gcd
nix run .#cli -- metrics --project gcd
nix run .#cli -- log --project gcd
```

## 功能特性
Expand Down
49 changes: 34 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,49 @@ ECOS Chip Compiler is an **open-source chip design automation solution** that in
The GUI (ECOS Studio) has been moved to the [ecos-studio](https://github.com/0xharry/ecos-studio) repo.

**How to use:**
- **CLI (`cli`)** - Command-line flow execution
- **CLI (`ecc`)** - Project-oriented command-line flow execution
- **Python API** - Use `chipcompiler` as a library


## Quick Start

### CLI Flow Runner

Use `nix run .#cli -- ...` to create a workspace and run the full RTL2GDS flow directly.
Use `nix run .#cli -- ...` to create an ECC project, validate its `ecc.toml`,
and run the full RTL2GDS flow.

```bash
nix run .#cli -- --workspace ./ws \
--rtl ./rtl/top.v \
--design top \
--top top \
--clock clk \
--pdk-root /path/to/ics55
nix run .#cli -- --workspace ./ws \
--rtl ./rtl/filelist.f \
--design top \
--top top \
--clock clk \
--pdk-root /path/to/ics55 \
--freq 200
nix run .#cli -- init gcd
cp ./rtl/gcd.v gcd/rtl/gcd.v
```

Edit `gcd/ecc.toml`:

```toml
[design]
name = "gcd"
top = "gcd"
rtl = ["rtl/gcd.v"]
clock_port = "clk"
frequency_mhz = 100.0

[pdk]
name = "ics55"
root = "/path/to/ics55"

[flow]
preset = "rtl2gds"
run = "default"
```

Then validate and run:

```bash
nix run .#cli -- check --project gcd
nix run .#cli -- run --project gcd
nix run .#cli -- status --project gcd
nix run .#cli -- metrics --project gcd
nix run .#cli -- log --project gcd
```

## Features
Expand Down
10 changes: 9 additions & 1 deletion chipcompiler/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ py_library(
],
)

py_library(
name = "chipcompiler_cli_lib",
srcs = glob(["cli/**/*.py"]),
deps = [":chipcompiler_core"],
)

py_binary(
name = "chipcompiler_cli",
srcs = ["cli/main.py"],
Expand All @@ -87,5 +93,7 @@ py_binary(
env = {
"CHIPCOMPILER_ICS55_PDK_ROOT": "$(location @icsprout55_pdk//:README.md)/..",
},
deps = [":chipcompiler_core"],
deps = [
":chipcompiler_cli_lib",
],
)
63 changes: 63 additions & 0 deletions chipcompiler/cli/artifacts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import os

from chipcompiler.cli.output import disclosure_cmd

KNOWN_ROLES = {"config", "input", "output", "data", "feature", "report", "log", "script", "analysis"}


def _role_from_dirname(dirname: str) -> str:
return dirname if dirname in KNOWN_ROLES else "unknown"


def discover_artifacts(run_dir: str, step_token: str | None = None,
project: str | None = None,
run_id: str | None = None,
project_dir: str | None = None) -> tuple[list[dict], int]:
from chipcompiler.cli.inspect import discover_step_dirs, read_flow_json, _safe_steps
from chipcompiler.cli.output import normalize_step_name

base_dir = project_dir or os.path.dirname(os.path.dirname(run_dir))
step_dirs = discover_step_dirs(run_dir)

flow_data = read_flow_json(run_dir)
flow_tokens = set()
if flow_data is not None and not isinstance(flow_data, str):
for s in _safe_steps(flow_data):
flow_tokens.add(normalize_step_name(s.get("name", "")))

if step_token is not None:
if step_token not in step_dirs and step_token not in flow_tokens:
return [{"kind": "error", "step": step_token,
"status": "unknown_step"}], 1
if step_token not in step_dirs:
return [], 0
tokens = [step_token]
else:
tokens = sorted(step_dirs.keys())

artifacts = []
for token in tokens:
step_path = step_dirs[token]
for entry in sorted(os.listdir(step_path)):
subdir = os.path.join(step_path, entry)
if not os.path.isdir(subdir):
continue
role = _role_from_dirname(entry)
for root, _, files in os.walk(subdir):
for fname in sorted(files):
fpath = os.path.join(root, fname)
if os.path.isfile(fpath):
artifacts.append({
"kind": "artifact",
"step": token,
"role": role,
"run": run_id or "default",
"path": os.path.relpath(fpath, base_dir),
"exists": True,
"inspect_cmd": disclosure_cmd(f"ecc artifacts {token} --json", project, run_id),
})

if not artifacts:
return [], 0

return artifacts, 0
38 changes: 38 additions & 0 deletions chipcompiler/cli/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from chipcompiler.cli.config import resolve_project_dir
from chipcompiler.cli.inspect import resolve_run_dir
from chipcompiler.cli.types import CommandContext, CommandResult, OutputMode


def build_context(args) -> CommandContext:
project = getattr(args, "project", None)
project_dir = resolve_project_dir(project)

run_id = getattr(args, "run_id", None)
run_dir, run_id = resolve_run_dir(project_dir, run_id)

if getattr(args, "jsonl", False):
mode = OutputMode.JSONL
elif getattr(args, "json", False):
mode = OutputMode.JSON
elif getattr(args, "plain", False):
mode = OutputMode.PLAIN
else:
mode = OutputMode.TEXT

return CommandContext(
project_dir=project_dir,
project=project,
run_dir=run_dir,
run_id=run_id,
output_mode=mode,
)


def dispatch(args, ctx: CommandContext) -> CommandResult:
from chipcompiler.cli import handlers
if args.command == "param":
return handlers.param(args, ctx)
handler = getattr(handlers, args.command, None)
if handler is None:
return CommandResult.err([], exit_code=1)
return handler(args, ctx)
Loading
Loading