From d9701e64062e8cf1780a5a0bd076fb7e9dff9d64 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sun, 9 Mar 2025 14:31:01 +0000 Subject: [PATCH] Automatically split some packed variables (#5843) This patch adds a heuristic to V3SplitVar, and it attempts to split up packed variables that are only referenced via constant index, non-overlapping bit/range selects. This can eliminate some UNOPTFLAT cases. --- docs/guide/exe_verilator.rst | 5 + docs/guide/extensions.rst | 14 ++ src/V3Options.cpp | 2 + src/V3Options.h | 2 + src/V3SplitVar.cpp | 172 +++++++++++++++--- test_regress/t/t_func_ref_bad.py | 2 +- .../t/t_gate_inline_wide_noexclude_sel.py | 3 +- test_regress/t/t_opt_const.py | 3 +- test_regress/t/t_opt_const_dfg.py | 3 +- test_regress/t/t_order_blkandnblk_bad.out | 12 +- test_regress/t/t_order_blkandnblk_bad.v | 5 +- test_regress/t/t_split_var_0.py | 5 +- test_regress/t/t_split_var_2_trace.py | 4 +- test_regress/t/t_split_var_3_wreal.py | 4 +- test_regress/t/t_split_var_4.py | 4 +- test_regress/t/t_split_var_5.py | 4 +- test_regress/t/t_split_var_auto.py | 20 ++ test_regress/t/t_split_var_auto.v | 85 +++++++++ 18 files changed, 302 insertions(+), 47 deletions(-) create mode 100755 test_regress/t/t_split_var_auto.py create mode 100644 test_regress/t/t_split_var_auto.v diff --git a/docs/guide/exe_verilator.rst b/docs/guide/exe_verilator.rst index 3e5545f2d..fd310b48a 100644 --- a/docs/guide/exe_verilator.rst +++ b/docs/guide/exe_verilator.rst @@ -644,6 +644,11 @@ Summary: are typically used only when recommended by a maintainer to help debug or work around an issue. +.. option:: -fno-var-split + + Do not attempt to split variables automatically. Variables explicitly + annotated with :option:`/*verilator&32;split_var*/` are still split. + .. option:: -future0