From eeff109379926a775a13151594519ae26542843a Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Tue, 10 Feb 2026 13:22:47 +0100 Subject: [PATCH 01/12] Add support for power expressions with constant exponent in constraints Signed-off-by: Kamil Danecki --- docs/CONTRIBUTORS | 1 + src/V3Randomize.cpp | 78 +++++++++++++++++++ .../t_constraint_non_const_exp_pow_unsup.out | 5 ++ .../t/t_constraint_non_const_exp_pow_unsup.py | 16 ++++ .../t/t_constraint_non_const_exp_pow_unsup.v | 23 ++++++ test_regress/t/t_constraint_operators.v | 14 ++++ test_regress/t/t_constraint_unsup.v | 20 ++--- 7 files changed, 148 insertions(+), 9 deletions(-) create mode 100644 test_regress/t/t_constraint_non_const_exp_pow_unsup.out create mode 100755 test_regress/t/t_constraint_non_const_exp_pow_unsup.py create mode 100644 test_regress/t/t_constraint_non_const_exp_pow_unsup.v diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index c652b4f39..b3e411363 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -136,6 +136,7 @@ Julie Schwartz Julien Margetts Justin Thiel Kaleb Barrett +Kamil Danecki Kamil Rakoczy Kanad Kanhere Kefa Chen diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index 83309b453..c021adaa4 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -1340,6 +1340,84 @@ class ConstraintExprVisitor final : public VNVisitor { VL_DO_DANGLING(nodep->deleteTree(), nodep); iterate(resultp); } + void visit(AstPow* nodep) override { + if (AstConst* const exponentp = VN_CAST(nodep->rhsp(), Const)) { + FileLine* const fl = nodep->fileline(); + AstNodeExpr* const basep = nodep->lhsp(); + V3Number numOne{nodep, basep->width(), 1}; + AstNodeExpr* productp = new AstConst{fl, numOne}; + for (uint32_t i = 0; i < exponentp->toUInt(); i++) { + productp = new AstMul{fl, productp, basep->cloneTreePure(false)}; + productp->user1(true); + } + nodep->replaceWith(productp); + VL_DO_DANGLING(nodep->deleteTree(), nodep); + iterate(productp); + } else { + nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + } + } + void visit(AstPowSS* nodep) override { + if (AstConst* const exponentp = VN_CAST(nodep->rhsp(), Const)) { + FileLine* const fl = nodep->fileline(); + AstNodeExpr* const basep = nodep->lhsp(); + V3Number numOne{nodep, basep->width(), 1}; + AstNodeExpr* productp = new AstConst{fl, numOne}; + int32_t const exponent = exponentp->toSInt(); + for (int32_t i = 0; i < std::abs(exponent); i++) { + if (VL_LIKELY(exponent > 0)) { + productp = new AstMulS{fl, productp, basep->cloneTreePure(false)}; + } else { + productp = new AstDivS{fl, productp, basep->cloneTreePure(false)}; + } + productp->user1(true); + } + nodep->replaceWith(productp); + VL_DO_DANGLING(nodep->deleteTree(), nodep); + iterate(productp); + } else { + nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + } + } + void visit(AstPowSU* nodep) override { + if (AstConst* const exponentp = VN_CAST(nodep->rhsp(), Const)) { + FileLine* const fl = nodep->fileline(); + AstNodeExpr* const basep = nodep->lhsp(); + V3Number numOne{nodep, basep->width(), 1}; + AstNodeExpr* productp = new AstConst{fl, numOne}; + for (uint32_t i = 0; i < exponentp->toUInt(); i++) { + productp = new AstMulS{fl, productp, basep->cloneTreePure(false)}; + productp->user1(true); + } + nodep->replaceWith(productp); + VL_DO_DANGLING(nodep->deleteTree(), nodep); + iterate(productp); + } else { + nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + } + } + void visit(AstPowUS* nodep) override { + if (AstConst* const exponentp = VN_CAST(nodep->rhsp(), Const)) { + FileLine* const fl = nodep->fileline(); + AstNodeExpr* const basep = nodep->lhsp(); + V3Number numOne{nodep, basep->width(), 1}; + AstNodeExpr* productp = new AstConst{fl, numOne}; + int32_t const exponent = exponentp->toSInt(); + for (int32_t i = 0; i < std::abs(exponent); i++) { + if (VL_LIKELY(exponent > 0)) { + productp = new AstMul{fl, productp, basep->cloneTreePure(false)}; + } else { + productp = new AstDivS{fl, productp, basep->cloneTreePure(false)}; + } + productp->user1(true); + } + nodep->replaceWith(productp); + VL_DO_DANGLING(nodep->deleteTree(), nodep); + iterate(productp); + } else { + nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + } + } void visit(AstNodeBiop* nodep) override { if (editFormat(nodep)) return; editSMT(nodep, nodep->lhsp(), nodep->rhsp()); diff --git a/test_regress/t/t_constraint_non_const_exp_pow_unsup.out b/test_regress/t/t_constraint_non_const_exp_pow_unsup.out new file mode 100644 index 000000000..f30db827a --- /dev/null +++ b/test_regress/t/t_constraint_non_const_exp_pow_unsup.out @@ -0,0 +1,5 @@ +%Error-UNSUPPORTED: t/t_constraint_non_const_exp_pow_unsup.v:11:27: Unsupported: power expression with non constant exponent in constraint + 11 | constraint c_power { x ** y < 10000; } + | ^~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error: Exiting due to diff --git a/test_regress/t/t_constraint_non_const_exp_pow_unsup.py b/test_regress/t/t_constraint_non_const_exp_pow_unsup.py new file mode 100755 index 000000000..3160d0589 --- /dev/null +++ b/test_regress/t/t_constraint_non_const_exp_pow_unsup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# 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-FileCopyrightText: 2024 Wilson Snyder +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('vlt') + +test.lint(fails=True, expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_constraint_non_const_exp_pow_unsup.v b/test_regress/t/t_constraint_non_const_exp_pow_unsup.v new file mode 100644 index 000000000..e5b8e4a8a --- /dev/null +++ b/test_regress/t/t_constraint_non_const_exp_pow_unsup.v @@ -0,0 +1,23 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain. +// SPDX-FileCopyrightText: 2026 Antmicro +// SPDX-License-Identifier: CC0-1.0 + +class Packet; + rand int x; + rand int y; + + constraint c_power { x ** y < 10000; } +endclass + +module t; + + Packet p; + + initial begin + p = new; + void'(p.randomize()); + $finish; + end +endmodule diff --git a/test_regress/t/t_constraint_operators.v b/test_regress/t/t_constraint_operators.v index a4e0ba612..0998e00af 100644 --- a/test_regress/t/t_constraint_operators.v +++ b/test_regress/t/t_constraint_operators.v @@ -8,9 +8,13 @@ class Packet; rand int x; rand int y; rand int z; + rand int w; + rand int v; rand bit [31:0] b; rand bit [31:0] c; rand bit [31:0] d; + rand bit [31:0] e; + rand bit [31:0] f; rand bit tiny; rand bit zero; rand bit one; @@ -32,6 +36,12 @@ class Packet; z < 0; z > -4; } + constraint c_power { e ** 32'h5 < 10000; } + constraint c_power_ss { w ** 5 < 10000; } + constraint c_power_us { f ** 5 < 10000; } + constraint c_power_su { v ** 32'h5 < 10000; } + constraint c_power_neg_exp { v ** 4'shf == 0; } + constraint c_power_u_neg_exp { f ** 4'shf == 0; } constraint impl { tiny == 1 -> x != 10; } constraint concat { {c, b} != 'h1111; } constraint unary { !(-~c == 'h22); } @@ -91,6 +101,10 @@ module t; if (p.x * 9 == p.b * 3) $stop; if (p.y != 2) $stop; if (p.z != -2) $stop; + if (p.w ** 5 >= 10000) $stop; + if (p.e ** 32'h5 >= 10000) $stop; + if (p.v ** 32'h5 >= 10000) $stop; + if (p.f ** 5 >= 10000) $stop; if (p.tiny && p.x == 10) $stop; if ({p.c, p.b} == 'h1111) $stop; if (-~p.c == 'h22) $stop; diff --git a/test_regress/t/t_constraint_unsup.v b/test_regress/t/t_constraint_unsup.v index 8e6d855af..5a55f7456 100644 --- a/test_regress/t/t_constraint_unsup.v +++ b/test_regress/t/t_constraint_unsup.v @@ -1,19 +1,21 @@ // DESCRIPTION: Verilator: Verilog Test module // -// This file ONLY is placed under the Creative Commons Public Domain, for -// any use, without warranty, 2026 by PlanV GmbH. +// This file ONLY is placed under the Creative Commons Public Domain. +// SPDX-FileCopyrightText: 2026 Antmicro // SPDX-License-Identifier: CC0-1.0 class Packet; - rand int m_one; - constraint cons { m_one ** 2 > 0; } + rand real m_one; + constraint cons { m_one + 1.0 > 0.0; } endclass module t; - Packet p; - initial begin - p = new; - void'(p.randomize()); - end + Packet p; + + initial begin + p = new; + void'(p.randomize()); + $finish; + end endmodule From dd155627f2e1e8e5634c0a7b3d37794dde370feb Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 12 Feb 2026 12:19:13 +0100 Subject: [PATCH 02/12] Fix t_constraint_unsup out message Signed-off-by: Kamil Danecki --- test_regress/t/t_constraint_unsup.out | 4 ++-- test_regress/t/t_constraint_unsup.v | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test_regress/t/t_constraint_unsup.out b/test_regress/t/t_constraint_unsup.out index 5f867038d..69688e456 100644 --- a/test_regress/t/t_constraint_unsup.out +++ b/test_regress/t/t_constraint_unsup.out @@ -1,5 +1,5 @@ %Error-UNSUPPORTED: t/t_constraint_unsup.v:9:27: Unsupported expression inside constraint - 9 | constraint cons { m_one ** 2 > 0; } - | ^~ + 9 | constraint cons { x + 1.0 > 0.0; } + | ^ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: Exiting due to diff --git a/test_regress/t/t_constraint_unsup.v b/test_regress/t/t_constraint_unsup.v index 5a55f7456..3e6974337 100644 --- a/test_regress/t/t_constraint_unsup.v +++ b/test_regress/t/t_constraint_unsup.v @@ -5,8 +5,8 @@ // SPDX-License-Identifier: CC0-1.0 class Packet; - rand real m_one; - constraint cons { m_one + 1.0 > 0.0; } + rand real x; + constraint cons { x + 1.0 > 0.0; } endclass module t; From b24b89207db2112a4d33e489743eb01646285f81 Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 12 Feb 2026 13:03:53 +0100 Subject: [PATCH 03/12] Fix message Signed-off-by: Kamil Danecki --- test_regress/t/t_constraint_unsup.out | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_regress/t/t_constraint_unsup.out b/test_regress/t/t_constraint_unsup.out index 69688e456..8d830f393 100644 --- a/test_regress/t/t_constraint_unsup.out +++ b/test_regress/t/t_constraint_unsup.out @@ -1,4 +1,5 @@ -%Error-UNSUPPORTED: t/t_constraint_unsup.v:9:27: Unsupported expression inside constraint +%Error-UNSUPPORTED: t/t_constraint_unsup.v:9:30: Unsupported expression inside constraint + : ... note: In instance 't' 9 | constraint cons { x + 1.0 > 0.0; } | ^ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest From 94307f89701972742d28d43ca54b9f8e082e8651 Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 12 Feb 2026 16:14:18 +0100 Subject: [PATCH 04/12] Use unsigned div when base is unsigned Signed-off-by: Kamil Danecki --- src/V3Randomize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index c021adaa4..50b2ee407 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -1407,7 +1407,7 @@ class ConstraintExprVisitor final : public VNVisitor { if (VL_LIKELY(exponent > 0)) { productp = new AstMul{fl, productp, basep->cloneTreePure(false)}; } else { - productp = new AstDivS{fl, productp, basep->cloneTreePure(false)}; + productp = new AstDiv{fl, productp, basep->cloneTreePure(false)}; } productp->user1(true); } From 5610989e1a415695a0ffbe280d464fa512bcce5e Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 12 Feb 2026 18:17:07 +0100 Subject: [PATCH 05/12] Apply suggestion Signed-off-by: Kamil Danecki --- test_regress/t/t_constraint_unsup.v | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/test_regress/t/t_constraint_unsup.v b/test_regress/t/t_constraint_unsup.v index 3e6974337..ea9221516 100644 --- a/test_regress/t/t_constraint_unsup.v +++ b/test_regress/t/t_constraint_unsup.v @@ -1,21 +1,19 @@ // DESCRIPTION: Verilator: Verilog Test module // -// This file ONLY is placed under the Creative Commons Public Domain. -// SPDX-FileCopyrightText: 2026 Antmicro +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2026 by PlanV GmbH. // SPDX-License-Identifier: CC0-1.0 class Packet; - rand real x; - constraint cons { x + 1.0 > 0.0; } + rand real x; + constraint cons { x + 1.0 > 0.0; } endclass module t; + Packet p; - Packet p; - - initial begin - p = new; - void'(p.randomize()); - $finish; - end + initial begin + p = new; + void'(p.randomize()); + end endmodule From db39bc0d3d0e53c235605b682f2dab93ac95ddfe Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 12 Feb 2026 18:18:52 +0100 Subject: [PATCH 06/12] Comment for negative exponents Signed-off-by: Kamil Danecki --- test_regress/t/t_constraint_operators.v | 1 + 1 file changed, 1 insertion(+) diff --git a/test_regress/t/t_constraint_operators.v b/test_regress/t/t_constraint_operators.v index 0998e00af..6555da95b 100644 --- a/test_regress/t/t_constraint_operators.v +++ b/test_regress/t/t_constraint_operators.v @@ -40,6 +40,7 @@ class Packet; constraint c_power_ss { w ** 5 < 10000; } constraint c_power_us { f ** 5 < 10000; } constraint c_power_su { v ** 32'h5 < 10000; } + // check for negative values in constant constraint c_power_neg_exp { v ** 4'shf == 0; } constraint c_power_u_neg_exp { f ** 4'shf == 0; } constraint impl { tiny == 1 -> x != 10; } From d274a6395dce115374eab98130c094ea94d12b77 Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 12 Feb 2026 18:20:10 +0100 Subject: [PATCH 07/12] Only do the required divisions Signed-off-by: Kamil Danecki --- src/V3Randomize.cpp | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index 50b2ee407..69c019f84 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -1362,19 +1362,25 @@ class ConstraintExprVisitor final : public VNVisitor { FileLine* const fl = nodep->fileline(); AstNodeExpr* const basep = nodep->lhsp(); V3Number numOne{nodep, basep->width(), 1}; - AstNodeExpr* productp = new AstConst{fl, numOne}; int32_t const exponent = exponentp->toSInt(); - for (int32_t i = 0; i < std::abs(exponent); i++) { - if (VL_LIKELY(exponent > 0)) { - productp = new AstMulS{fl, productp, basep->cloneTreePure(false)}; - } else { - productp = new AstDivS{fl, productp, basep->cloneTreePure(false)}; + AstNodeExpr* powerp = new AstConst{fl, numOne}; + AstConst* foo = new AstConst{fl, numOne}; + if (exponent > 0) { + for (int32_t i = 0; i < exponent; i++) { + powerp = new AstMulS{fl, powerp, basep->cloneTreePure(false)}; + powerp->user1(true); + } + } else if (exponent < 0) { + powerp = new AstDivS{fl, powerp, basep->cloneTreePure(false)}; + powerp->user1(true); + if (exponent % 2 == 0) { + powerp = new AstDivS{fl, powerp, basep->cloneTreePure(false)}; + powerp->user1(true); } - productp->user1(true); } - nodep->replaceWith(productp); + nodep->replaceWith(powerp); VL_DO_DANGLING(nodep->deleteTree(), nodep); - iterate(productp); + iterate(powerp); } else { nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); } @@ -1401,19 +1407,20 @@ class ConstraintExprVisitor final : public VNVisitor { FileLine* const fl = nodep->fileline(); AstNodeExpr* const basep = nodep->lhsp(); V3Number numOne{nodep, basep->width(), 1}; - AstNodeExpr* productp = new AstConst{fl, numOne}; + AstNodeExpr* powerp = new AstConst{fl, numOne}; int32_t const exponent = exponentp->toSInt(); - for (int32_t i = 0; i < std::abs(exponent); i++) { - if (VL_LIKELY(exponent > 0)) { - productp = new AstMul{fl, productp, basep->cloneTreePure(false)}; - } else { - productp = new AstDiv{fl, productp, basep->cloneTreePure(false)}; + if (exponent > 0) { + for (int32_t i = 0; i < std::abs(exponent); i++) { + powerp = new AstMul{fl, powerp, basep->cloneTreePure(false)}; + powerp->user1(true); } - productp->user1(true); + } else if (exponent < 0) { + powerp = new AstDiv{fl, powerp, basep->cloneTreePure(false)}; + powerp->user1(true); } - nodep->replaceWith(productp); + nodep->replaceWith(powerp); VL_DO_DANGLING(nodep->deleteTree(), nodep); - iterate(productp); + iterate(powerp); } else { nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); } From 858ba6939fa42fc31c365bc5f08f6eddfaa4c5af Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Fri, 13 Feb 2026 10:46:11 +0100 Subject: [PATCH 08/12] cleanup Signed-off-by: Kamil Danecki --- src/V3Randomize.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index 69c019f84..cbcc5fb20 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -1364,7 +1364,6 @@ class ConstraintExprVisitor final : public VNVisitor { V3Number numOne{nodep, basep->width(), 1}; int32_t const exponent = exponentp->toSInt(); AstNodeExpr* powerp = new AstConst{fl, numOne}; - AstConst* foo = new AstConst{fl, numOne}; if (exponent > 0) { for (int32_t i = 0; i < exponent; i++) { powerp = new AstMulS{fl, powerp, basep->cloneTreePure(false)}; From 2ce417e476e18b8aab3fa371d3e9fb577e56df4a Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Fri, 13 Feb 2026 11:27:53 +0100 Subject: [PATCH 09/12] Fix message Signed-off-by: Kamil Danecki --- test_regress/t/t_constraint_unsup.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_regress/t/t_constraint_unsup.out b/test_regress/t/t_constraint_unsup.out index 8d830f393..1d67b149c 100644 --- a/test_regress/t/t_constraint_unsup.out +++ b/test_regress/t/t_constraint_unsup.out @@ -1,6 +1,6 @@ -%Error-UNSUPPORTED: t/t_constraint_unsup.v:9:30: Unsupported expression inside constraint +%Error-UNSUPPORTED: t/t_constraint_unsup.v:9:29: Unsupported expression inside constraint : ... note: In instance 't' - 9 | constraint cons { x + 1.0 > 0.0; } - | ^ + 9 | constraint cons { x + 1.0 > 0.0; } + | ^ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: Exiting due to From 39df12cf4d26e8a4644e31c1f9e7d6568315a963 Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Fri, 13 Feb 2026 14:38:09 +0100 Subject: [PATCH 10/12] Add test with 0 exponent Signed-off-by: Kamil Danecki --- test_regress/t/t_constraint_operators.v | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_regress/t/t_constraint_operators.v b/test_regress/t/t_constraint_operators.v index 6555da95b..dc04404c2 100644 --- a/test_regress/t/t_constraint_operators.v +++ b/test_regress/t/t_constraint_operators.v @@ -43,6 +43,8 @@ class Packet; // check for negative values in constant constraint c_power_neg_exp { v ** 4'shf == 0; } constraint c_power_u_neg_exp { f ** 4'shf == 0; } + constraint c_power_zero_exp { v ** 0 == 1; } + constraint c_power_u_zero_exp { f ** 0 == 1; } constraint impl { tiny == 1 -> x != 10; } constraint concat { {c, b} != 'h1111; } constraint unary { !(-~c == 'h22); } From e457cf5234ecdc2a9b7ec5b605ddb01074a35793 Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Fri, 13 Feb 2026 14:38:27 +0100 Subject: [PATCH 11/12] Add comments explaining negative exponent handling Signed-off-by: Kamil Danecki --- src/V3Randomize.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index cbcc5fb20..ddd6711fc 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -1370,6 +1370,8 @@ class ConstraintExprVisitor final : public VNVisitor { powerp->user1(true); } } else if (exponent < 0) { + // Limit chain of divisions to max 2, because operations are on integers. + // Two divisions are needed to preserve the sign. powerp = new AstDivS{fl, powerp, basep->cloneTreePure(false)}; powerp->user1(true); if (exponent % 2 == 0) { @@ -1414,6 +1416,8 @@ class ConstraintExprVisitor final : public VNVisitor { powerp->user1(true); } } else if (exponent < 0) { + // Only one division in needed because operations are on integers and base is unsigned. + // More divisions would still result in same results. powerp = new AstDiv{fl, powerp, basep->cloneTreePure(false)}; powerp->user1(true); } From d3ffaae6b023d592d08c77c4b7c15f40acd05af0 Mon Sep 17 00:00:00 2001 From: github action Date: Fri, 13 Feb 2026 14:23:43 +0000 Subject: [PATCH 12/12] Apply 'make format' --- src/V3Randomize.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index ddd6711fc..a63c01296 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -1354,7 +1354,9 @@ class ConstraintExprVisitor final : public VNVisitor { VL_DO_DANGLING(nodep->deleteTree(), nodep); iterate(productp); } else { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + nodep->v3warn( + E_UNSUPPORTED, + "Unsupported: power expression with non constant exponent in constraint"); } } void visit(AstPowSS* nodep) override { @@ -1383,7 +1385,9 @@ class ConstraintExprVisitor final : public VNVisitor { VL_DO_DANGLING(nodep->deleteTree(), nodep); iterate(powerp); } else { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + nodep->v3warn( + E_UNSUPPORTED, + "Unsupported: power expression with non constant exponent in constraint"); } } void visit(AstPowSU* nodep) override { @@ -1400,7 +1404,9 @@ class ConstraintExprVisitor final : public VNVisitor { VL_DO_DANGLING(nodep->deleteTree(), nodep); iterate(productp); } else { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + nodep->v3warn( + E_UNSUPPORTED, + "Unsupported: power expression with non constant exponent in constraint"); } } void visit(AstPowUS* nodep) override { @@ -1416,8 +1422,8 @@ class ConstraintExprVisitor final : public VNVisitor { powerp->user1(true); } } else if (exponent < 0) { - // Only one division in needed because operations are on integers and base is unsigned. - // More divisions would still result in same results. + // Only one division in needed because operations are on integers and base is + // unsigned. More divisions would still result in same results. powerp = new AstDiv{fl, powerp, basep->cloneTreePure(false)}; powerp->user1(true); } @@ -1425,7 +1431,9 @@ class ConstraintExprVisitor final : public VNVisitor { VL_DO_DANGLING(nodep->deleteTree(), nodep); iterate(powerp); } else { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: power expression with non constant exponent in constraint"); + nodep->v3warn( + E_UNSUPPORTED, + "Unsupported: power expression with non constant exponent in constraint"); } } void visit(AstNodeBiop* nodep) override {