Add support for using branch as CVW_GIT and use 1 as enable for knobs.

This commit is contained in:
Kunlin Han 2024-04-16 11:54:49 -07:00
parent 29c19d9cb4
commit 9d91b9d6f2
4 changed files with 36 additions and 15 deletions

View file

@ -9,6 +9,7 @@ USER root
COPY --chown=${USERNAME}:${USERNAME} . /home/${USERNAME}
RUN chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
RUN chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/cvw
USER ${USERNAME}
WORKDIR /home/${USERNAME}/cvw

18
docs/docker/Makefile Normal file
View file

@ -0,0 +1,18 @@
QUESTA_HOME?=/cad/mentor/questa_sim-2023.4
CVW_GIT?=""
commanline:
podman run -it --rm \
-v cvw_temp:/home/cad/cvw \
-v $(QUESTA_HOME):/cad/mentor/questa_sim-xxxx.x_x \
--privileged --network=host \
wallysoc/regression_wally /bin/bash
regression_openhw_cvw:
podman run \
-e CVW_GIT=$(CVW_GIT) \
-e CLEAN_CVW=1 -e BUILD_RISCOF=1 -e RUN_QUESTA=1 \
-v cvw_temp:/home/cad/cvw \
-v $(QUESTA_HOME):/cad/mentor/questa_sim-xxxx.x_x \
--privileged --network=host \
--rm wallysoc/regression_wally

View file

@ -21,7 +21,7 @@ If you have any other questions, please read the [troubleshooting]() first.
- `xhost +localhost:${USER}` for host
- [x] Regression Script
- [x] Configure the license for Questa
- [ ] Change the condition from empty string to 1
- [x] Change the condition from empty string to 1
- [x] Add linux testvector-generation
- [x] Estimate the useless building intermediate files
@ -98,7 +98,7 @@ podman volume create cvw_temp
# run regression on the OpenHW/cvw
podman run \
-e CLEAN_CVW= -e BUILD_RISCOF= -e RUN_QUESTA= \
-e CLEAN_CVW=1 -e BUILD_RISCOF=1 -e RUN_QUESTA=1 \
-v cvw_temp:/home/cad/cvw \
-v /cad/mentor/questa_sim-2023.4:/cad/mentor/questa_sim-xxxx.x_x \
--privileged --network=host \
@ -106,7 +106,7 @@ podman run \
# run regression on the Karl-Han/cvw
podman run \
-e CLEAN_CVW= -e BUILD_RISCOF= -e RUN_QUESTA= \
-e CLEAN_CVW=1 -e BUILD_RISCOF=1 -e RUN_QUESTA=1 \
-e CVW_GIT=https://github.com/Karl-Han/cvw \
-v cvw_temp:/home/cad/cvw \
-v /cad/mentor/questa_sim-2023.4:/cad/mentor/questa_sim-xxxx.x_x \
@ -115,7 +115,7 @@ podman run \
# get into the container command line to debug or reading files
podman run -it \
-e RUN_QUESTA= \
-e RUN_QUESTA=1 \
-v cvw_temp:/home/cad/cvw \
-v /cad/mentor/questa_sim-2023.4:/cad/mentor/questa_sim-xxxx.x_x \
--privileged --network=host \
@ -242,10 +242,10 @@ There are three main knobs:
Options:
- CVW_GIT: git clone address, only main branch supported
- CLEAN_CVW: declared with empty string to clone
- BUILD_RISCOF: declared with empty string to rebuild RISCOF
- RUN_QUESTA: declared with empty string to run vsim to check
- CVW_GIT: git clone address
- CLEAN_CVW: clone CVW_GIT if enabled with `-e CLEAN_CVW=1`
- BUILD_RISCOF: rebuild RISCOF if enabled with `-e BUILD_RISCOF=1`
- RUN_QUESTA: run vsim to check if enabled with `-e RUN_QUESTA=1`
- QUESTA: home folder for mounted QuestaSIM `/cad/mentor/questa_sim-xxxx.x_x` if enabled
- for example, if your vsim is in `/cad/mentor/questa_sim-2023.4/questasim/bin/vsim` then your local QuestaSIM folder is `/cad/mentor/questa_sim-2023.4`, so you have to add `-v /cad/mentor/questa_sim-2023.4:/cad/mentor/questa_sim-xxxx.x_x -e RUN_QUESTA=1`
@ -295,8 +295,7 @@ There are stages in the old Dockerfile:
Description: permission problem in `/home/$USERNAME/cvw`.
```text
$ podman run -v cvw_temp:/home/cad/cvw -e CLEAN_CVW= -e BUILD_RISCOF= -e RUN_QUESTA= -v /cad/mentor/que
sta_sim-2023.4:/cad/mentor/questa_sim-xxxx.x_x --rm wallysoc/regression_wally
$ podman run -v cvw_temp:/home/cad/cvw -e CLEAN_CVW=1 -e BUILD_RISCOF=1 -e RUN_QUESTA=1 -v /cad/mentor/questa_sim-2023.4:/cad/mentor/questa_sim-xxxx.x_x --rm wallysoc/regression_wally
No CVW_GIT is provided
rm: cannot remove '/home/cad/cvw': Device or resource busy
Cloning into '/home/cad/cvw'...

View file

@ -17,12 +17,14 @@ if [ -z "${CVW_GIT}" ]; then
export CVW_GIT="https://github.com/openhwgroup/cvw"
else
echo "Using customized CVW_GIT: ${CVW_GIT}"
# support specific branch now
export CVW_GIT=$(echo ${CVW_GIT} | sed -E "s/tree\// -b /g")
fi
git config --global http.version HTTP/1.1
# if cvw is not available or CLEAN_CVW(empty string) is defined
if [[ ! -f "/home/${USERNAME}/cvw/setup.sh" ]] || [[ -z "${CLEAN_CVW-x}" ]]; then
if [[ ! -f "/home/${USERNAME}/cvw/setup.sh" ]] || [[ "${CLEAN_CVW}" -eq 1 ]]; then
cd /home/${USERNAME} && rm -rf /home/${USERNAME}/cvw
git clone --recurse-submodules ${CVW_GIT} /home/${USERNAME}/cvw
# if failed to clone submodules for some reason, please run `git submodule update`
@ -46,11 +48,11 @@ export QUESTAPATH=/cad/mentor/questa_sim-xxxx.x_x/questasim/bin
cd ${CVW_HOME}
# build it only if BUILD_RISCOF is defined with empty string
if [[ -z "${BUILD_RISCOF-x}" ]]; then
if [[ "${BUILD_RISCOF}" -eq 1 ]]; then
make install && make riscof && make testfloat
fi
if [[ -z "${RUN_QUESTA-x}" ]] ; then
if [[ "${RUN_QUESTA}" -eq 1 ]] ; then
if [ ! -f "${QUESTA}/questasim/bin/vsim" ]; then
echo "Cannot find vsim with ${QUESTA}/questasim/bin/vsim"
else
@ -64,6 +66,7 @@ make coverage
make benchmarks
if [[ ! NO_VERILATOR -eq 1 ]]; then
cd ${CVW_HOME}/sim/verilator && verilator -GTEST="\"arch64i\"" -DVERILATOR=1 --timescale "1ns/1ns" --timing --binary --top-module testbench -I${CVW_HOME}/config/shared -I${CVW_HOME}/config/rv64gc ${CVW_HOME}/src/cvw.sv ${CVW_HOME}/testbench/testbench.sv ${CVW_HOME}/testbench/common/*.sv ${CVW_HOME}/src/*/*.sv ${CVW_HOME}/src/*/*/*.sv --relative-includes
${CVW_HOME}/sim/verilator/obj_dir/Vtestbench
make -C sim/verilator run
# by default it runs the arch64i on rv64gc
cat ${CVW_HOME}/sim/verilator/logs/rv64gc_arch64i.log
fi