mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-18 02:16:41 +00:00
Valid SMT is emitted, improved test script
This commit is contained in:
parent
71aaa1c80d
commit
b98210d8ac
2 changed files with 86 additions and 40 deletions
|
@ -54,29 +54,29 @@ run_smt_test() {
|
|||
# TODO: which SMT solver should be run?
|
||||
if z3 "${base_name}.smt2"; then
|
||||
echo "SMT file ${base_name}.smt2 is valid ."
|
||||
smt_successful_files["$rtlil_file"]="Success"
|
||||
# if python3 using_smtio.py "${base_name}.smt2"; then
|
||||
# echo "Python script generated VCD file for $rtlil_file successfully."
|
||||
|
||||
if python3 using_smtio.py "${base_name}.smt2"; then
|
||||
echo "Python script generated VCD file for $rtlil_file successfully."
|
||||
# if [ -f "${base_name}.smt2.vcd" ]; then
|
||||
# echo "VCD file ${base_name}.vcd generated successfully by Python."
|
||||
|
||||
if [ -f "${base_name}.smt2.vcd" ]; then
|
||||
echo "VCD file ${base_name}.vcd generated successfully by Python."
|
||||
|
||||
if ${BASE_PATH}yosys -p "read_rtlil $rtlil_file; sim -vcd ${base_name}_yosys.vcd -r ${base_name}.smt2.vcd -scope gold -timescale 1us"; then
|
||||
echo "Yosys simulation for $rtlil_file completed successfully."
|
||||
smt_successful_files["$rtlil_file"]="Success"
|
||||
else
|
||||
echo "Yosys simulation failed for $rtlil_file."
|
||||
smt_failing_files["$rtlil_file"]="Yosys simulation failure"
|
||||
fi
|
||||
else
|
||||
# if ${BASE_PATH}yosys -p "read_rtlil $rtlil_file; sim -vcd ${base_name}_yosys.vcd -r ${base_name}.smt2.vcd -scope gold -timescale 1us"; then
|
||||
# echo "Yosys simulation for $rtlil_file completed successfully."
|
||||
# smt_successful_files["$rtlil_file"]="Success"
|
||||
# else
|
||||
# echo "Yosys simulation failed for $rtlil_file."
|
||||
# smt_failing_files["$rtlil_file"]="Yosys simulation failure"
|
||||
# fi
|
||||
# else
|
||||
|
||||
echo "Failed to generate VCD file (${base_name}.vcd) for $rtlil_file. "
|
||||
smt_failing_files["$rtlil_file"]="VCD generation failure"
|
||||
fi
|
||||
else
|
||||
echo "Failed to run Python script for $rtlil_file."
|
||||
smt_failing_files["$rtlil_file"]="Python script failure"
|
||||
fi
|
||||
# echo "Failed to generate VCD file (${base_name}.vcd) for $rtlil_file. "
|
||||
# smt_failing_files["$rtlil_file"]="VCD generation failure"
|
||||
# fi
|
||||
# else
|
||||
# echo "Failed to run Python script for $rtlil_file."
|
||||
# smt_failing_files["$rtlil_file"]="Python script failure"
|
||||
# fi
|
||||
else
|
||||
echo "SMT file for $rtlil_file is invalid"
|
||||
smt_failing_files["$rtlil_file"]="Invalid SMT"
|
||||
|
@ -135,6 +135,33 @@ run_all_tests() {
|
|||
return $return_code
|
||||
}
|
||||
|
||||
run_smt_tests() {
|
||||
return_code=0
|
||||
for rtlil_file in rtlil/*.il; do
|
||||
run_smt_test "$rtlil_file"
|
||||
done
|
||||
|
||||
echo "SMT tests results:"
|
||||
if [ ${#smt_failing_files[@]} -eq 0 ]; then
|
||||
echo "All files passed."
|
||||
echo "The following files passed:"
|
||||
for file in "${!smt_successful_files[@]}"; do
|
||||
echo "$file"
|
||||
done
|
||||
else
|
||||
echo "The following files failed:"
|
||||
for file in "${!smt_failing_files[@]}"; do
|
||||
echo "$file: ${smt_failing_files[$file]}"
|
||||
done
|
||||
echo "The following files passed:"
|
||||
for file in "${!smt_successful_files[@]}"; do
|
||||
echo "$file"
|
||||
done
|
||||
return_code=1
|
||||
fi
|
||||
return $return_code
|
||||
}
|
||||
|
||||
# If the script is being sourced, do not execute the tests
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
run_all_tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue