core-v-verif icon indicating copy to clipboard operation
core-v-verif copied to clipboard

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

Open yesilzeytin opened this issue 2 years ago • 9 comments

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.

yesilzeytin avatar Feb 16 '23 13:02 yesilzeytin

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.

MikeOpenHWGroup avatar Feb 16 '23 14:02 MikeOpenHWGroup

@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++

abdullahyildiz avatar Feb 17 '23 13:02 abdullahyildiz

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.

MikeOpenHWGroup avatar Feb 17 '23 15:02 MikeOpenHWGroup

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)’

abdullahyildiz avatar Feb 17 '23 16:02 abdullahyildiz

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

MikeOpenHWGroup avatar Feb 20 '23 19:02 MikeOpenHWGroup

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.

yesilzeytin avatar Feb 21 '23 10:02 yesilzeytin

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

MikeOpenHWGroup avatar Feb 21 '23 19:02 MikeOpenHWGroup

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.

yesilzeytin avatar Feb 24 '23 07:02 yesilzeytin

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

MikeOpenHWGroup avatar Feb 24 '23 14:02 MikeOpenHWGroup