Commit Graph

1495 Commits

Author SHA1 Message Date
Wilson Snyder c927f05f35 Update fst from upstream (#6771 partial) 2026-06-22 17:25:59 -04:00
Geza Lore a37e2ee94b
Optimize wide decoder case statements into decoder expressions (#7804)
Extend the decoder-pattern case optimization to selectors that are too
wide for a full 2^width lookup table. A decoder-pattern case (where
every case item assigns constants to a fixed set of LHSs) is lowered to
a new AstMachMasked expression. AstMachMasked is emitted as a run-time
VL_MATCHMASKEd_* function call. It contains a packed constant pool table,
'matchp', which is a list of '(mask, bits)' pairs. At runtime, the index of the 
first matching entry is returned, and is used to index a value table. This single
(albeit complicated) expression can replace large if-else trees whole, resulting
in much more compact code with fewer static hard to predict branches. It
is worth about 10% speed and 30% code size in some designs.

Example:

```systemverilog
    logic [39:0] sel;
    always_comb
      casez (sel)
        40'b???????????????????????????????????????1: out = 8'h01;
        40'b??????????????????????????????????????1?: out = 8'h02;
        40'b?????????????????????????????????????1??: out = 8'h03;
        default:                                      out = 8'hff;
      endcase
```

is compiled to:

```c++
    out = TABLE_value[VL_MATCHMASKED_Q(sel, CONST_match)];
```

Where 'CONST_match' contains 4 entries, of a 40-bit mask and 40-bit bit
pattern each, and 'TABLE_value' contains 4 entries of the corresponding
8-bit results. (Entries are aligned to word boundaries to avoid runtime
bit swizzling)
2026-06-19 19:46:13 +01:00
Yilou Wang b581f73843
Support $assertcontrol control_type from lock to kill (#7788) 2026-06-17 07:17:39 -04:00
Nikolai Kumar a5fad9882f
Fix force unpacked bitselect (#7744) (#7745)
Fixes #7744.
2026-06-15 21:57:59 -04:00
Wilson Snyder 0e4a3a92b0 CI: Autoformat markdown files 2026-06-15 17:44:50 -04:00
Yilou Wang 709c444df3
Internals: Add AGENTS files to guide AI contributions (#7562) (#7765)
Fixes #7562.
2026-06-15 08:42:34 -04:00
Wilson Snyder df78db0e73 Fix $fflush and autoflush with --threads (#7782).
Fixes #7782.
2026-06-14 13:36:49 -04:00
Matthew Ballance e03fa6c783
Support covergroup runtime model Phase A1 (#7728) 2026-06-12 11:40:48 -04:00
pawelktk 75993ca9ea
Support assoc array methods with wide value types (#7680) 2026-06-10 09:39:43 -04:00
Nikolai Kumar bc86701bec
Support forceable on unpacked array variables (#7677) (#7678)
Fixes #7677.
2026-06-05 20:43:06 -04:00
Matthew Ballance 2886291eba
Support covergroups, coverpoints, and bins (#784) (#7117)
Fixes #784.
2026-06-05 09:35:01 -04:00
Nick Brereton bbd8d927ee
Support printing enum names for %p and %s (#5523) (#7338 repair) (#7521) (#7527) 2026-06-03 14:55:00 -04:00
Geza Lore c878a7e735 Optimize VL_ONEHOT
Equivalent to `__builtin_popcount(_) == 1` and a few instructions
shorter.
2026-06-03 11:24:34 +01:00
Geza Lore 7b45b3ee8a Optimize string formatting runtime functions
Add an overload that takes `const char*` format string. This avoids
having to construct/destruct a temporary `std::string` at the call site
when calling these functions with a string literal, which is fairly
common. This is worth 25% code size on some assertion heavy design.

Also use `std::string::clear()` instead of assigning an empty string
which is more efficient.
2026-06-03 11:18:38 +01:00
Geza Lore efb83c55de
Optimize VL_SFORMAT when result is string (#7702)
Omit unused bit width parameter. Emit rule is simple enough to change
and the unused parameter just bloats code size.
2026-06-03 08:42:48 +01:00
Wilson Snyder e965fb92de Fix skipping nulls in $sscanf (#7689).
Fixes #7689.
2026-05-31 17:25:28 -04:00
Paul Swirhun 1eb12685a7
Support streaming into 2-D unpacked arrays (#7686) (#7687)
Fixes #7686.
2026-05-30 22:08:32 -04:00
Yilou Wang fa0f814686
Fix biased bit distribution under value < (1 << N) constraints (#7563) (#7684)
Fixes #7563
2026-05-30 13:00:35 -04:00
Geza Lore cd83e40be5 Fix runtime speed summary report
Repost speed as 'simtime'/'walltime' instead of dividing by 'cputime'
('cputime' is ~ 'threads * walltime' in multi-threaded mode)
2026-05-28 07:20:54 +01:00
Tracy Narine a2fae5eb4b
Add `+verilator+log+file` (#4505) (#7645)
Fixes #4505.
2026-05-27 14:33:19 -04:00
Geza Lore f93b4bbd05
Internals: Remove 'VlWide::operator bool()' (#7652)
This was a fudge to work around using VlWide in `if` conditions without
a `_ != 0` check. That check is actually inserted by V3Width (or an
equivalent reduction), so the offending code was only generated
internally. Hopefully fixed the single instance where this really
happened. (If not, C++ will fail to compile with "cannot convert VlWide
to bool in 'if (__HERE__)'" errors, still better than the old version
which used to silently not do the right test due to incorrect implicit
conversions.)
2026-05-24 13:09:31 +01:00
Geza Lore bd4bd82d4b Optimize primitive runtime functions
These were a victim of recent refactor but are actually important
(#4733). It also helps in debug builds not to use -O0 memcpy/memset.
2026-05-24 11:39:39 +01:00
Wilson Snyder c507dcf610 Internals: Enforce types on C++ enums. No functional change intended. 2026-05-22 17:59:57 -04:00
Geza Lore c99aa8ede5
Fix erroneous implicit conversions of VlWide (#7642)
Change WDataInP/WDataOutP to be opaque handles types instead of aliases
to raw pointers. This subsequently eliminates needing an implicit cast
operator in VlWide, which is replaced with implicit constructors of
WDataInP/WDataOutP that can create a handle from a VlWide. This
eliminates some unsafe conversions that the previous implicit cast
operator unintentionally enabled (e.g. #7618). It also eliminates
having to insert ".data()" in various places int he generated code, which
simplifies internals (the only place ".data()" should be needed is in
calls to variadic functions where the expected type of the argument is
not WDataInP/WDataOutP).

The handles otherwise behave like pointers, implementing the minimal
amount of operators required to code the runtime. The handle is still
only a single pointer, and will be passed in registers as before, so
this patch should be performance neutral.

As part of this removed WData, which used to be an alias for EData.
All uses are now either EData*, WDataInP, WDataOutP, or VlWide directly.
2026-05-22 20:05:08 +01:00
Benjamin Collier 69b3c5f6d1
Support streaming on queues (#7597) 2026-05-20 19:14:02 -04:00
Geza Lore afad8db672
Fix VlWide equality comparion in unpacked structs (#7618) 2026-05-20 00:57:33 +01:00
Pawel Klopotek efdc8d1cbf
Fix unique_index method on assoc arrays with values differing from the keys (#7616)
Signed-off-by: Pawel Klopotek <pklopotek@internships.antmicro.com>
2026-05-19 09:51:23 -04:00
Krzysztof Bieganski eb258d7df7
IEEE-compliant, fair `std::semaphore` (#7435) (#7605)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2026-05-18 11:11:42 +02:00
Wilson Snyder c1ab369da2 Fix process comparison compile error with `--public-flat-rw` (#7592).
Fixes #7592.
2026-05-15 18:22:46 -04:00
Geza Lore 4e853d8cb6
Fix cpu pinning when no 'core id' present in /proc/cpuinfo (#7599) 2026-05-15 14:45:39 -04:00
Krzysztof Bieganski a42c8587cb
Optimize force read return values (#7596) 2026-05-14 20:26:02 -04:00
Wilson Snyder d66733aeb8 Fix process comparison compile error with `--public-flat-rw` (#7592).
Fixes #7592.
2026-05-14 17:52:28 -04:00
Krzysztof Bieganski c518abd22a
Optimize reading selected words on forced wide (#7391 repair) (#7554 partial) (#7572) 2026-05-14 07:38:42 -04:00
anonkey 67b21e4c62
Fix segmentation fault when using --trace with --lib-create (#7299) (#7518) 2026-05-12 10:16:47 -04:00
github action a5a1ed55d3 Apply 'make format' 2026-05-12 11:40:38 +00:00
Yu-Sheng Lin 0ebe01a778
Support new FST writer API (#6871) (#6992) 2026-05-12 07:39:43 -04:00
Wilson Snyder 303615bb37 Support TERMUX (#7559). [Laurent CHARRIER]
Fixes #7559.
2026-05-10 08:20:32 -04:00
Jakub Michalski 227812ecce
Internals: Fix unused variables (#7539) 2026-05-06 06:51:05 -04:00
Miguel 0e423a4b39
Fix `+verilator+seed` to default to 1, and 0 to randomly select (#7325) (#7516) 2026-05-05 12:10:51 -04:00
24bit-xjkp 082847a1a2
Fix std::unique_ptr with incomplete type for clang (#7501) (#7526)
Fixes #7501.
2026-05-02 12:14:54 -04:00
Wilson Snyder dd75c4cd1b Revert: 21020ea2: Support printing enum names for %p and %s (#5523 revert) (#7338 revert) (#7521 test) 2026-04-30 10:29:47 -04:00
Nick Brereton 21020ea2d1
Support printing enum names for %p and %s (#5523) (#7338) 2026-04-30 07:15:38 -04:00
Yilou Wang 4befec4463
Support rand_mode() on static rand class members (#7484) (#7510) 2026-04-29 17:07:27 -04:00
Yilou Wang 76c1b26e3b
Support `obj.randomize(null)` (#7487) (#7509) 2026-04-28 15:31:08 -04:00
Wilson Snyder 2cd9b8df66 Fix multiple inclusion of verilated_std.sv (#7478). 2026-04-23 15:32:02 -04:00
Yogish Sekhar a680919edc
Support native FSM state and arc coverage (#7412) 2026-04-22 15:18:59 -04:00
Artur Bieniek a1a8b9624c
Support IEEE-compliant force/release handling (#7391) 2026-04-21 11:54:42 -04:00
Geza Lore 97454a1bc5
Remove multi-threaded FST tracing (#7443)
Remove parallel (using the FST library writer thread) and offloaded
(separate Verilator internal thread) tracing (only used by FST). These
are not compatible with #6992, and #5806 should yield better performance
in all cases.

Consequently mark '--trace-threads' and '--trace-fst-thread' options as
deprecated
2026-04-19 16:02:12 +01:00
Christian Hecken f7a349c5a7
Fix uvm_hdl_release_and_read not reading release value or checking for success (#7425) 2026-04-19 08:24:07 -04:00
Yilou Wang 6ba45d3383
Support per-process RNG for process::srandom() and object seeding (#7408) (#7415)
Fixes #7408.
2026-04-13 13:58:53 -04:00