Skip to content

Commit

Permalink
Handle Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Aug 30, 2023
1 parent 4d7fb9f commit 2a21f8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/tcl_commands/synthesis.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ proc run_verilator {} {
lappend arg_list {*}$defines

puts_info "Running linter (Verilator) (log: [relpath . $log])..."
try_exec verilator \
catch_exec verilator \
-Wall \
--lint-only \
--Wno-DECLFILENAME \
Expand All @@ -335,7 +335,7 @@ proc run_verilator {} {

set timing_errors [exec bash -c "grep -i 'Error-NEEDTIMINGOPT' $log || true"]
if { $timing_errors ne "" } {
set msg "Timing constructs found in the RTL. Please remove them or wrap them around an ifdef. It heavily unrecommended to rely on timing constructs for synthesis."
set msg "Timing constructs found in the RTL. Please remove them or add a preprocessor guard. It is heavily discouraged to rely on timing constructs in synthesis."
if { $::env(QUIT_ON_LINTER_ERRORS) } {
puts_err $msg
throw_error
Expand Down
7 changes: 5 additions & 2 deletions scripts/utils/utils.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,16 @@ proc set_and_log {var val} {
close $global_cfg_file
}

proc try_exec {args} {
# puts_info "Executing \"$args\"\n"
proc catch_exec {args} {
if { ! [catch { set cmd_log_file [open $::env(RUN_DIR)/cmds.log a+] } ]} {
set timestamp [clock format [clock seconds]]
puts $cmd_log_file "$timestamp - Executing \"$args\"\n"
close $cmd_log_file
}
catch {eval exec $args}
}

proc try_exec {args} {
set exit_code [catch {eval exec $args} error_msg]
if { $exit_code } {
set tool [string range $args 0 [string first " " $args]]
Expand Down

0 comments on commit 2a21f8e

Please sign in to comment.