3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-01-18 16:28:57 +00:00

Fix regex to match only 'wires' and 'ports' lines

The regex was matching 'public wires' and other lines. Now use $ anchor
to match only lines ending with 'wires' or 'ports'.
This commit is contained in:
Natalia 2026-01-14 14:57:07 -08:00
parent b6715cf74d
commit 8f80f8f655

View file

@ -7,11 +7,11 @@ proc read_stats { file } {
set ports 0
set nets 0
foreach line [split $result "\n"] {
# Match upstream yosys stat format - be permissive about whitespace
if [regexp {([0-9]+).*wires} $line -> n] {
# Match only lines ending with "wires" or "ports" (not "public wires", "wire bits", etc)
if [regexp {([0-9]+)[ \t]+wires[ \t]*$} $line -> n] {
set nets [expr $nets + $n]
}
if [regexp {([0-9]+).*ports} $line -> n] {
if [regexp {([0-9]+)[ \t]+ports[ \t]*$} $line -> n] {
set ports [expr $ports + $n]
}
}