Skip to content

Commit

Permalink
Started to add exit status handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain Haugou committed Mar 24, 2016
1 parent 545a814 commit e681beb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tb/tb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
`define REF_CLK_PERIOD (2*15.25us) // 32.786 kHz --> FLL reset value --> 50 MHz
`define CLK_PERIOD 20.00ns // 25 MHz

`define EXIT_SUCCESS 0
`define EXIT_FAIL 1
`define EXIT_ERROR -1

module tb;
timeunit 1ns;
timeprecision 1ps;
Expand All @@ -14,6 +18,8 @@ module tb;
parameter BAUDRATE = 781250; // 1562500
parameter CLK_USE_FLL = 0; // 0 or 1

int exit_status = `EXIT_ERROR; // modelsim exit code, will be overwritten when successfull

string memload;
logic s_clk = 1'b0;
logic s_rst_n = 1'b0;
Expand Down
6 changes: 6 additions & 0 deletions vsim/tcl_files/config/vsim.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ set cmd "vsim -quiet $TB \
$VSIM_FLAGS"

eval $cmd

# check exit status in tb and quit the simulation accordingly
proc run_and_exit {} {
run -all
quit -code [examine -radix decimal sim:/tb/exit_status]
}

0 comments on commit e681beb

Please sign in to comment.