Skip to content

Commit

Permalink
intermediate checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
billmcspadden-riscv committed Apr 18, 2024
1 parent 2ce0bc7 commit 0f4e902
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 84 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ C_FLAGS += -O3 -flto
endif

ifneq (,$(SAILCOV))
ALL_BRANCHES = generated_definitions/c/all_branches
ALL_BRANCHES = generated_definitions/c/all_branches_${ARCH}
C_FLAGS += -DSAILCOV
SAIL_FLAGS += -c_coverage $(ALL_BRANCHES) -c_include sail_coverage.h
C_LIBS += $(SAIL_LIB_DIR)/coverage/libsail_coverage.a -lm -lpthread -ldl
Expand Down
10 changes: 5 additions & 5 deletions bin/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ def print_usage(invocation) :
print("error: can't find root directory of repository")
sys.exit(1)
SEARCH_DIR = os.path.dirname(SEARCH_DIR)

print("RISCVDIR: " + RISCVDIR)
MAKE_SAILCOV = "SAILCOV=true"

#RISCVDIR = DIR + '/..'

Expand Down Expand Up @@ -393,7 +393,7 @@ def is_riscv_elf_64(filename) :
print("Building 32-bit RISCV specification...")
if run_csim :
if ARCH == 'RV32' :
cmd = "make ARCH=RV32 SAILCOV=true c_emulator/riscv_sim_RV32"
cmd = "make ARCH=RV32 " + MAKE_SAILCOV + " c_emulator/riscv_sim_RV32"
ret_val = os.system(cmd)
if ret_val == 0 :
green("Building 32-bit RISCV OCaml emulator", "ok")
Expand All @@ -417,7 +417,7 @@ def is_riscv_elf_64(filename) :
sim_switch = sim_test_command_line_switch[key]
break

cmd = "timeout 5 " + RISCVDIR + "/c_emulator/riscv_sim_RV32" + " " + sim_switch + " " + test + " > " + outfile + " 2>&1 && grep -q SUCCESS " + outfile
cmd = "timeout 5 " + RISCVDIR + "/c_emulator/riscv_sim_RV32" + " --sailcov-file sailcov_RV32 " + " " + sim_switch + " " + test + " > " + outfile + " 2>&1 && grep -q SUCCESS " + outfile
print("cmd: '" + cmd + "'")
ret_val = os.system(cmd)
if ret_val == 0 :
Expand Down Expand Up @@ -503,7 +503,7 @@ def is_riscv_elf_64(filename) :
if run_csim :
ARCH = 'RV64'
if ARCH == 'RV64' :
cmd = "make ARCH=RV64 SAILCOV=true c_emulator/riscv_sim_RV64"
cmd = "make ARCH=RV64 " + MAKE_SAILCOV + " c_emulator/riscv_sim_RV64"
ret_val = os.system(cmd)
if ret_val == 0 :
green("Building 64-bit RISCV C emulator", "ok")
Expand All @@ -526,7 +526,7 @@ def is_riscv_elf_64(filename) :
if mo != None:
sim_switch = sim_test_command_line_switch[key]
break
cmd = "timeout 5 " + RISCVDIR + "/c_emulator/riscv_sim_RV64" + " " + sim_switch + " " + test + " > " + outfile + " 2>&1 && grep -q SUCCESS " + outfile
cmd = "timeout 5 " + RISCVDIR + "/c_emulator/riscv_sim_RV64" + " --sailcov-file sailcov_RV64 " + " " + sim_switch + " " + test + " > " + outfile + " 2>&1 && grep -q SUCCESS " + outfile
ret_val = os.system(cmd)
if ret_val == 0 :
green("C-64 " + os.path.basename(test), "ok")
Expand Down
13 changes: 4 additions & 9 deletions new_test/TEST_DIR_ROOT/etrace.testdir/br_j_asm.testdir/test.S
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,13 @@ timer_interrupt_test:
addi x7, x0, TIMER_COUNT

#if __riscv_xlen == 64
// lui x8, ((MMR_MTIMECMPL >> 12) & 0x00000000ffffffff)
li x8, (MMR_MTIMECMPL & 0x00000000ffffffff)
sd x7, (0)(x8)

// lui x8, MMR_MTIMECMPH >> 12
// sw x0, (MMR_MTIMECMPH & 0xfff)(x8)
#else
lui x8, MMR_MTIMECMPL >> 12
sw x7, (MMR_MTIMECMPL & 0xfff)(x8)

lui x8, MMR_MTIMECMPH >> 12
sw x0, (MMR_MTIMECMPH & 0xfff)(x8)
li x8, MMR_MTIMECMPL
sw x7, (0)(x8)
li x8, MMR_MTIMECMPH
sw x0, (0)(x8) // Note: not loading any significant value into MTIMECMPH
#endif

addi x7, x0, MIE_MTIE
Expand Down
138 changes: 69 additions & 69 deletions test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,30 @@ cd $RISCVDIR
make clean

printf "Building 32-bit RISCV specification...\n"
if ARCH=RV32 make ocaml_emulator/riscv_ocaml_sim_RV32 ;
then
green "Building 32-bit RISCV OCaml emulator" "ok"
else
red "Building 32-bit RISCV OCaml emulator" "fail"
fi
for test in $DIR/riscv-tests/rv32*.elf; do
# skip F/D tests on OCaml for now
pat='rv32ud-.+elf'
if [[ $(basename $test) =~ $pat ]];
then continue
fi
pat='rv32uf-.+elf'
if [[ $(basename $test) =~ $pat ]];
then continue
fi
if $RISCVDIR/ocaml_emulator/riscv_ocaml_sim_RV32 "$test" >"${test/.elf/.out}" 2>&1 && grep -q SUCCESS "${test/.elf/.out}"
then
green "OCaml-32 $(basename $test)" "ok"
else
red "OCaml-32 $(basename $test)" "fail"
fi
done
finish_suite "32-bit RISCV OCaml tests"
#if ARCH=RV32 make ocaml_emulator/riscv_ocaml_sim_RV32 ;
#then
# green "Building 32-bit RISCV OCaml emulator" "ok"
#else
# red "Building 32-bit RISCV OCaml emulator" "fail"
#fi
#for test in $DIR/riscv-tests/rv32*.elf; do
# # skip F/D tests on OCaml for now
# pat='rv32ud-.+elf'
# if [[ $(basename $test) =~ $pat ]];
# then continue
# fi
# pat='rv32uf-.+elf'
# if [[ $(basename $test) =~ $pat ]];
# then continue
# fi
# if $RISCVDIR/ocaml_emulator/riscv_ocaml_sim_RV32 "$test" >"${test/.elf/.out}" 2>&1 && grep -q SUCCESS "${test/.elf/.out}"
# then
# green "OCaml-32 $(basename $test)" "ok"
# else
# red "OCaml-32 $(basename $test)" "fail"
# fi
#done
#finish_suite "32-bit RISCV OCaml tests"


if ARCH=RV32 make c_emulator/riscv_sim_RV32;
Expand All @@ -102,30 +102,30 @@ make clean

printf "Building 64-bit RISCV specification...\n"

if make ocaml_emulator/riscv_ocaml_sim_RV64 ;
then
green "Building 64-bit RISCV OCaml emulator" "ok"
else
red "Building 64-bit RISCV OCaml emulator" "fail"
fi
for test in $DIR/riscv-tests/rv64*.elf; do
# skip F/D tests on OCaml for now
pat='rv64ud-.+elf'
if [[ $(basename $test) =~ $pat ]];
then continue
fi
pat='rv64uf-.+elf'
if [[ $(basename $test) =~ $pat ]];
then continue
fi
if $RISCVDIR/ocaml_emulator/riscv_ocaml_sim_RV64 "$test" >"${test/.elf/.out}" 2>&1 && grep -q SUCCESS "${test/.elf/.out}"
then
green "OCaml-64 $(basename $test)" "ok"
else
red "OCaml-64 $(basename $test)" "fail"
fi
done
finish_suite "64-bit RISCV OCaml tests"
#if make ocaml_emulator/riscv_ocaml_sim_RV64 ;
#then
# green "Building 64-bit RISCV OCaml emulator" "ok"
#else
# red "Building 64-bit RISCV OCaml emulator" "fail"
#fi
#for test in $DIR/riscv-tests/rv64*.elf; do
# # skip F/D tests on OCaml for now
# pat='rv64ud-.+elf'
# if [[ $(basename $test) =~ $pat ]];
# then continue
# fi
# pat='rv64uf-.+elf'
# if [[ $(basename $test) =~ $pat ]];
# then continue
# fi
# if $RISCVDIR/ocaml_emulator/riscv_ocaml_sim_RV64 "$test" >"${test/.elf/.out}" 2>&1 && grep -q SUCCESS "${test/.elf/.out}"
# then
# green "OCaml-64 $(basename $test)" "ok"
# else
# red "OCaml-64 $(basename $test)" "fail"
# fi
#done
#finish_suite "64-bit RISCV OCaml tests"

if make c_emulator/riscv_sim_RV64;
then
Expand All @@ -143,27 +143,27 @@ for test in $DIR/riscv-tests/rv64*.elf; do
done
finish_suite "64-bit RISCV C tests"

# Do 'make clean' to avoid cross-arch pollution.
make clean

if ARCH=RV32 make c_emulator/riscv_rvfi_RV32;
then
green "Building 32-bit RISCV RVFI C emulator" "ok"
else
red "Building 32-bit RISCV RVFI C emulator" "fail"
fi
finish_suite "32-bit RISCV RVFI C tests"

# Do 'make clean' to avoid cross-arch pollution.
make clean

if ARCH=RV64 make c_emulator/riscv_rvfi_RV64;
then
green "Building 64-bit RISCV RVFI C emulator" "ok"
else
red "Building 64-bit RISCV RVFI C emulator" "fail"
fi
finish_suite "64-bit RISCV RVFI C tests"
## Do 'make clean' to avoid cross-arch pollution.
#make clean
#
#if ARCH=RV32 make c_emulator/riscv_rvfi_RV32;
#then
# green "Building 32-bit RISCV RVFI C emulator" "ok"
#else
# red "Building 32-bit RISCV RVFI C emulator" "fail"
#fi
#finish_suite "32-bit RISCV RVFI C tests"
#
## Do 'make clean' to avoid cross-arch pollution.
#make clean
#
#if ARCH=RV64 make c_emulator/riscv_rvfi_RV64;
#then
# green "Building 64-bit RISCV RVFI C emulator" "ok"
#else
# red "Building 64-bit RISCV RVFI C emulator" "fail"
#fi
#finish_suite "64-bit RISCV RVFI C tests"

printf "Passed ${all_pass} out of $(( all_pass + all_fail ))\n\n"
XML="<testsuites tests=\"$(( all_pass + all_fail ))\" failures=\"${all_fail}\">\n$SUITES_XML</testsuites>\n"
Expand Down

0 comments on commit 0f4e902

Please sign in to comment.