forked from secworks/sha256
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.tcl
More file actions
35 lines (28 loc) · 877 Bytes
/
run_tests.tcl
File metadata and controls
35 lines (28 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# run_tests.tcl
# Automated Icarus Verilog simulation for SHA256 Core
set test_list {
my_tb_sha256_core
}
foreach test $test_list {
set log "${test}_log.txt"
puts "Running $test ..."
set compile_cmd "iverilog -o ${test}.out src/rtl/sha256_core.v src/rtl/sha256_k_constants.v src/rtl/sha256_w_mem.v src/tb/${test}.v"
set run_cmd "vvp ${test}.out > $log"
if {[catch {exec sh -c $compile_cmd} err]} {
puts "❌ Compile failed: $err"
continue
}
if {[catch {exec sh -c $run_cmd} err]} {
puts "❌ Simulation failed: $err"
continue
}
# Check the log for FAIL
set fh [open $log r]
set contents [read $fh]
close $fh
if {[string match *FAIL* $contents]} {
puts "$test ... FAIL (see $log)"
} else {
puts "$test ... PASS"
}
}