openhwgroup / core-v-verif

Functional verification project for the CORE-V family of RISC-V cores.

Home Page:https://docs.openhwgroup.org/projects/core-v-verif/en/latest/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QUESTASIM_HOME for "spike_lib" Neither Documented nor Checked

silabs-robin opened this issue · comments

Type

  • Compile error (hopefully nobody has committed anything that doesn't compile!)
  • Confusing or extraneous status or error messages
  • Other.

Steps to Reproduce

Try to build spike_lib.
E.g. approximately cd cv32e40s/sim/uvmt && make spike_lib.

Additional context

Here is the error message you get:
../fesvr/fesvr_dpi.cc:22:10: fatal error: svdpi.h: No such file or directory
There is no clue that QUESTASIM_HOME is missing.
grep'ing from top-level reveals no documentation.
What should happen is that whenever you run a target that requires this env var to be set, then it should automatically be checked and then printed an error if it is not set (example, in shell but you can do the same in make or any other language).

Hi Robin, makes sense I will open a PR with the check 👍

Probably the best solution is to not let the user compile spike_lib if the SIMULATOR var is not set as it requires any of the three big ones

I had SIMULATOR set

Okeey I will submit a fix 👍

@silabs-robin and @MarioOpenHWGroup. I believe the fix is in #2452. This pull-request adds this to the vsim.mk:

export QUESTASIM_HOME ?= $(abspath $(shell which $(VLIB))/../../)

That works fine for me on CentOS7, but I am worried that it might not work for every flavour of Linux and shell. I would be happier to force the user to set QUESTASIM_HOME themselves. Is there a straightforward way to add a check for the existence of QUESTASIM_HOME in vsim.mk that always runs, regardless of the make rule invoked.

A little bit of digging produced this:

ifeq ($(ENVXXX),)
   $(error ENVXXX is undefined)
endif

Adding this to the top of vsim.mk will ensure that the check runs for every invocation of make, regardless of the target. Important: the ifeq and endif must start in column 0 and the indentation of $error must be with spaces, not tabs.