diff --git a/.github/workflows/validate-constraints.yml b/.github/workflows/validate-constraints.yml index ac19d9d..fe8a82c 100644 --- a/.github/workflows/validate-constraints.yml +++ b/.github/workflows/validate-constraints.yml @@ -56,7 +56,14 @@ jobs: - name: Run SDC validator run: | + set +e tclsh scripts/validate_sdc.tcl --all + rc=$? + set -e + # Exit code 0 = pass, 1 = warnings (allowed), 2 = errors (fail) + if [ "$rc" -eq 2 ]; then + exit 2 + fi - name: Print SDC summary if: always() diff --git a/scripts/validate_sdc.tcl b/scripts/validate_sdc.tcl index a7f52d8..cddc071 100644 --- a/scripts/validate_sdc.tcl +++ b/scripts/validate_sdc.tcl @@ -23,7 +23,12 @@ set warnings 0 proc report {severity lineno msg} { global errors warnings - set icon [dict get {ERROR "๐Ÿ”ด" WARNING "๐ŸŸก" INFO "๐Ÿ”ต"} $severity "ยท"] + set severity_icons [dict create ERROR "๐Ÿ”ด" WARNING "๐ŸŸก" INFO "๐Ÿ”ต"] + if {[dict exists $severity_icons $severity]} { + set icon [dict get $severity_icons $severity] + } else { + set icon "ยท" + } if {$lineno > 0} { puts " $icon \[$severity\] line $lineno: $msg" } else { @@ -101,7 +106,7 @@ proc validate_sdc {filepath} { } # Catch common SDC typos - if {[regexp {-period\s+([\d.]+)} $trimmed -> period]} { + if {[regexp -- {-period\s+([\d.]+)} $trimmed -> period]} { if {$period < 1.0} { report WARNING $lineno "Very short clock period ${period}ns ([expr {1000.0/$period}] MHz) โ€” verify" }