Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/validate-constraints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 7 additions & 2 deletions scripts/validate_sdc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
}
Expand Down
Loading