Skip to content

Commit 8cc86e2

Browse files
authored
Merge pull request #10088 from The-OpenROAD-Project-staging/update_or_sta_sdcparser_primapocv_take2
Update or sta sdcparser primapocv take2
2 parents d22045c + 1f60b6d commit 8cc86e2

7 files changed

Lines changed: 94 additions & 4 deletions

File tree

.github/workflows/github-actions-clang-tidy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
build_dir: "./build"
2222
cmake_command: cmake . -B build $(cat /etc/openroad_deps_prefixes.txt)
2323
config_file: ".clang-tidy"
24-
exclude: "*/codeGenerator/templates/*,third-party/*,test/orfs/*"
24+
exclude: "*/codeGenerator/templates/*,third-party/*,test/orfs/*,bazel/*"
2525
split_workflow: true
2626
apt_packages: libomp-15-dev,libfl-dev,libyaml-cpp-dev
2727
- uses: The-OpenROAD-Project/clang-tidy-review/upload@master

bazel/tcl_library_init.cc

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
#if TCL_MAJOR_VERSION >= 9 && !defined(USE_TCL_RUNFILE_INIT)
1616
#include "bazel/tcl_resources_zip_data.h"
1717
#else
18+
#ifdef __linux__
19+
#include <linux/limits.h>
20+
#include <unistd.h>
21+
#endif
22+
1823
#include <memory>
1924

2025
#include "rules_cc/cc/runfiles/runfiles.h"
@@ -36,8 +41,26 @@ static std::optional<std::string> TclLibraryMountPoint(Tcl_Interp* interp)
3641
#else
3742
using rules_cc::cc::runfiles::Runfiles;
3843
std::string error;
39-
std::unique_ptr<Runfiles> runfiles(Runfiles::Create(
40-
Tcl_GetNameOfExecutable(), BAZEL_CURRENT_REPOSITORY, &error));
44+
// Use /proc/self/exe to resolve the real binary path, as argv[0] may
45+
// point into a sandbox where the .runfiles tree does not exist.
46+
std::string exe_path;
47+
#ifdef __linux__
48+
char buf[PATH_MAX + 1];
49+
ssize_t len = readlink("/proc/self/exe", buf, PATH_MAX);
50+
if (len > 0 && len < PATH_MAX) {
51+
exe_path.assign(buf, len);
52+
} else {
53+
if (len >= PATH_MAX) {
54+
std::cerr << "[Error] /proc/self/exe path too long (>= PATH_MAX); "
55+
"falling back to Tcl_GetNameOfExecutable()\n";
56+
}
57+
exe_path = Tcl_GetNameOfExecutable();
58+
}
59+
#else
60+
exe_path = Tcl_GetNameOfExecutable();
61+
#endif
62+
std::unique_ptr<Runfiles> runfiles(
63+
Runfiles::Create(exe_path, BAZEL_CURRENT_REPOSITORY, &error));
4164
if (!runfiles) {
4265
std::cerr << "[Warning] Failed to create bazel runfiles: " << error << "\n";
4366
return std::nullopt;

src/dbSta/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ or_integration_tests(
1919
make_port
2020
network_edit1
2121
power1
22+
read_def_bus_port
2223
read_liberty1
2324
read_vcd
2425
read_verilog1
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
VERSION 5.8 ;
2+
DIVIDERCHAR "/" ;
3+
BUSBITCHARS "[]" ;
4+
DESIGN test_bus_port ;
5+
UNITS DISTANCE MICRONS 1000 ;
6+
DIEAREA ( 0 0 ) ( 100000 100000 ) ;
7+
8+
PINS 9 ;
9+
- kv_write[3][write_en] + NET kv_write\[3\]\[write_en\] + DIRECTION INPUT + USE SIGNAL ;
10+
- kv_write[3][write_entry][4] + NET kv_write\[3\]\[write_entry\]\[4\] + DIRECTION INPUT + USE SIGNAL ;
11+
- kv_write[3][write_entry][3] + NET kv_write\[3\]\[write_entry\]\[3\] + DIRECTION INPUT + USE SIGNAL ;
12+
- kv_write[3][write_entry][2] + NET kv_write\[3\]\[write_entry\]\[2\] + DIRECTION INPUT + USE SIGNAL ;
13+
- kv_write[3][write_entry][1] + NET kv_write\[3\]\[write_entry\]\[1\] + DIRECTION INPUT + USE SIGNAL ;
14+
- kv_write[3][write_entry][0] + NET kv_write\[3\]\[write_entry\]\[0\] + DIRECTION INPUT + USE SIGNAL ;
15+
- kv_write[3][write_offset][3] + NET kv_write\[3\]\[write_offset\]\[3\] + DIRECTION INPUT + USE SIGNAL ;
16+
- kv_write[3][write_offset][2] + NET kv_write\[3\]\[write_offset\]\[2\] + DIRECTION INPUT + USE SIGNAL ;
17+
- clk + NET clk + DIRECTION INPUT + USE CLOCK ;
18+
END PINS
19+
20+
NETS 9 ;
21+
- kv_write\[3\]\[write_en\] ( PIN kv_write[3][write_en] ) ;
22+
- kv_write\[3\]\[write_entry\]\[4\] ( PIN kv_write[3][write_entry][4] ) ;
23+
- kv_write\[3\]\[write_entry\]\[3\] ( PIN kv_write[3][write_entry][3] ) ;
24+
- kv_write\[3\]\[write_entry\]\[2\] ( PIN kv_write[3][write_entry][2] ) ;
25+
- kv_write\[3\]\[write_entry\]\[1\] ( PIN kv_write[3][write_entry][1] ) ;
26+
- kv_write\[3\]\[write_entry\]\[0\] ( PIN kv_write[3][write_entry][0] ) ;
27+
- kv_write\[3\]\[write_offset\]\[3\] ( PIN kv_write[3][write_offset][3] ) ;
28+
- kv_write\[3\]\[write_offset\]\[2\] ( PIN kv_write[3][write_offset][2] ) ;
29+
- clk ( PIN clk ) ;
30+
END NETS
31+
32+
END DESIGN
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: test_bus_port
3+
[INFO ODB-0130] Created 9 pins.
4+
[INFO ODB-0133] Created 9 nets and 0 connections.
5+
port_count: 9
6+
scalar: kv_write[3][write_en]
7+
write_entry_count: 5
8+
write_offset_count: 2
9+
clk: clk
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Test that read_def handles port names with non-numeric bus subscripts
2+
# like kv_write[3][write_en] without crashing (stoi in parseBusName).
3+
# Also verify that ports with numeric trailing subscripts are grouped
4+
# into buses correctly.
5+
source "helpers.tcl"
6+
7+
read_lef Nangate45/Nangate45.lef
8+
read_def read_def_bus_port.def
9+
10+
# Verify read_def completed (no crash on non-numeric subscripts)
11+
set all_ports [get_ports *]
12+
puts "port_count: [llength $all_ports]"
13+
14+
# Scalar port with non-numeric subscript should exist
15+
puts "scalar: [get_name [get_ports {kv_write[3][write_en]}]]"
16+
17+
# Bus ports: kv_write[3][write_entry] should be grouped (bits 0-4)
18+
set entry_ports [get_ports {kv_write[3][write_entry][*]}]
19+
puts "write_entry_count: [llength $entry_ports]"
20+
21+
# Bus ports: kv_write[3][write_offset] should be grouped (bits 2-3)
22+
set offset_ports [get_ports {kv_write[3][write_offset][*]}]
23+
puts "write_offset_count: [llength $offset_ports]"
24+
25+
puts "clk: [get_name [get_ports clk]]"

src/sta

Submodule sta updated 176 files

0 commit comments

Comments
 (0)