pulp-platform / redmule

Other
31 stars 11 forks source link

QUESTA environment variable set by default breaks simulation following README.md #21

Open FrancescoConti opened 4 months ago

FrancescoConti commented 4 months ago

By default, the QUESTA environment variable is set as in an ETH environment. However, this breaks by default the README.md instructions, which will not work in a non-ETH environment: https://github.com/pulp-platform/redmule/blob/4b74428d82a40eb42ed38ce0eefc1803620a32f4/Makefile#L24

A possible solution, based on identifying ETH machines:

HOSTNAME := $(shell hostname)
ETHZ_HOST := $(shell echo $(HOSTNAME) | grep -q '\.ee\.ethz\.ch$$' && echo 1 || echo 0)
ifeq (ETHZ_HOST,1)
QUESTA ?= something
else
QUESTA ?= 
endif
zealshah29 commented 3 months ago

Hi @FrancescoConti , i am presently using the questasim version 2019.08. Is there a way to run redmule simulation if I am working in a non-ETH environment? Because when I am trying to run the given command make hw-build, I am getting an error of questa-2023.4 command not found

yvantor commented 2 months ago

Hi @zealshah29, and thanks @FrancescoConti for raising the issue! The purpose is to export the QUESTA variable to the required target Questasim version. Essentially, if one defines the QUESTA environment variable as an empty one (export QUESTA=), the problem should be automatically solved. You can create your own setup.sh script relying on this example and extend it with the export I suggested above. Then the README would start working again. Let me know if this helps!

zealshah29 commented 2 months ago

Hi @zealshah29, and thanks @FrancescoConti for raising the issue! The purpose is to export the QUESTA variable to the required target Questasim version. Essentially, if one defines the QUESTA environment variable as an empty one (export QUESTA=), the problem should be automatically solved. You can create your own setup.sh script relying on this example and extend it with the export I suggested above. Then the README would start working again. Let me know if this helps!

Hi @yvantor , thank you for replying. I tried the changes you suggested but I was still facing the same error.

I edited the setup_hwpe.sh file:

echo "Exporting bender path to $BENDER_DIR"
export PATH=/home/c2sd2/redmule:$PATH
# unset BENDER_DIR
echo "Exporting SDK and GCC Toolchain paths"
export PATH=/opt/riscv:$PATH
export PULP_RISCV_GCC_TOOLCHAIN=/opt/riscv
export PATH=/usr/bin:$PATH
export XLEN=32
export XTEN=imc
export REDMULE_COMPLEX=0
export QUESTA=

Then I sourced the file. Ran sudo make update-ips command. And finally built the hardware sudo make hw-build

But then I got the following error:

cd /home/c2sd2/redmule/vsim; \
questa-2023.4 vsim -c -do 'quit -code [source /home/c2sd2/redmule/scripts/compile.tcl]'
/bin/bash: line 1: questa-2023.4: command not found
Makefile:177: recipe for target 'hw-build' failed
make: *** [hw-build] Error 127

Since questa-2023.4 command was not found, I decided to make the following change inside the makefile.

#QUESTA         ?= questa-2023.4
QUESTA         ?= 

But I am still getting this error:

cd /home/c2sd2/redmule/vsim; \
 vsim -c -do 'quit -code [source /home/c2sd2/redmule/scripts/compile.tcl]'
/bin/bash: line 1: vsim: command not found
Makefile:177: recipe for target 'hw-build' failed
make: *** [hw-build] Error 127

I do have questasim, and when I simply run vsim command inside the terminal, it opens the QuestaSim software

FrancescoConti commented 2 months ago

Why are you running with sudo? You should not do that, ever. That's also probably the reason your PATH is messed up and the setup you source is ignored (you source it with your user, not root)

yvantor commented 2 months ago

Why are you running with sudo? You should not do that, ever. That's also probably the reason your PATH is messed up and the setup you source is ignored (you source it with your user, not root)

I agree, I would try simply with make hw-build and make update-ips. Probably, using sudo is also compromising the QUESTA export value. If without sudo the QUESTA issue is still not solved after the export of the environment variable, you can just run make hw-build QUESTA=, so you do not have to change the Makefile.

zealshah29 commented 2 months ago

When I an running the commands without using sudo, I am getting permission denied error for both make update-ips and make hw-build QUESTA=

 make update-ips 
./bender update
warning: Dependency name and package name do not match for "fpnew" / "FPnew", this can cause unwanted behavior
Requirement `>=1.6.0, <1.7.0` conflicts with other requirements on dependency `hwpe-stream`.

- package `redmule` requires `>=1.7.0, <1.8.0`
- package `hci` requires `>=1.6.0, <1.7.0`

To resolve this conflict manually, select a revision for `hwpe-stream` among:
0) `>=1.7.0, <1.8.0`
1) `>=1.6.0, <1.7.0`
Enter a number or hit enter to abort: 1
./bender script vsim          \
--vlog-arg="+acc -permissive -suppress 2583 -suppress 13314"   \
--vcom-arg="-pedanticerrors"   \
-t cv32e40p_exclude_tracer -t redmule_hwpe -D COREV_ASSERT_OFF \
-t rtl -t test -t redmule_test_hwpe                   \
> /home/c2sd2/redmule/scripts/compile.tcl
error: Failed to remove checkout directory "/home/c2sd2/redmule/.bender/git/checkouts/hwpe-stream-2e8c83ec32e14a93". Permission denied (os error 13)
Makefile:135: recipe for target 'update-ips' failed
make: *** [update-ips] Error 1

Similarly:

make hw-build QUESTA=
cd /home/c2sd2/redmule/vsim; \
 vsim -c -do 'quit -code [source /home/c2sd2/redmule/scripts/compile.tcl]'
Reading pref.tcl

# 10.6g

# quit -code [source /home/c2sd2/redmule/scripts/compile.tcl]
# QuestaSim-64 vlog 10.6g Compiler 2019.08 Aug  2 2019
# Start time: 14:30:41 on May 01,2024
# vlog -incr -sv "+acc" -permissive -suppress 2583 -suppress 13314 "+define+COREV_ASSERT_OFF" "+define+TARGET_CV32E40P_EXCLUDE_TRACER" "+define+TARGET_REDMULE_HWPE" "+define+TARGET_REDMULE_TEST_HWPE" "+define+TARGET_RTL" "+define+TARGET_SIMULATION" "+define+TARGET_TEST" "+define+TARGET_VSIM" /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/clk_rst_gen.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/rand_id_queue.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/rand_stream_mst.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/rand_synch_holdable_driver.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/rand_verif_pkg.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/signal_highlighter.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/sim_timeout.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/stream_watchdog.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/rand_synch_driver.sv /home/c2sd2/redmule/.bender/git/checkouts/common_verification-eadc0cc3800b424f/src/rand_stream_slv.sv 
# ** Error (suppressible): (vlog-19) Failed to access library 'work' at "/home/c2sd2/pulpissimo/install/modelsim_libs/tb_lib".
# Permission denied. (errno = EACCES)
# ** Error: Verilog Compiler exiting
# End time: 14:30:41 on May 01,2024, Elapsed time: 0:00:00
# Errors: 2, Warnings: 0
Makefile:177: recipe for target 'hw-build' failed
make: *** [hw-build] Error 1
FrancescoConti commented 2 months ago

That's because you have run Bender with root as user previously. Remove or chown all .bender checkouts (and probably the bender binary as well) and start over.

zealshah29 commented 2 months ago

Okay, thank you. I tried that and now I am able to update ips without facing permission denied error. But I am still getting

** Error (suppressible): (vlog-19) Failed to access library 'work' at "/home/c2sd2/pulpissimo/install/modelsim_libs/tb_lib".
# Permission denied. (errno = EACCES)

error on running make hw-build QUESTA=

FrancescoConti commented 2 months ago

Same thing for the modelsim_libs. You must purge your environment from all dirs with wrong permission

zealshah29 commented 2 months ago

Okay sure I will do that. Once again thank you so much for your guidance

yvantor commented 2 months ago

Yes, I suggest you delete your local repo, clone it back and try to follow the readme with the tips we gave here, then everything should be fine!

zealshah29 commented 2 months ago

Yes, I suggest you delete your local repo, clone it back and try to follow the readme with the tips we gave here, then everything should be fine!

Okay, will do that. Thank you so much.