openhwgroup / core-v-verif

Functional verification project for the CORE-V family of RISC-V cores.
https://docs.openhwgroup.org/projects/core-v-verif/en/latest/index.html
Other
444 stars 221 forks source link

Invalid conversion from uint8_t to const isa_parser_t when trying to use uvma_isacov #1656

Open yesilzeytin opened 1 year ago

yesilzeytin commented 1 year ago

Bug Title

Invalid conversion from uint8_t to const isa_parser_t when trying to use uvma_isacov

Type

Compile error

Steps to Reproduce

  1. release branch
  2. Command line: make dpi_dasm CV_SIMULATOR=vcs
  3. Logfile and/or wave-dump info: cvv-issue

Additional context

Standard vcs makefile (vcs.mk) doesn't have svdpi.h and disasm.h includes, they are included manually.

MikeOpenHWGroup commented 1 year ago

Hi @yesilzeytin, thanks for your issue. The <core>/release branches on core-v-verif are intended for internal use only. They are used as "staging branches" from <core>/dev to/from the master branch. I agree we did not select the best name for these!

Althought the README does not state this explictily, it is assumed that the dpi_dasm target is not run by the user from the command-line. That target is run (if necessary) by make test.....

Please re-try on either master or cv32e40p/dev. The master branch is expected to be stable.

abdullahyildiz commented 1 year ago

@MikeOpenHWGroup, @yesilzeytin,

I've tried building dpi_dasm on master branch and got similar results:

g++ -shared -fPIC -std=c++17 -fpermissive -I/home/ayildiz/work/core-v-verif/lib/dpi_dasm -I/eda/synopsys/vcs/Q-2020.03-SP2/include/ -I/home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/riscv -I/home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/softfloat /home/ayildiz/work/core-v-verif/lib/dpi_dasm/dpi_dasm.cxx /home/ayildiz/work/core-v-verif/lib/dpi_dasm/spike/disasm.cc /home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/disasm/regnames.cc -o /home/ayildiz/work/core-v-verif/lib/dpi_dasm/lib/Linux64/libdpi_dasm.so
/home/ayildiz/work/core-v-verif/lib/dpi_dasm/dpi_dasm.cxx: In function ‘void initialize_disassembler()’:
/home/ayildiz/work/core-v-verif/lib/dpi_dasm/dpi_dasm.cxx:84:47: warning: invalid conversion from ‘uint8_t’ {aka ‘unsigned char’} to ‘const isa_parser_t*’ [-fpermissive]
   gp_disassembler = new disassembler_t(gv_xlen);
                                               ^
In file included from /home/ayildiz/work/core-v-verif/lib/dpi_dasm/dpi_dasm.cxx:20:
/home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/riscv/disasm.h:85:38: note:   initializing argument 1 of ‘disassembler_t::disassembler_t(const isa_parser_t*)’
   disassembler_t(const isa_parser_t *isa);
                  ~~~~~~~~~~~~~~~~~~~~^~~
/home/ayildiz/work/core-v-verif/lib/dpi_dasm/spike/disasm.cc:393:1: error: no declaration matches ‘disassembler_t::disassembler_t(int)’
 disassembler_t::disassembler_t(int xlen)
 ^~~~~~~~~~~~~~
In file included from /home/ayildiz/work/core-v-verif/lib/dpi_dasm/spike/disasm.cc:3:
/home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/riscv/disasm.h:82:7: note: candidates are: ‘disassembler_t::disassembler_t(const disassembler_t&)’
 class disassembler_t
       ^~~~~~~~~~~~~~
/home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/riscv/disasm.h:85:3: note:                 ‘disassembler_t::disassembler_t(const isa_parser_t*)’
   disassembler_t(const isa_parser_t *isa);
   ^~~~~~~~~~~~~~
/home/ayildiz/work/core-v-verif/cv32e40p/vendor_lib/dpi_dasm_spike/riscv/disasm.h:82:7: note: ‘class disassembler_t’ defined here
 class disassembler_t
       ^~~~~~~~~~~~~~
/home/ayildiz/work/core-v-verif/mk/Common.mk:680: recipe for target 'dpi_dasm' failed
make: *** [dpi_dasm] Error 1

OS has gcc version 8.4.0 installed, so I had to make the following changes in mk/Common.mk:

diff --git a/mk/Common.mk b/mk/Common.mk
index 6da0852e..b138e4b6 100644
--- a/mk/Common.mk
+++ b/mk/Common.mk
@@ -672,7 +672,7 @@ vcs-unit-test:  vcs-run
 DPI_DASM_SRC    = $(DPI_DASM_PKG)/dpi_dasm.cxx $(DPI_DASM_PKG)/spike/disasm.cc $(DPI_DASM_SPIKE_PKG)/disasm/regnames.cc
 DPI_DASM_ARCH   = $(shell uname)$(shell getconf LONG_BIT)
 DPI_DASM_LIB    = $(DPI_DASM_PKG)/lib/$(DPI_DASM_ARCH)/libdpi_dasm.so
-DPI_DASM_CFLAGS = -shared -fPIC -std=c++11
+DPI_DASM_CFLAGS = -shared -fPIC -std=c++17 -fpermissive
 DPI_DASM_INC    = -I$(DPI_DASM_PKG) -I$(DPI_INCLUDE) -I$(DPI_DASM_SPIKE_PKG)/riscv -I$(DPI_DASM_SPIKE_PKG)/softfloat
 DPI_DASM_CXX    = g++
MikeOpenHWGroup commented 1 year ago

Hi @abdullahyildiz. Did adding -fpermissive resolve your issue?

In the meantime, I have noticed that the CV32E40P versionn of ExternalRepos.mk does not create the necessary vars to clone Spike (the e40s does!). I will investigate this.

abdullahyildiz commented 1 year ago

Hi @MikeOpenHWGroup,

Sorry for the misunderstanding. I had to make these modifications in order to fix some compile errors before the error

no declaration matches ‘disassembler_t::disassembler_t(int)’

MikeOpenHWGroup commented 1 year ago

Hi @yesilzeytin, please have a look at #1668. I believe this will resolve your issue.

yesilzeytin commented 1 year ago

Hi, thank you for the responses so far. What I meant by including svdpi.h was this fix, actually. If we hadn't included it manually, we get the error below: cvv-issue-2 The issue opened occurs when DPI_INCLUDE is set and make dpi_dasm CV_SIMULATOR=vcs is run.

MikeOpenHWGroup commented 1 year ago

This makes no sense to me. The g++ command line emitted by your invocation of make dpi_dasm indicates that a variable named DPI_DASM_PKG is not defined. This var is defined in uvmt.mk so there is no reason this is not working for you.

Try this: make dpi_dasm SIMULATOR=vcs

yesilzeytin commented 1 year ago

This one didn't work as well. Still got the same problem. We will be further investigating the issue, though. Thank you for the suggestions so far.

MikeOpenHWGroup commented 1 year ago

Double check to see if svdpi.h and disasm.h are anywhere installed. svdpi should be part of your simulator installation. For example, $VCS_HOME/include/svdpi.h if you are using VCS. dpi_dasm should be in $YOUR_WORKING_COPY_OF_CORE-V-VERIF/cv32e40p/vendor_lib/dpi_dasm_spike/riscv/disasm.h