Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about some errors when running simulation or tests #42

Open
ingmarfjolla opened this issue Nov 29, 2023 · 2 comments
Open

Questions about some errors when running simulation or tests #42

ingmarfjolla opened this issue Nov 29, 2023 · 2 comments

Comments

@ingmarfjolla
Copy link

Hello! I'm not sure if I missed a dependency somewhere (or needed to do anything else to get things working), but I'm trying to run make test and make simulation in the respective pre-built /builds/RV64... directories and getting a couple of different errors.

I'm currently on M1 Mac OS Ventura.

  1. I tried running make simulation in the iverilog directories, but it seems like it was still expecting verilator / bsc to be installed, so I installed Verilator but now it seems to be failing with :
%Error-NEEDTIMINGOPT: Verilog_RTL/mkPLIC_16_2_7.v:25483:4: Use --timing or --no-timing to specify how delays should be handled
                                                         : ... note: In instance 'mkTop_HW_Side.soc_top.core.plic'
25483 |    #0;
      |    ^
                      Verilog_RTL/mkCore.v:2314:1: ... note: In file included from 'mkCore.v'
                      Verilog_RTL/mkSoC_Top.v:1127:1: ... note: In file included from 'mkSoC_Top.v'
                      Verilog_RTL/mkTop_HW_Side_edited.v:227:1: ... note: In file included from 'mkTop_HW_Side_edited.v'
%Error: Exiting due to too many errors encountered; --error-limit=50

I'm not sure if I missed anything there.

  1. When I run make test , I get an error saying :
elf_to_hex.c:15:10: fatal error: 'gelf.h' file not found
#include <gelf.h>
         ^~~~~~~~
1 error generated.
make[1]: *** [elf_to_hex] Error 1

I tried fixing the path to my compiler, but it didn't seem to have any effect. I'm not sure the best way to debug this and tried with clang/gcc/g++.

Sorry for the amount of questions, and thank you for any guidance!

@quark17
Copy link
Contributor

quark17 commented Nov 30, 2023

@rsnikhil can correct me if I'm wrong about either of these:

  1. The repo was written when the latest Verilator was v4, but you have v5 installed which needs an additional flag to be provided (--no-timing). Also, when this repo was created, BSC didn't support compiling and linking for Verilator, so special scripting was necessary for that. BSC now natively supports Verilator and would call Verilator with the necessary flags. I believe that @rsnikhil is intending to push changes to simplify the build scripts to now use BSC, but that hasn't been done yet. Until then, you can add --no-timing to the assignment of VERILATOR_FLAGS at line 37 in builds/Resources/Include_verilator.mk:
VERILATOR_FLAGS = --stats -O3 -CFLAGS -O3 -LDFLAGS -static --x-assign fast --x-initial fast --noassert --no-timing
  1. Building the elf_to_hex program requires "libelf" and the C compiler needs to be able to find it. On macOS, you can install it with Homebrew using brew install libelf and on Ubuntu with apt install libelf-dev. However, the location where Homebrew installs the library may not be visible to the C compiler. You probably need to provide -I and -L flags to specify the directories, which can be determined by asking pkg-config for the necessary flags. This is something that should be fixed in the Makefile in Tests/elf_to_hex/:
LIBELF_CFLAGS=$(shell pkg-config --cflags libelf)
LIBELF_LIBS=$(shell pkg-config --libs libelf)

elf_to_hex: elf_to_hex.c
    gcc -g  -o elf_to_hex  $(LIBELF_CFLAGS)  elf_to_hex.c  $(LIBELF_LIBS)

I will submit a PR to fix the Makefile. And hopefully @rsnikhil can add the libelf dependency info to the READMEs, and eventually update the Makefiles to support Verilator v5 (mostly easily by upgrading to use BSC to call Verilator instead of doing it manually, now that that's possible). However, the tools like elf_to_hex are also in other repos (like Piccolo), I believe there is an intention to pull them out and put them into a common shared repo; it could be that these fixes have been held off, waiting for that reorganization to happen, but there hasn't been time to get to that yet.

@ingmarfjolla
Copy link
Author

thank you! those changes did work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants