Skip to content

Commit 75a5c58

Browse files
committed
Merge branch 'master' of https://github.com/The-OpenROAD-Project-private/OpenROAD into grt_fill_via
2 parents ed4cfb5 + d1719d5 commit 75a5c58

31 files changed

Lines changed: 615 additions & 65 deletions

.claude/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.agents/skills

.gemini/commands/triage-issue.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description = "Triage an OpenROAD GitHub issue by reproducing the bug and minimizing the test case with whittle.py. Use when an issue has an attached tarball artifact (.tar.gz) from `make *_issue`."
2+
prompt = "Activate the triage-issue skill and triage the following issue: {{args}}"

.gemini/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"context": {
3+
"fileName": "AGENTS.md"
4+
}
5+
}

AGENTS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# OpenROAD - AI agent context
2+
3+
This file provides project-specific guidance for AI agent sessions working on the OpenROAD codebase.
4+
5+
## Quick Reference
6+
7+
Detailed guides are in `docs/agents/` subdirectory:
8+
9+
- **Build Pitfalls**: See `docs/agents/build.md`
10+
- **Testing Guide**: See `docs/agents/testing.md`
11+
- **Git & CI**: See `docs/agents/ci.md`
12+
- **Coding Patterns**: See `docs/agents/coding.md`
13+
14+
## Critical Rules
15+
16+
1. **Never modify `src/sta/` files** -- OpenSTA is managed upstream (`Sdc.cc`, `Power.cc`, `Sdc.tcl`, etc.). **Only test files may be modified.** All fixes must be in OpenROAD code (e.g., `src/dbSta/`, `src/rsz/`). If OpenSTA code change is inevitable, notify user. Exception: you *may* modify `src/sta/` files temporarily for **debugging purposes** only.
17+
2. Run `clang-format -i <files>` for C++ files before commit. **NEVER** for `src/sta/*` and `*.i` files.
18+
3. **Always use `git commit -s`** for DCO compliance.
19+
4. When amending submodule commits, parent repo submodule reference must also be updated via `git submodule update --init --recursive`. It is needed after any merge/pull.
20+
5. **Trace bugs upstream** -- when a bug appears in output (e.g., Verilog), find the data creation point (e.g., `buffer_ports`, `remove_buffers`), not the serialization point (e.g., `VerilogWriter`).

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

docs/agents/build.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# OpenROAD Build Pitfalls
2+
3+
## Debug vs Release Build Behavior Differences
4+
5+
When tests pass locally (Debug) but fail in CI (Release), check for:
6+
- **Uninitialized members**: Debug zero-initializes memory; Release leaves garbage
7+
- **nullptr through custom hashers**: e.g., `PinIdHash::operator()(nullptr)` segfaults in Release only
8+
- **Subnormal float values**: Uninitialized floats may be zero in Debug but subnormal in Release
9+
10+
## Shared Library RPATH vs LD_LIBRARY_PATH
11+
12+
External tool binaries (e.g., kepler-formal) have RPATH baked in pointing to the original install location. After rebuilding a dependency, you must either `cmake --install` to the RPATH location or use `LD_PRELOAD`/`patchelf`. Setting `LD_LIBRARY_PATH` alone may be insufficient if RPATH takes precedence.

docs/agents/ci.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# CI Workflow
2+
3+
## Pull Requests
4+
5+
### Never Close/Reopen a PR to Retrigger CI
6+
Never close a public PR to retrigger CI -- `gh pr reopen` requires **admin permissions**. To retrigger CI, use empty commits instead:
7+
```bash
8+
git commit --allow-empty -s -m "retrigger CI"
9+
```
10+
11+
### `gh pr checks` Exit Code 8
12+
Exit code 8 means some checks are still pending -- not an error.
13+
14+
### Clang-Tidy CI
15+
Clang-Tidy CI can fail not only for code issues but also for **unresolved review comments** on the PR. Review threads cannot be resolved via API on public repos -- must be done on the GitHub web UI.
16+
17+
## CI Artifacts
18+
19+
- Use distinct filenames for public vs private artifacts (never overwrite one with the other)
20+
- Files >4GB may need `7z x` or `python3 -m zipfile -e` instead of `unzip`
21+
- When possible, download only specific `metadata.json` files instead of the full archive
22+
- Do not commit `metadata-base-ok.json` -- we have decided not to manage this file.
23+
24+
## Private-to-Staging Sync
25+
26+
To sync a private repo PR to the staging (public) repo:
27+
1. Push commits to the **private repo** (`The-OpenROAD-Project-private/OpenROAD`)
28+
2. Add the label **"Ready To Sync Public"** on the **private repo PR**
29+
30+
**Important**: The label is **consumed** after each sync (removed by the sync bot). After pushing new commits, you must **re-add** the label. If the label already exists, remove it first, then re-add to trigger the workflow.

docs/agents/coding.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# OpenROAD Coding Patterns
2+
3+
## Style Rules
4+
5+
### General C++ Guidelines
6+
- Follow the Google C++ Style Guide.
7+
- Use modern C++20 style and features.
8+
- Apply `const` qualifiers whenever possible.
9+
10+
### Type Declarations
11+
- Use C++ casts, not C-style casts
12+
13+
### Braces
14+
- Use `{...}` even for single-line statements
15+
16+
### Comments
17+
- Do not remove existing comments
18+
- Recommend adding a single line comment for each important code block
19+
- All comments must be in English
20+
21+
### Function Length
22+
- Factor out into multiple functions if a function exceeds 100 lines
23+
- Exception: Unit tests can have long functions
24+
25+
### Null Safety
26+
- Avoid adding too defensive null checks if the object cannot be null
27+
28+
## Common Coding Mistakes
29+
30+
### OpenROAD Message ID Duplicate Checker
31+
`etc/find_messages.py` uses regex to match **literal numeric IDs** in `logger->xxx(MODULE, NNNN, ...)` calls. When duplicating a message across modules, use named constants to bypass the checker:
32+
```cpp
33+
constexpr int kMsgIdBufferInserted = 1234;
34+
logger_->info(RSZ, kMsgIdBufferInserted, "...");
35+
```
36+

docs/agents/testing.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# OpenROAD Testing Guide
2+
3+
OpenROAD has two types of tests: **integration tests** (Tcl) and **unit tests** (C++).
4+
5+
## CAUTION -- Dual Registration Required
6+
7+
**Every new test MUST be registered in BOTH build systems. Missing either one is a build break.**
8+
9+
| Build System | Registration File | Block/Macro |
10+
|-------------|-------------------|-------------|
11+
| **CMake** | `src/<module>/test/CMakeLists.txt` | `or_integration_tests(...)` |
12+
| **Bazel** | `src/<module>/test/BUILD` | `regression_test(...)` |
13+
14+
Forgetting the Bazel `BUILD` file is the most common mistake -- CMake-only registration
15+
silently passes local `make test` but the **test will be missing from Bazel CI**.
16+
17+
## Integration Tests
18+
19+
Integration tests are Tcl scripts located at `src/<module>/test` or `src/<module>/test/tcl`.
20+
21+
### Running Integration Tests
22+
23+
`./regression` is a ctest wrapper that filters by module label.
24+
25+
```bash
26+
cd src/rsz/test
27+
./regression -R buffer_ports1 # run one test (regex match)
28+
./regression -R "repair.*hier" # run tests matching pattern
29+
./regression -j4 -V # all rsz tests, parallel, verbose
30+
31+
# Or equivalently from the build directory:
32+
cd build
33+
ctest -R "rsz\.buffer_ports1\.tcl"
34+
```
35+
36+
### Creating a New Integration Test
37+
38+
Best practice reference: `src/rsz/test/repair_tie12_hier.tcl`
39+
40+
1. **Header comment**: First line must explain the test purpose
41+
```tcl
42+
# [Brief description of the test]
43+
```
44+
45+
2. **Set test name**: Used for output file generation
46+
```tcl
47+
set test_name <integration_test_name>
48+
```
49+
50+
3. **Output naming with `make_result_file`**: Use for temporary output files
51+
```tcl
52+
set verilog_filename "${test_name}.v"
53+
set out_verilog [make_result_file $verilog_filename]
54+
write_verilog $out_verilog
55+
```
56+
57+
4. **Verification with `diff_file`**: Compare against golden files
58+
```tcl
59+
diff_file ${test_name}.vok $out_verilog
60+
```
61+
62+
5. **Generate `<test_name>.ok` file**: Create golden test log by executing the script, redirecting stdout, and removing the openroad banner at the top.
63+
64+
6. **Registration (BOTH files for CMake and Bazel -- do NOT skip Bazel)**
65+
66+
### Test Framework Flags
67+
- `-no_splash -no_init -exit`
68+
69+
### Golden File Notes
70+
- `.ok` = log golden file (full stdout), `.vok` = verilog golden file
71+
- **`diff_file` reports only the first difference** -- when regenerating golden files, regenerate the entire output file rather than relying on incremental diffs.
72+
73+
## Unit Tests
74+
75+
Unit tests are C++ files located at `src/<module>/test/cpp`.
76+
77+
### Test Registration
78+
- CMake: `src/<module>/test/CMakeLists.txt`
79+
- Bazel: `src/<module>/test/BUILD` or `src/<module>/test/cpp/BUILD`

0 commit comments

Comments
 (0)