verilator/docs
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
..
_static Fix Codacy warnings. No functional change. 2021-07-07 19:42:49 -04:00
bin Add SPDX copyright identifiers, and get 'reuse' clean. No functional change. 2026-01-26 20:24:34 -05:00
gen Fix false MULTIDRIVEN warning on always_ff variables (#7351) (#7621) 2026-05-27 08:34:11 -04:00
guide Optimize wide decoder case statements into decoder expressions (#7804) 2026-06-19 19:46:13 +01:00
.gitignore Spelling fixes. 2022-05-14 16:12:57 -04:00
AGENTS.md CI: Autoformat markdown files 2026-06-15 17:44:50 -04:00
CONTRIBUTING.rst Commentary: Use standard multiline rst comments, other cleanups 2026-06-18 21:58:01 -04:00
CONTRIBUTORS Support reduction XOR/AND operations in constraints (#7753) 2026-06-11 09:43:18 -04:00
Makefile Add SPDX copyright identifiers, and get 'reuse' clean. No functional change. 2026-01-26 20:24:34 -05:00
README.rst Commentary: Use standard multiline rst comments, other cleanups 2026-06-18 21:58:01 -04:00
internals.rst Commentary: Use standard multiline rst comments, other cleanups 2026-06-18 21:58:01 -04:00
security.rst Commentary: Use standard multiline rst comments, other cleanups 2026-06-18 21:58:01 -04:00
spelling.txt Commentary: Changes update 2026-06-18 21:56:02 -04:00
verilated.dox Cleanup missing copyrights and those on simply copied files. No functional change. 2023-01-20 20:42:30 -05:00

README.rst

..
   SPDX-FileCopyrightText: 2003-2026 Wilson Snyder
   SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0

Verilator Documentation
=======================

This folder contains sources for Verilator documentation.

For formatted documentation see:

- `Verilator README <https://github.com/verilator/verilator>`_

- `Verilator installation and package directory structure
  <https://verilator.org/install>`_

- `Verilator manual (HTML) <https://verilator.org/verilator_doc.html>`_, or
  `Verilator manual (PDF) <https://verilator.org/verilator_doc.pdf>`_

- `Subscribe to Verilator announcements
  <https://github.com/verilator/verilator-announce>`_

- `Verilator forum <https://verilator.org/forum>`_

- `Verilator issues <https://verilator.org/issues>`_