diff --git a/CITATION.cff b/CITATION.cff
index 61136d929..a3e43ff86 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -1,3 +1,4 @@
+---
# See https://citation-file-format.github.io/
cff-version: 1.2.0
title: Verilator
@@ -14,14 +15,14 @@ authors:
family-names: Wasson
- given-names: Duane
family-names: Galbi
+ - given-names: Geza
+ family-names: Lore
- name: 'et al'
repository-code: 'https://github.com/verilator/verilator'
url: 'https://verilator.org'
abstract: >-
The Verilator package converts Verilog and SystemVerilog hardware
description language (HDL) designs into a fast C++ or SystemC model
- that, after compiling, can be executed. Verilator is not a
+ that, after compiling, can be executed. Verilator is not only a
traditional simulator but a compiler.
-license:
- - LGPL-3.0-only
- - Artistic-2.0
+license: [LGPL-3.0-only, Artistic-2.0]
diff --git a/Changes b/Changes
index 4ae4b59fa..a02b5f99e 100644
--- a/Changes
+++ b/Changes
@@ -44,6 +44,7 @@ Verilator 5.043 devel
* Support general global constraints (#6709) (#6711). [Yilou Wang]
* Support complex std::randomize patterns (#6736) (#6737). [Yilou Wang]
* Support `rand_mode` in global constraint gathering (#6740) (#6752). [Yilou Wang]
+* Support reduction or in constraints (#6840). [Pawel Kojma, Antmicro Ltd.]
* Optimize away calls to empty functions (#6626). [Geza Lore]
* Optimize redundant headers in Syms implementation files. [Geza Lore, Fractile Ltd.]
* Optimize constructor/destructor VerilatedModules (#6660). [Geza Lore, Fractile Ltd.]
@@ -56,6 +57,7 @@ Verilator 5.043 devel
* Fix generate function(s) inside of generate blocks (#1011) (#6789). [em2machine]
* Fix typedef derived from type defined inside interface (#3441) (#6776). [em2machine]
* Fix extern function that returns parameterized class (#4924).
+* Fix type deduction for variable parameterized classes (#6281) (#6813). [em2machine]
* Fix randomize called within func/task (#6144) (#6753). [Yilou Wang]
* Fix pre/post_randomize on extended classes (#6467). [Alex Solomatnikov]
* Fix expression short circuiting (#6483). [Todd Strader]
@@ -92,7 +94,8 @@ Verilator 5.043 devel
* Fix fork scheduling semantics (#6730). [Artur Bieniek, Antmicro Ltd.]
* Fix internal fault when cross-class calling with DPI (#6735) (#6742). [Matthew Ballance]
* Fix write variable placement for global constraints (#6740) (#6750) (#6797). [Yilou Wang]
-* Fix resolution of specialized typedefs (#6754) (#6808). [em2machine]
+* Fix JSON dump missing output ports (#6751) (#6831). [Oleh Maksymenko]
+* Fix resolution of specialized typedefs (#6754) (#6808) (#6834). [em2machine]
* Fix UNSUPPORTED on force / release with complex selects (#6755). [Ryszard Rozak, Antmicro Ltd.]
* Fix select assignment expansion (#6757). [Geza Lore]
* Fix `--lib-create` with multi-bit clocks (#6759). [Geza Lore]
@@ -108,9 +111,14 @@ Verilator 5.043 devel
* Fix `disable iff` in simple properties (#6783). [Ryszard Rozak, Antmicro Ltd.]
* Fix input sampling of clocking block signals (#6788). [Pawel Kojma, Antmicro Ltd.]
* Fix O(n*2) analysis in const-bit-op-tree (#6791). [Geza Lore]
-* Fix nested struct within parameter port list (#6818) (#6824). [Luca Colagrande]
+* Fix member select of variable without randmode (#6800) (#6833). [Yilou Wang]
* Fix duplicate name error with interface initial blocks (#6804) (#6805). [Thomas Dybdahl Ahle]
+* Fix nested struct within parameter port list (#6818) (#6824). [Luca Colagrande]
+* Fix setting thread count in VerilatedContext (#6826 partial) (#6841). [Yangyu Chen]
* Fix firing array selects of events (#6829). [Amal Araweelo Almis]
+* Fix false IMPLICITSTATIC on localparam (#6835). [Geza Lore]
+* Fix randcase under fork (#6843). [Amal Araweelo Almis]
+* Fix JSON missing `signed` indication (#6845).
Verilator 5.042 2025-11-02
@@ -551,6 +559,7 @@ Verilator 5.034 2025-02-24
* Optimize labels as final `if` block statements (#5744).
* Optimize empty function definition bodies (#5750).
* Optimize splitting trigger computation and dump (#5798). [Geza Lore]
+* Optimize some DFG multiplexers (#6822). [Yangyu Chen]
* Fix error message when call task as a function (#3089). [Matthew Ballance]
* Fix force VPI public signal visibility (#5225). [Frédéric Requin]
* Fix VPI iteration over hierarchy (#5314) (#5731). [Natan Kreimer]
diff --git a/Makefile.in b/Makefile.in
index 15134ab35..5e1b787e7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -541,6 +541,7 @@ YAML_FILES = \
.*.yml \
.github/*.yml \
.github/*/*.yml \
+ CITATION.cff \
######################################################################
# Format
diff --git a/bin/verilator b/bin/verilator
index 62970eadd..730148ed8 100755
--- a/bin/verilator
+++ b/bin/verilator
@@ -408,6 +408,8 @@ detailed descriptions of these arguments.
-I
Directory to search for includes
--if-depth Tune IFDEPTH warning
+incdir+ Directory to search for includes
+ --inline-cfuncs Inline CFuncs with <=value nodes (0=off)
+ --inline-cfuncs-product Inline CFuncs if size*calls <= value
--inline-mult Tune module inlining
--instr-count-dpi Assumed dynamic instruction count of DPI imports
-j Parallelism for --build-jobs/--verilate-jobs
diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS
index 0c8b1cc0b..2ca03eddd 100644
--- a/docs/CONTRIBUTORS
+++ b/docs/CONTRIBUTORS
@@ -125,6 +125,7 @@ John Wehle
Jonathan Drolet
Jonathan Schröter
Jordan McConnon
+Jose Drowne
Jose Loyola
Josep Sans
Joseph Nwabueze
@@ -233,6 +234,7 @@ Steven Hugg
Szymon Gizler
Sören Tempel
Teng Huang
+Thomas Aldrian
Thomas Dybdahl Ahle
Tim Hutt
Tim Snyder
diff --git a/docs/gen/ex_ASSIGNEQEXPR_faulty.rst b/docs/gen/ex_ASSIGNEQEXPR_faulty.rst
index 7fd7546e0..af5f59067 100644
--- a/docs/gen/ex_ASSIGNEQEXPR_faulty.rst
+++ b/docs/gen/ex_ASSIGNEQEXPR_faulty.rst
@@ -1,9 +1,8 @@
.. comment: generated by t_lint_assigneqexpr_bad
.. code-block:: sv
:linenos:
- :emphasize-lines: 3
- assign d_o = // Note = not == below
- (
- c_o = 1 // <--- Warning: ASSIGNEQEXPR
- ) ? 1 : (
+ output logic c_o,
+ output logic d_o
+ );
+ assign c_o = (a_i != 0) ? 1 : 0;
diff --git a/docs/gen/ex_FUNCTIMECTL_faulty.rst b/docs/gen/ex_FUNCTIMECTL_faulty.rst
index 5c2e70053..42e21e889 100644
--- a/docs/gen/ex_FUNCTIMECTL_faulty.rst
+++ b/docs/gen/ex_FUNCTIMECTL_faulty.rst
@@ -4,4 +4,4 @@
:emphasize-lines: 2
function void calls_timing_ctl;
- @e; // <--- Bad IEEE 1800-2023 13.4 time-controlling
+ @e; // <--- Bad IEEE 1800-2023 13.4 time-controlling
diff --git a/docs/guide/connecting.rst b/docs/guide/connecting.rst
index dab359147..c9d7f7578 100644
--- a/docs/guide/connecting.rst
+++ b/docs/guide/connecting.rst
@@ -502,16 +502,16 @@ described above is just a wrapper which calls these two functions.
3. If using delays and :vlopt:`--timing`, there are two additional methods
the user should call:
- * ``designp->eventsPending()``, which returns ``true`` if there are
- any delayed events pending,
+ * ``designp->eventsPending()``, which returns ``true`` if there are any
+ delayed events pending,
* ``designp->nextTimeSlot()``, which returns the simulation time of the
next delayed event. This method can only be called if
``designp->eventsPending()`` returned ``true``.
Call ``eventsPending()`` to check if you should continue with the
simulation, and then ``nextTimeSlot()`` to move simulation time forward.
-:vlopt:`--main` can be used with :vlopt:`--timing` to generate a basic example
-of a timing-enabled eval loop.
+:vlopt:`--main` can be used with :vlopt:`--timing` to generate a basic
+example of a timing-enabled eval loop.
When ``eval()`` (or ``eval_step()``) is called Verilator looks for changes
in clock signals and evaluates related sequential always blocks, such as
diff --git a/docs/guide/contributors.rst b/docs/guide/contributors.rst
index dd5676cce..a782eb120 100644
--- a/docs/guide/contributors.rst
+++ b/docs/guide/contributors.rst
@@ -29,9 +29,10 @@ Alliance `_, and `Antmicro Ltd
Previous major corporate sponsors of Verilator, by providing significant
contributions of time or funds include: Antmicro Ltd., Atmel Corporation,
Compaq Corporation, Digital Equipment Corporation, Embecosm Ltd., Fractile
-Ltd., Hicamp Systems, Intel Corporation, Marvell Inc., Mindspeed Technologies
-Inc., MicroTune Inc., picoChip Designs Ltd., Sun Microsystems Inc., Nauticus
-Networks Inc., SiCortex Inc, Shunyao CAD, and Western Digital Inc.
+Ltd., Hicamp Systems, Intel Corporation, Marvell Inc., Mindspeed
+Technologies Inc., MicroTune Inc., picoChip Designs Ltd., Sun Microsystems
+Inc., Nauticus Networks Inc., SiCortex Inc, Shunyao CAD, and Western
+Digital Inc.
The contributors of major functionality are: Jeremy Bennett, Krzysztof
Bieganski, Byron Bradley, Lane Brooks, John Coiner, Duane Galbi, Arkadiusz
diff --git a/docs/guide/example_binary.rst b/docs/guide/example_binary.rst
index c8d656b52..6633d46d1 100644
--- a/docs/guide/example_binary.rst
+++ b/docs/guide/example_binary.rst
@@ -39,8 +39,7 @@ Breaking this command down:
#. :vlopt:`-j` `0` to Verilate using use as many CPU threads as the machine
has.
-#. :vlopt:`-Wall` so Verilator has stronger lint warnings
- enabled.
+#. :vlopt:`-Wall` so Verilator has stronger lint warnings enabled.
#. An finally, :command:`our.v`, which is our SystemVerilog design file.
diff --git a/docs/guide/example_cc.rst b/docs/guide/example_cc.rst
index 7278d7270..c01f294d5 100644
--- a/docs/guide/example_cc.rst
+++ b/docs/guide/example_cc.rst
@@ -60,8 +60,7 @@ Breaking this command down:
#. :vlopt:`-j 0 <-j>` to Verilate using use as many CPU threads as the
machine has.
-#. :vlopt:`-Wall` so Verilator has stronger lint warnings
- enabled.
+#. :vlopt:`-Wall` so Verilator has stronger lint warnings enabled.
#. And finally, :command:`our.v` which is our SystemVerilog design file.
diff --git a/docs/guide/exe_verilator.rst b/docs/guide/exe_verilator.rst
index f748f6ea1..11add271f 100644
--- a/docs/guide/exe_verilator.rst
+++ b/docs/guide/exe_verilator.rst
@@ -867,6 +867,29 @@ Summary:
compatibility and is not recommended usage as this is not supported by
some third-party tools.
+.. option:: --inline-cfuncs
+
+ Inline small CFunc calls directly into their callers when the function
+ has at most nodes. This reduces function call overhead when
+ :vlopt:`--output-split-cfuncs` places functions in separate compilation
+ units that the C++ compiler cannot inline.
+
+ Set to 0 to disable this optimization. The default is 20.
+
+ This optimization is automatically disabled when :vlopt:`--prof-cfuncs`
+ or :vlopt:`--trace` is used.
+
+.. option:: --inline-cfuncs-product
+
+ Tune the inlining of CFunc calls for larger functions. When a function
+ is too large to always inline (exceeds :vlopt:`--inline-cfuncs` threshold),
+ it may still be inlined if the function size multiplied by the number of
+ call sites is at most .
+
+ This allows functions that are called only once or twice to be inlined
+ even if they exceed the small function threshold. Set to 0 to only inline
+ functions below the :vlopt:`--inline-cfuncs` threshold. The default is 200.
+
.. option:: --inline-mult
Tune the inlining of modules. The default value of 2000 specifies that
@@ -2495,8 +2518,8 @@ The grammar of control commands is as follows:
converted into ``begin``/``end`` blocks.
Similar to :option:`/*verilator&32;timing_on*/`,
- :option:`/*verilator&32;timing_off*/` metacomments, but interpreted
- independtly. If either a control file, or metacommets disable timing
+ :option:`/*verilator&32;timing_off*/` meta-comments, but interpreted
+ independently. If either a control file, or meta-comments disable timing
constructs, they will be disabled.
.. t_dist_docs_style ignore tracing_on
diff --git a/docs/guide/extensions.rst b/docs/guide/extensions.rst
index 79d4d50fa..e4d003c2a 100644
--- a/docs/guide/extensions.rst
+++ b/docs/guide/extensions.rst
@@ -1,9 +1,9 @@
.. Copyright 2003-2025 by Wilson Snyder.
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
-=====================
- Language Extensions
-=====================
+===================
+Language Extensions
+===================
The following additional constructs are the extensions Verilator supports
on top of standard Verilog code. Using these features outside of comments
diff --git a/docs/guide/faq.rst b/docs/guide/faq.rst
index dd56b20da..b806ca180 100644
--- a/docs/guide/faq.rst
+++ b/docs/guide/faq.rst
@@ -403,8 +403,8 @@ How do I get faster build times?
environment variable to override this. Also see the
:vlopt:`--output-split` option and :ref: `Profiling ccache efficiency`.
-* To reduce the compile time of classes that use a Verilated module (e.g., a
- top CPP file) you may wish to add a
+* To reduce the compile time of classes that use a Verilated module (e.g.,
+ a top CPP file) you may wish to add a
:option:`/*verilator&32;no_inline_module*/` metacomment to your top-level
module. This will decrease the amount of code in the model's Verilated
class, improving compile times of any instantiating top-level C++ code,
diff --git a/docs/guide/install.rst b/docs/guide/install.rst
index b7a1c1297..b9ac0ad94 100644
--- a/docs/guide/install.rst
+++ b/docs/guide/install.rst
@@ -163,10 +163,10 @@ packages (see internals.rst), and a Python virtual environment:
cpan install Pod::Perldoc
The Python virtual environment is only required for running the whole test
-suite, and for additional development steps like linting and formatting. It is
-not required for building Verilator itself. To install the python virtual
-environment and all dependencies automatically, run the following once, after
-``configure``:
+suite, and for additional development steps like linting and formatting. It
+is not required for building Verilator itself. To install the python
+virtual environment and all dependencies automatically, run the following
+once, after ``configure``:
.. code-block:: bash
diff --git a/docs/guide/languages.rst b/docs/guide/languages.rst
index a5da686f2..05dc1f8ed 100644
--- a/docs/guide/languages.rst
+++ b/docs/guide/languages.rst
@@ -143,8 +143,8 @@ error, except:
* delay statements - they are ignored (as they are in synthesis), though they
do issue a :option:`STMTDLY` warning,
-* intra-assignment timing controls - they are ignored, though they do issue an
- :option:`ASSIGNDLY` warning,
+* intra-assignment timing controls - they are ignored, though they do issue
+ an :option:`ASSIGNDLY` warning,
* net delays - they are ignored,
* event controls at the top of the procedure,
diff --git a/docs/guide/verilating.rst b/docs/guide/verilating.rst
index 7e79d3641..25b5e966f 100644
--- a/docs/guide/verilating.rst
+++ b/docs/guide/verilating.rst
@@ -22,8 +22,8 @@ Verilator may be used in five major ways:
that may be used to feed into other user-designed tools.
* With the :vlopt:`-E` option, Verilator will preprocess the code according
- to IEEE preprocessing rules and write the output to standard out. This
- is useful to feed other tools and to debug how "\`define" statements are
+ to IEEE preprocessing rules and write the output to standard out. This is
+ useful to feed other tools and to debug how "\`define" statements are
expanded.
@@ -80,8 +80,9 @@ Verilator first reads all files provided on the command line and
:vlopt:`-f` files, and parses all modules within. Each module is assigned
to the most recent library specified with :vlopt:`-work`, thus `-work liba
a.v -work libb b.v` will assign modules in `a.v` to `liba` and modules in
-`b.v` to `libb`. In the absence of a `-work` mapping, each module is optionally
-assigned to a library based on mappings provided by :vlopt:`-libmap`.
+`b.v` to `libb`. In the absence of a `-work` mapping, each module is
+optionally assigned to a library based on mappings provided by
+:vlopt:`-libmap`.
If a module is not defined from a file on the command-line, Verilator
attempts to find a filename constructed from the module name using
diff --git a/docs/guide/warnings.rst b/docs/guide/warnings.rst
index f231e0894..eeec260b5 100644
--- a/docs/guide/warnings.rst
+++ b/docs/guide/warnings.rst
@@ -1,9 +1,9 @@
.. Copyright 2003-2025 by Wilson Snyder.
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
-=====================
- Errors and Warnings
-=====================
+===================
+Errors and Warnings
+===================
.. _disabling warnings:
@@ -46,8 +46,8 @@ Warnings may be disabled in multiple ways:
lint_off -rule UNSIGNED -file "*/example.v" -lines 1
Metacomments and control file directives do not interact. If a warning is
-disabled by either metacomments, or a directive in a control file, it will not
-be emitted.
+disabled by either metacomments, or a directive in a control file, it will
+not be emitted.
Error And Warning Format
========================
diff --git a/docs/internals.rst b/docs/internals.rst
index cf5325f4b..df592e8ac 100644
--- a/docs/internals.rst
+++ b/docs/internals.rst
@@ -1,8 +1,8 @@
|Logo|
-=====================
- Verilator Internals
-=====================
+===================
+Verilator Internals
+===================
.. contents::
:depth: 3
@@ -1771,8 +1771,8 @@ files that were read, filtered by preprocessing. This file can be fed back
into Verilator, replacing on the command line all of the previous input
files, to enable simplification of test cases. This file also contains most
command line arguments Verilator was invoked as `// verilator fargs``
-metacomments, with and can be parsed by ``-f`. So to reproduce the run that
-created the file, run:
+metacomments, with and can be parsed by `\`-f`. So to reproduce the run
+that created the file, run:
::
verilator -f __inputs.vpp __inputs.vpp
@@ -2095,11 +2095,18 @@ To print a node:
``src/.gdbinit`` and ``src/.gdbinit.py`` define handy utilities for working
with JSON AST dumps. For example:
-* ``jstash nodep`` - Perform a JSON AST dump and save it into GDB value history (e.g. ``$1``)
-* ``jtree nodep`` - Perform a JSON AST dump and pretty print it using ``astsee_verilator``.
-* ``jtree $1`` - Pretty print a dump that was previously saved by ``jstash``.
-* ``jtree nodep -d '.file, .timeunit'`` - Perform a JSON AST dump, filter out some fields and pretty print it.
-* ``jtree 0x55555613dca0`` - Pretty print using address literal (rather than actual pointer).
+* ``jstash nodep`` - Perform a JSON AST dump and save it into GDB value
+ history (e.g. ``$1``)
+
+* ``jtree nodep`` - Perform a JSON AST dump and pretty print it using
+ ``astsee_verilator``.
+* ``jtree $1`` - Pretty print a dump that was previously saved by
+ ``jstash``.
+* ``jtree nodep -d '.file, .timeunit'`` - Perform a JSON AST dump, filter
+ out some fields and pretty print it.
+
+* ``jtree 0x55555613dca0`` - Pretty print using address literal (rather
+ than actual pointer).
* ``jtree $1 nodep`` - Diff ``nodep`` against an older dump.
A detailed description of ``jstash`` and ``jtree`` can be displayed using
diff --git a/docs/spelling.txt b/docs/spelling.txt
index a2c00de64..7a68d978e 100644
--- a/docs/spelling.txt
+++ b/docs/spelling.txt
@@ -4,6 +4,8 @@ Accellera
Affe
Aleksander
Alexandre
+Almis
+Amal
Ami
Amir
Anastasiadis
@@ -13,6 +15,7 @@ Antmicro
Antonin
Antwerpen
Arasanipalai
+Araweelo
Arjen
Arshid
Asciidoc
@@ -986,6 +989,7 @@ qrqiuren
radix
randc
randcase
+randmode
randsequence
randstate
raphmaster
diff --git a/examples/json_py/sub.v b/examples/json_py/sub.v
index 94037d4c4..19a635b3e 100644
--- a/examples/json_py/sub.v
+++ b/examples/json_py/sub.v
@@ -5,12 +5,12 @@
// SPDX-License-Identifier: CC0-1.0
// ======================================================================
-module sub
- #(parameter type TYPE_t = logic)
- (
- input TYPE_t in,
- output TYPE_t out
- );
+module sub #(
+ parameter type TYPE_t = logic
+) (
+ input TYPE_t in,
+ output TYPE_t out
+);
// Some simple logic
always_comb out = ~in;
diff --git a/examples/json_py/top.v b/examples/json_py/top.v
index 1106464f1..38a3be52b 100644
--- a/examples/json_py/top.v
+++ b/examples/json_py/top.v
@@ -5,29 +5,37 @@
// SPDX-License-Identifier: CC0-1.0
// ======================================================================
-module top
- (
- input clk,
- input fastclk,
- input reset_l,
+module top (
+ input clk,
+ input fastclk,
+ input reset_l,
- output wire [1:0] out_small,
- output wire [39:0] out_quad,
- output wire [69:0] out_wide,
- input [1:0] in_small,
- input [39:0] in_quad,
- input [69:0] in_wide
- );
+ output wire [1:0] out_small,
+ output wire [39:0] out_quad,
+ output wire [69:0] out_wide,
+ input [1:0] in_small,
+ input [39:0] in_quad,
+ input [69:0] in_wide
+);
- sub #(.TYPE_t(logic [1:0])) sub_small
- (.in(in_small),
- .out(out_small));
+ sub #(
+ .TYPE_t(logic [1:0])
+ ) sub_small (
+ .in(in_small),
+ .out(out_small)
+ );
- sub #(.TYPE_t(logic [39:0])) sub_quad
- (.in(in_quad),
- .out(out_quad));
+ sub #(
+ .TYPE_t(logic [39:0])
+ ) sub_quad (
+ .in(in_quad),
+ .out(out_quad)
+ );
- sub #(.TYPE_t(logic [69:0])) sub_wide
- (.in(in_wide),
- .out(out_wide));
+ sub #(
+ .TYPE_t(logic [69:0])
+ ) sub_wide (
+ .in(in_wide),
+ .out(out_wide)
+ );
endmodule
diff --git a/examples/make_protect_lib/secret_impl.v b/examples/make_protect_lib/secret_impl.v
index f2dc01b09..3f8fadf66 100644
--- a/examples/make_protect_lib/secret_impl.v
+++ b/examples/make_protect_lib/secret_impl.v
@@ -7,13 +7,13 @@
// This module will be used as libsecret.a or libsecret.so without
// exposing the source.
-module secret_impl
- (
- input [31:0] a,
- input [31:0] b,
- output logic [31:0] x,
- input clk,
- input reset_l);
+module secret_impl (
+ input [31:0] a,
+ input [31:0] b,
+ output logic [31:0] x,
+ input clk,
+ input reset_l
+);
logic [31:0] accum_q;
logic [31:0] secret_value;
@@ -27,10 +27,8 @@ module secret_impl
end
else begin
accum_q <= accum_q + a;
- if (accum_q > 10)
- x <= b;
- else
- x <= a + b + secret_value;
+ if (accum_q > 10) x <= b;
+ else x <= a + b + secret_value;
end
end
diff --git a/examples/make_protect_lib/top.v b/examples/make_protect_lib/top.v
index c80c1b2bb..c8989fe42 100644
--- a/examples/make_protect_lib/top.v
+++ b/examples/make_protect_lib/top.v
@@ -6,7 +6,9 @@
// See also https://verilator.org/guide/latest/examples.html"
-module top (input clk);
+module top (
+ input clk
+);
int cyc;
logic reset_l;
@@ -14,7 +16,13 @@ module top (input clk);
logic [31:0] b;
logic [31:0] x;
- verilated_secret secret (.a, .b, .x, .clk, .reset_l);
+ verilated_secret secret (
+ .a,
+ .b,
+ .x,
+ .clk,
+ .reset_l
+ );
always @(posedge clk) begin
$display("[%0t] cyc=%0d a=%0d b=%0d x=%0d", $time, cyc, a, b, x);
diff --git a/examples/make_tracing_c/sub.v b/examples/make_tracing_c/sub.v
index ad0ad3765..473139c07 100644
--- a/examples/make_tracing_c/sub.v
+++ b/examples/make_tracing_c/sub.v
@@ -5,11 +5,10 @@
// SPDX-License-Identifier: CC0-1.0
// ======================================================================
-module sub
- (
- input clk,
- input reset_l
- );
+module sub (
+ input clk,
+ input reset_l
+);
// Example counter/flop
reg [31:0] count_c;
diff --git a/examples/make_tracing_c/top.v b/examples/make_tracing_c/top.v
index c3b140cb2..44393f9d2 100644
--- a/examples/make_tracing_c/top.v
+++ b/examples/make_tracing_c/top.v
@@ -8,24 +8,23 @@
// This is intended to be a complex example of several features, please also
// see the simpler examples/make_hello_c.
-module top
- (
- // Declare some signals so we can see how I/O works
- input clk,
- input reset_l,
+module top (
+ // Declare some signals so we can see how I/O works
+ input clk,
+ input reset_l,
- output wire [1:0] out_small,
- output wire [39:0] out_quad,
- output wire [69:0] out_wide,
- input [1:0] in_small,
- input [39:0] in_quad,
- input [69:0] in_wide
- );
+ output wire [1:0] out_small,
+ output wire [39:0] out_quad,
+ output wire [69:0] out_wide,
+ input [1:0] in_small,
+ input [39:0] in_quad,
+ input [69:0] in_wide
+);
// Connect up the outputs, using some trivial logic
assign out_small = ~reset_l ? '0 : (in_small + 2'b1);
- assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
- assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
+ assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
+ assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
// And an example sub module. The submodule will print stuff.
sub sub (/*AUTOINST*/
diff --git a/examples/make_tracing_sc/sub.v b/examples/make_tracing_sc/sub.v
index fd84e6177..98328fbcc 100644
--- a/examples/make_tracing_sc/sub.v
+++ b/examples/make_tracing_sc/sub.v
@@ -5,12 +5,11 @@
// SPDX-License-Identifier: CC0-1.0
// ======================================================================
-module sub
- (
- input clk,
- input fastclk,
- input reset_l
- );
+module sub (
+ input clk,
+ input fastclk,
+ input reset_l
+);
// Example counter/flop
reg [31:0] count_f;
diff --git a/examples/make_tracing_sc/top.v b/examples/make_tracing_sc/top.v
index 8543934d2..8e5c42a40 100644
--- a/examples/make_tracing_sc/top.v
+++ b/examples/make_tracing_sc/top.v
@@ -8,25 +8,24 @@
// This is intended to be a complex example of several features, please also
// see the simpler examples/make_hello_c.
-module top
- (
- // Declare some signals so we can see how I/O works
- input clk,
- input fastclk,
- input reset_l,
+module top (
+ // Declare some signals so we can see how I/O works
+ input clk,
+ input fastclk,
+ input reset_l,
- output wire [1:0] out_small,
- output wire [39:0] out_quad,
- output wire [69:0] out_wide,
- input [1:0] in_small,
- input [39:0] in_quad,
- input [69:0] in_wide
- );
+ output wire [1:0] out_small,
+ output wire [39:0] out_quad,
+ output wire [69:0] out_wide,
+ input [1:0] in_small,
+ input [39:0] in_quad,
+ input [69:0] in_wide
+);
// Connect up the outputs, using some trivial logic
assign out_small = ~reset_l ? '0 : (in_small + 2'b1);
- assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
- assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
+ assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
+ assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
// And an example sub module. The submodule will print stuff.
sub sub (/*AUTOINST*/
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a08cb45c2..487980e40 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -114,6 +114,7 @@ set(HEADERS
V3Hasher.h
V3HierBlock.h
V3Inline.h
+ V3InlineCFuncs.h
V3Inst.h
V3InstrCount.h
V3Interface.h
@@ -287,6 +288,7 @@ set(COMMON_SOURCES
V3Hasher.cpp
V3HierBlock.cpp
V3Inline.cpp
+ V3InlineCFuncs.cpp
V3Inst.cpp
V3InstrCount.cpp
V3Interface.cpp
diff --git a/src/Makefile_obj.in b/src/Makefile_obj.in
index 74696c1b1..1bc6cc3af 100644
--- a/src/Makefile_obj.in
+++ b/src/Makefile_obj.in
@@ -284,6 +284,7 @@ RAW_OBJS_PCH_ASTNOMT = \
V3Gate.o \
V3HierBlock.o \
V3Inline.o \
+ V3InlineCFuncs.o \
V3Inst.o \
V3InstrCount.o \
V3Interface.o \
diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h
index 96ae9ee88..1009c3234 100644
--- a/src/V3AstNodeOther.h
+++ b/src/V3AstNodeOther.h
@@ -1203,6 +1203,7 @@ class AstModportVarRef final : public AstNode {
// A input/output/etc variable referenced under a modport
// The storage for the variable itself is inside the interface, thus this is a reference
// PARENT: AstModport
+ // @astgen op1 := exprp : Optional[AstNodeExpr]
//
// @astgen ptr := m_varp : Optional[AstVar] // Link to the actual Var
string m_name; // Name of the variable referenced
@@ -1212,6 +1213,13 @@ public:
: ASTGEN_SUPER_ModportVarRef(fl)
, m_name{name}
, m_direction{direction} {}
+ AstModportVarRef(FileLine* fl, const string& name, AstNodeExpr* exprp,
+ VDirection::en direction)
+ : ASTGEN_SUPER_ModportVarRef(fl)
+ , m_name{name}
+ , m_direction{direction} {
+ this->exprp(exprp);
+ };
ASTGEN_MEMBERS_AstModportVarRef;
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp
index 6492fed29..6396a6f8a 100644
--- a/src/V3AstNodes.cpp
+++ b/src/V3AstNodes.cpp
@@ -2378,6 +2378,7 @@ void AstNodeDType::dump(std::ostream& str) const {
}
void AstNodeDType::dumpJson(std::ostream& str) const {
dumpJsonBoolFunc(str, generic);
+ if (isSigned() && !isDouble()) dumpJsonBool(str, "signed", 1);
dumpJsonGen(str);
}
void AstNodeDType::dumpSmall(std::ostream& str) const VL_MT_STABLE {
diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp
index 53e8cac0c..3c494b963 100644
--- a/src/V3Fork.cpp
+++ b/src/V3Fork.cpp
@@ -673,8 +673,8 @@ class ForkVisitor final : public VNVisitor {
if (nodep->access().isWriteOrRW() && (!nodep->isClassHandleValue() || nodep->user2())) {
nodep->v3warn(
E_LIFETIME,
- "Invalid reference: Process might outlive variable `"
- << varp->name() << "`.\n"
+ "Invalid reference: Process might outlive variable "
+ << varp->prettyNameQ() << ".\n"
<< varp->warnMore()
<< "... Suggest use it as read-only to initialize a local copy at the "
"beginning of the process, or declare it as static. It is also "
diff --git a/src/V3InlineCFuncs.cpp b/src/V3InlineCFuncs.cpp
new file mode 100644
index 000000000..95927d19e
--- /dev/null
+++ b/src/V3InlineCFuncs.cpp
@@ -0,0 +1,269 @@
+// -*- mode: C++; c-file-style: "cc-mode" -*-
+//*************************************************************************
+// DESCRIPTION: Verilator: Inline small CFuncs into their callers
+//
+// Code available from: https://verilator.org
+//
+//*************************************************************************
+//
+// Copyright 2003-2025 by Wilson Snyder. This program is free software; you
+// can redistribute it and/or modify it under the terms of either the GNU
+// Lesser General Public License Version 3 or the Perl Artistic License
+// Version 2.0.
+// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
+//
+//*************************************************************************
+// V3InlineCFuncs's Transformations:
+//
+// For each CCall to a small CFunc:
+// - Check if function is eligible for inlining (small enough, same scope)
+// - Clone local variables with unique names to avoid collisions
+// - Replace CCall with cloned function body statements
+//
+// Two tunables control inlining:
+// --inline-cfuncs : Always inline if size <= n (default 20)
+// --inline-cfuncs-product : Also inline if size * call_count <= n (default 200)
+//
+//*************************************************************************
+
+#include "V3PchAstNoMT.h" // VL_MT_DISABLED_CODE_UNIT
+
+#include "V3InlineCFuncs.h"
+
+#include "V3AstUserAllocator.h"
+#include "V3Stats.h"
+
+#include