#2 Update to 5.022, fix version check, add CMake for tests
Merged a month ago by npgo22. Opened 2 months ago by npgo22.
rpms/ npgo22/verilator rawhide  into  rawhide

file modified
+1
@@ -4,3 +4,4 @@ 

  /verilator-4.226.tar.gz

  /verilator-5.014.tar.gz

  /verilator-5.020.tar.gz

+ /verilator-5.022.tar.gz

@@ -0,0 +1,27 @@ 

+ commit 01dadb0a8d1c86493d310f400a084fa899915edb

+ Author: Kamil Rakoczy <kamilrakoczy1@gmail.com>

+ Date:   Fri Mar 1 21:29:13 2024 +0100

+ 

+     Fix try-lock spuriously fails (#4931) (#4938)

+ 

+ diff --git a/src/V3ThreadPool.h b/src/V3ThreadPool.h

+ index 2d552c10a..09b2ba17c 100644

+ --- a/src/V3ThreadPool.h

+ +++ b/src/V3ThreadPool.h

+ @@ -139,7 +139,15 @@ class V3ThreadPool final {

+              std::abort();

+          }

+  

+ -        if (VL_UNCOVERABLE(!m_mutex.try_lock())) {

+ +        bool m_mutex_locked = m_mutex.try_lock();

+ +        // try_lock can sometimes spontaneously fail even when mutex is not locked,

+ +        // make sure this isn't the case

+ +        for (int i = 0; i < VL_LOCK_SPINS; ++i) {

+ +            if (VL_LIKELY(m_mutex_locked)) break;

+ +            VL_CPU_RELAX();

+ +            m_mutex_locked = m_mutex.try_lock();

+ +        }

+ +        if (VL_UNCOVERABLE(!m_mutex_locked)) {

+              if (VL_UNCOVERABLE(m_jobsInProgress != 0)) {

+                  // ThreadPool shouldn't be destroyed when jobs are running and mutex is locked,

+                  // something is wrong. Most likely Verilator is exiting as a result of failed

@@ -0,0 +1,35 @@ 

+ commit 04512e5d0484f26b75cf7386facceb929fbf2536

+ Author: Nolan Poe <npgo22@gmail.com>

+ Date:   Sat Mar 9 13:44:25 2024 -0800

+ 

+     Add custom version for verilator --version packaging (#4954)

+ 

+ diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS

+ index fa22f84fd..82e6160b6 100644

+ --- a/docs/CONTRIBUTORS

+ +++ b/docs/CONTRIBUTORS

+ @@ -136,6 +136,7 @@ Mostafa Gamal

+  Nandu Raj

+  Nathan Kohagen

+  Nathan Myers

+ +Nolan Poe

+  Oleh Maksymenko

+  Patrick Stewart

+  Paul Swirhun

+ diff --git a/src/config_rev b/src/config_rev

+ index 0640d85b1..bbbcf9b3f 100755

+ --- a/src/config_rev

+ +++ b/src/config_rev

+ @@ -22,7 +22,11 @@ Args = parser.parse_args()

+  

+  os.chdir(Args.directory)

+  

+ -rev = 'UNKNOWN_REV'

+ +if 'VERILATOR_SRC_VERSION' in os.environ:

+ +    rev = os.environ['VERILATOR_SRC_VERSION']

+ +else:

+ +    rev = 'UNKNOWN_REV'

+ +

+  data = os.popen('git describe').read()

+  

+  match = re.search(r'^(v[0-9].*)', data)

@@ -0,0 +1,15 @@ 

+ diff --git a/test_regress/driver.pl b/test_regress/driver.pl

+ index 1e643ec83..7430a9c26 100755

+ --- a/test_regress/driver.pl

+ +++ b/test_regress/driver.pl

+ @@ -1254,8 +1254,8 @@ sub compile {

+                                  "TEST_OBJ_DIR=$self->{obj_dir}",

+                                  "CPPFLAGS_DRIVER=-D" . uc($self->{name}),

+                                  ($self->{verbose} ? "CPPFLAGS_DRIVER2=-DTEST_VERBOSE=1" : ""),

+ -                                ($param{benchmark} ? "" : "OPT_FAST=-O0"),

+ -                                ($param{benchmark} ? "" : "OPT_GLOBAL=-O0"),

+ +                                ($param{benchmark} ? "" : "OPT_FAST=-O1"),

+ +                                ($param{benchmark} ? "" : "OPT_GLOBAL=-O1"),

+                                  "$self->{vm_prefix}",  # bypass default rule, as we don't need archive

+                                  ($param{make_flags} || ""),

+                          ]);

@@ -0,0 +1,49 @@ 

+ commit 08c76b1da6e132b1e91f82136a8647f71f774904

+ Author: Nolan Poe <npgo22@gmail.com>

+ Date:   Fri Mar 15 19:21:08 2024 -0700

+ 

+     Fix GCC14 warnings on template specialization syntax (#4974) (#4975)

+ 

+ diff --git a/src/V3OptionParser.cpp b/src/V3OptionParser.cpp

+ index b1855c462..e0d7fbd04 100644

+ --- a/src/V3OptionParser.cpp

+ +++ b/src/V3OptionParser.cpp

+ @@ -114,16 +114,33 @@ V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbCall, void(void), m_cb(), en::NONE);

+  V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbFOnOff, void(bool), m_cb(!hasPrefixFNo(optp)),

+                                   en::FONOFF);

+  V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbOnOff, void(bool), m_cb(!hasPrefixNo(optp)), en::ONOFF);

+ -template <>

+ -V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbVal<int>, void(int), m_cb(std::atoi(argp)), en::VALUE);

+ -template <>

+ -V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbVal<const char*>, void(const char*), m_cb(argp),

+ -                                 en::VALUE);

+  V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbPartialMatch, void(const char*), m_cb(optp), en::NONE,

+                                   true);

+  V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbPartialMatchVal, void(const char*, const char*),

+                                   m_cb(optp, argp), en::VALUE, true);

+  

+ +template <>

+ +class V3OptionParser::Impl::ActionCbVal<int> final : public ActionBase<en::VALUE> {

+ +    std::function<void(int)> m_cb;

+ +

+ +public:

+ +    using CbType = std::function<void(int)>;

+ +    explicit ActionCbVal(CbType cb)

+ +        : m_cb(std::move(cb)) {}

+ +    void exec(const char* optp, const char* argp) override { m_cb(std::atoi(argp)); }

+ +};

+ +

+ +template <>

+ +class V3OptionParser::Impl::ActionCbVal<const char*> final : public ActionBase<en::VALUE> {

+ +    std::function<void(const char*)> m_cb;

+ +

+ +public:

+ +    using CbType = std::function<void(const char*)>;

+ +    explicit ActionCbVal(CbType cb)

+ +        : m_cb(std::move(cb)) {}

+ +    void exec(const char* optp, const char* argp) override { m_cb(argp); }

+ +};

+ +

+  #undef V3OPTION_PARSER_DEF_ACT_CB_CLASS

+  

+  //######################################################################

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (verilator-5.020.tar.gz) = 63f4ca6f7aad9c03b50c4040480ed0abdbcfed5f2fc9ce0994dc02a5078daa003d592314a778ab847ac100486038f75ab151d55eaa02d60f979af177ca1dd34e

+ SHA512 (verilator-5.022.tar.gz) = 5b919ed5d4cf863434f10f39bbb3a5155d63f79765f5f1d5ae543023b0e350e0996507d250fbfb2e5129bbdf9a51cc5fd0b7154962747c89435648897525bc84

file modified
+73 -7
@@ -1,13 +1,44 @@ 

+ # Blocked by perl-parallel-forker not being packaged

+ # https://bugzilla.redhat.com/show_bug.cgi?id=2268659

+ %bcond longtests 0

+ 

+ # A warning caused by  glibc in F38 fails build

+ %if 0%{?fedora} == 38

+     %ifarch ppc64le

+     %bcond ccwarn 0

+     %endif

+ %else

+ %bcond ccwarn 1

+ %endif

+ 

+ %bcond tcmalloc 0

+ %bcond ccache 0

+ %bcond mold 0

+ 

  Name:           verilator

- Version:        5.020

+ Version:        5.022

  Release:        %autorelease

  Summary:        A fast simulator for synthesizable Verilog

- License:        LGPLv3 or Artistic 2.0

+ License:        LGPL-3.0-only OR Artistic-2.0

  URL:            https://veripool.org/verilator/

  Source0:        https://github.com/verilator/verilator/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz

+ 

+ # Backported from upstream to fix building

+ Patch0: 0001-fix-try-lock-spuriously-fails.patch

+ 

+ # Accepted upstream through GitHub, awaiting release

+ Patch1: 0002-Allow-for-custom-verilator-revision-in-version-check.patch

+ 

+ # Undesirable upstream, fixes warnings with FORTIFY_SOURCE

+ Patch2: 0003-Enable-optimization-in-tests.patch

+ 

+ # Accepted upstream through GitHub, awaiting release

+ Patch3: 0004-Fix-GCC14-warnings-on-template-specialization-syntax.patch

+ 

  BuildRequires:  autoconf

  BuildRequires:  bison

  BuildRequires:  coreutils

+ BuildRequires:  cmake

  BuildRequires:  findutils

  BuildRequires:  flex

  BuildRequires:  gcc
@@ -29,10 +60,35 @@ 

  BuildRequires:  perl(vars)

  BuildRequires:  python3-devel

  BuildRequires:  sed

+ %if %{with tcmalloc}

+ BuildRequires:  gperftools-libs

+ BuildRequires:  gperftools-devel

+ %endif

+ %if %{with mold}

+ Requires:       mold

+ %endif

+ %if %{with ccache}

+ BuildRequires:  ccache

+ %endif

  

  # required for further tests

  BuildRequires:  gdb

  

+ # Initial entrypoint needs perl

+ Requires:       perl-interpreter

+ 

+ # Optional deps

+ %if %{with tcmalloc}

+ Requires:       gperftools-libs  

+ %endif

+ %if %{with ccache}

+ Requires:       ccache

+ %endif

+ # NOTE: currently fails on ppc64le

+ %if %{with mold} 

+ Requires:       mold

+ %endif

+ 

  %description

  Verilator is the fastest free Verilog HDL simulator. It compiles

  synthesizable Verilog, plus some PSL, SystemVerilog and Synthesis
@@ -42,14 +98,23 @@ 

  embedded software design teams.

  

  %prep

- %autosetup

+ %autosetup -p1

  find . -name .gitignore -delete

  export VERILATOR_ROOT=%{_datadir}

  autoconf

- %{configure} \

-     --disable-ccwarn \

+ %configure \

+     --disable-partial-static \

      --enable-defenv \

+ %ifarch %{with ccwarn}

+     --enable-ccwarn \

+ %else 

+     --disable-ccwarn \

+ %endif

+ %if %{with longtests}

+     --enable-longtests

+ %else

      --disable-longtests

+ %endif

  

  # We cannot run autoreconf because upstream uses unqualifed stdlib identifiers

  # that are included by autoconf-generated header files.
@@ -59,10 +124,11 @@ 

      {} \;

  

  %build

- %make_build

+ export VERILATOR_SRC_VERSION=fedora-%{version}

+ %make_build 

  

  %check

- make test

+ make test 

  

  %install

  %make_install

I noticed the build for 5.020 failed because of an upstream issue, so I put in a fix for it while also bumping to the latest source tarball. In addition, I added CMake (for additional tests), and added a quick hack so that verilator --version doesn't print UNKNOWN, though it can be broken into a quick patch.

This is the first time I've ever tried committing anything to Fedora, so please let me know if I did anything wrong!

1 new commit added

  • Properly patch version check and multithreading bug, SPDX license
2 months ago

2 new commits added

  • Properly patch version check and multithreading bug, SPDX license
  • Update to 5.022, fix version check, add CMake for tests
2 months ago

rebased onto 936d23e

2 months ago

rebased onto aa14d4a

a month ago

1 new commit added

  • Merge remote-tracking branch 'refs/remotes/origin/rawhide' into rawhide
a month ago

1 new commit added

  • Disable tcmalloc by default
a month ago

rebased onto 3f63ed7

a month ago

@npgo22 , feel free to merge this PR.

Pull-Request has been merged by npgo22

a month ago