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

Verilator: add version 4.038 #11314

Merged
merged 8 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions recipes/verilator/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
sources:
"4.038":
url: "https://www.veripool.org/ftp/verilator-4.038.tgz"
sha256: "fa004493216034ac3e26b21b814441bd5801592f4f269c5a4672e3351d73b515"
"4.034":
url: "https://www.veripool.org/ftp/verilator-4.034.tgz"
sha256: "54ed7b06ee28b5d21f9d0ee98406d29a508e6124b0d10e54bb32081613ddb80b"
patches:
"4.038":
- patch_file: "patches/0001-split-opt-and-debug-build-install.patch"
base_path: "source_subfolder"
- patch_file: "patches/0004-msvc-patches.patch"
base_path: "source_subfolder"
- patch_file: "patches/0003-add-msvc_link-sh.patch"
base_path: "source_subfolder"
"4.034":
- patch_file: "patches/0001-split-opt-and-debug-build-install.patch"
base_path: "source_subfolder"
Expand Down
4 changes: 0 additions & 4 deletions recipes/verilator/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ def package_id(self):
del self.info.settings.compiler.version

def package_info(self):
verilator_include_root = os.path.join(self.package_folder, "share", "verilator", "include")

self.cpp_info.includedirs = [verilator_include_root]

bindir = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bindir))
self.env_info.PATH.append(bindir)
Expand Down
88 changes: 88 additions & 0 deletions recipes/verilator/all/patches/0004-msvc-patches.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
--- src/Makefile_obj.in
+++ src/Makefile_obj.in
@@ -95,6 +95,7 @@ LIBS = $(CFG_LIBS) -lm
CPPFLAGS += -MMD
CPPFLAGS += -I. -I$(bldsrc) -I$(srcdir) -I$(incdir) -I../../include
CPPFLAGS += -DYYDEBUG # Required to get nice error messages
+CPPFLAGS += -DNOMINMAX # suppress the min and max definitions in Windef.h
#CPPFLAGS += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool
CPPFLAGS += $(COPT)
CPPFLAGS += -MP # Only works on recent GCC versions
@@ -278,7 +279,7 @@ V3__CONCAT.cpp: $(addsuffix .cpp, $(basename $(RAW_OBJS)))

$(TGT): $(PREDEP_H) $(OBJS)
@echo " Linking $@..."
- ${LINK} ${LDFLAGS} -o $@ $(OBJS) $(CCMALLOC) ${LIBS}
+ ${LINK} ${LDFLAGS} -o $@$(EXEEXT) $(OBJS) $(CCMALLOC) ${LIBS}

V3Number_test: V3Number_test.o
${LINK} ${LDFLAGS} -o $@ $^ ${LIBS}

--- src/V3Number.h
+++ melsrc/V3Number.h
@@ -22,6 +22,7 @@

#include "V3Error.h"

+#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>

--- src/V3Os.cpp
+++ src/V3Os.cpp
@@ -63,8 +63,8 @@ string V3Os::getenvStr(const string& envvar, const string& defaultValue) {
#if defined(_MSC_VER)
// Note: MinGW does not offer _dupenv_s
char* envvalue = nullptr;
- _dupenv_s(&envvalue, nullptr, envvar.c_str());
- if (envvalue != nullptr) {
+ int dupres = _dupenv_s(&envvalue, nullptr, envvar.c_str());
+ if ((dupres == 0) && (envvalue != nullptr)) {
const std::string result{envvalue};
free(envvalue);
return result;
@@ -336,6 +336,9 @@ void V3Os::u_sleep(int64_t usec) {
int V3Os::system(const string& command) {
UINFO(1, "Running system: " << command << endl);
const int ret = ::system(command.c_str());
+#ifdef _MSC_VER
+ return ret;
+#else
if (VL_UNCOVERABLE(ret == -1)) {
v3fatal("Failed to execute command:" // LCOV_EXCL_LINE
<< command << " " << strerror(errno));
@@ -347,4 +350,5 @@ int V3Os::system(const string& command) {
UASSERT(exit_code >= 0, "exit code must not be negative");
return exit_code;
}
+#endif
}

--- src/VlcTop.cpp
+++ src/VlcTop.cpp
@@ -14,6 +14,11 @@
//
//*************************************************************************

+#if defined(_WIN32) || defined(__MINGW32__)
+#define NOMINMAX
+#include <windows.h>
+#endif
+
#include "V3Error.h"
#include "V3Os.h"
#include "VlcOptions.h"

--- include/verilated_imp.h
+++ include/verilated_imp.h
@@ -29,6 +29,7 @@
#include "verilated_heavy.h"
#include "verilated_syms.h"

+#include <algorithm>
#include <deque>
#include <set>
#include <vector>


2 changes: 2 additions & 0 deletions recipes/verilator/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"4.034":
folder: all
"4.038":
folder: all