3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-01-17 16:06:27 +00:00

Simplify regex to be more permissive

Make the regex less strict about exact whitespace and format. Just look
for a number followed by 'wires' or 'ports' anywhere on the line.
This commit is contained in:
Natalia 2026-01-14 13:59:26 -08:00
parent 1b592c7f8d
commit b6715cf74d

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: " <count> <area> wires"
if [regexp {^[ \t]*([0-9]+)[ \t]+[0-9.]+[ \t]+wires[ \t]*$} $line -> n] {
# Match upstream yosys stat format - be permissive about whitespace
if [regexp {([0-9]+).*wires} $line -> n] {
set nets [expr $nets + $n]
}
if [regexp {^[ \t]*([0-9]+)[ \t]+[0-9.]+[ \t]+ports[ \t]*$} $line -> n] {
if [regexp {([0-9]+).*ports} $line -> n] {
set ports [expr $ports + $n]
}
}