Commit Graph

1523 Commits

Author SHA1 Message Date
Yilou Wang 925a6640d1
Fix queued $finish/$stop request thread ordering (#7946 prep) (#7952) 2026-08-04 01:46:54 -04:00
BRDR LIFE 967b1bae57
Fix unique constraint crash, guards, and size (#8018) (#8018) 2026-07-31 23:37:53 -04:00
Yilou Wang 704c5a1c96
Fix gcov dump on warnings discarding later coverage counts (#8017) 2026-07-31 12:08:05 -04:00
Yilou Wang 99b71a37b7
Internals: Refactor randomization next and nextPhased into shared helpers (#7991 prep) (#8009). No functional change intended. 2026-07-30 21:41:37 -04:00
Artur Bieniek b70696fc0a
Fix $finish continuing event loop (#7267) (#7950)
Fixes #7267,
2026-07-30 21:39:21 -04:00
github action 42e043cb01 Apply 'make format' [ci skip] 2026-07-30 10:15:15 +00:00
24bit-xjkp c5c3c45102
Internals: Remove static inline functions in headers (#7988) (#8007) 2026-07-30 15:44:40 +05:30
Yilou Wang b5fa4212b0
Fix UNSATCONSTR reporting constraint indices above 9 (#7995) 2026-07-28 18:25:19 -04:00
Yilou Wang f22676eea9
Fix solve-before dropping all soft constraints in randomize() (#7963) 2026-07-20 14:55:49 -04:00
Bartosz Skorowski 176e333774
Fix lambda parameter types in queue min and max (#7962)
Signed-off-by: Bartosz Skorowski <bskorowski@internships.antmicro.com>
2026-07-20 06:53:40 -04:00
Kornel Uriasz 232b2eb04c
Fix dynamic array handling in solve...before (#7922) 2026-07-15 10:48:54 -04:00
Nick Brereton 25377b20af
Optimize VPI symbol registration and scope construction (#7936) 2026-07-15 10:31:42 -04:00
Jeffrey Song 4262aea87c
Internals: Use snprintf for random unique indexes (#7925) 2026-07-13 11:35:22 -07:00
Yilou Wang 7ca78a75e7
Fix scoped randomize with array members under rand_mode (#7877) 2026-07-11 20:28:49 -07:00
Yilou Wang ca83bc50bf
Fix solve-before over array variables failing randomization (#7876) 2026-07-11 20:44:37 -04:00
Adam Kostrzewski a21bd8a417
Fix VlQueue falling into wrong template spec (#7914) 2026-07-09 07:33:28 -07:00
Jakub Michalski 93d0443998
Fix memory leak in VerilatedFst::close() (#7899)
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
2026-07-08 08:48:17 +01:00
Dragon-Git 58bd13b623
Fix heap-use-after-free in `VlRNG::VlRNG()` (#7865) 2026-07-03 06:38:48 -04:00
Pawel Kojma b97df914dd
Fix clang++ ambiguous overload of '==' operator (#7863) 2026-07-03 06:37:48 -04:00
Geza Lore 1106e89c84 Optimize random initialization
Fetching a thread-local is relatively expensive. Random initializing
wides used to do it once or twice per word, and on short runs for
large designs can be noticeably expensive, so fetch once per variable
instead. Also remove unused VL_RAND_RESET_{Q,W} functions.
2026-07-02 16:38:14 +01:00
Jakub Michalski 506f703da5
Internals: Remove unused variables in verilated_funcs.h (#7862)
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
2026-07-02 07:16:42 -04:00
github action 514fa120f5 Apply 'make format' [ci skip] 2026-06-29 14:58:00 +00:00
Joshua Leahy cf7e3f791a
Fix covergroups without --coverage (#7848) (#7849)
Fixes #7848.
2026-06-29 10:56:59 -04:00
Wilson Snyder 9448e4366c Fix MSVC warning. No functional change. 2026-06-28 09:47:53 -04:00
Matthew Ballance d023b3b075
Support dynamic loading of VPI extensions (#7727) 2026-06-28 09:28:09 -04:00
Thomas Santerre bd6b9161dc
Optimize bit-scan loops into $mostsetbitp1 / $countones (#7822)
Recognize the common single-bit scan loop idioms in V3Unroll (before it
unrolls) and lower them to bit-reduction primitives, replacing a literal
W-iteration loop with one intrinsic-backed expression:

  target=0; for (i=0;i<W;i++) if (vec[i]) target = i + 1;      -> $mostsetbitp1(vec)
  target=0; for (i=0;i<W;i++) if (vec[i]) target = target + 1; -> $countones(vec)

The leading-one form lowers to a new AstMostSetBitP1 node, emitted as
VL_MOSTSETBITP1_{I,Q,W}; those runtime helpers now use __builtin_clz where
available (same pattern as VL_REDXOR's __builtin_parity), with the existing
bit scan as fallback.  The count-ones form reuses AstCountOnes ($countones,
popcount); as the DFG requires a 32-bit countones result it is built at 32
bits and narrowed to the accumulator width with a select.

Matching is structural to stay sound: the index must start at 0, increment
by exactly 1, and scan all W==width(vec) bits via a single 1-bit select of a
distinct vector, with the target pre-zeroed and no else branch.  The loop
bound is accepted as a strict ascending 'idx < W' written either way and
signed or unsigned (Gt/GtS/Lt/LtS).  Gated by -fbit-scan-loops (on at -O).

Adds t_bit_scan_loops (I/Q/W, count-ones and unsigned-index positives;
step-2, start-1, idx*2+1, vec[idx+1], target=idx and W!=width negatives, all
self-checked and asserted via --stats not to lower) plus t_bit_scan_loops_off
for the disable flag.

Motivated by a transformer inference design whose 80-bit leading-one detector
ran every cycle (~37% of runtime); the lowering is worth ~39% there.
2026-06-24 10:43:05 +01:00
Nick Brereton 6fbc7042a5
Support VPI access to unpacked struct members (#7823) 2026-06-23 07:04:51 -04:00
Artur Bieniek 87bebbb732
Support global $assertcontrol (#7807)
Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
2026-06-22 18:51:41 -04:00
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