Fixes #7449
This commit is contained in:
parent
c60d8f002f
commit
280cff06f3
|
|
@ -2760,7 +2760,9 @@ class CaptureVisitor final : public VNVisitor {
|
|||
m_ignore.emplace(thisRefp);
|
||||
AstMemberSel* const memberSelp
|
||||
= new AstMemberSel{nodep->fileline(), thisRefp, nodep->varp()};
|
||||
if (!m_targetp) memberSelp->user1(true);
|
||||
// Propagate random-dependence marking; forcing it on read-only operands
|
||||
// would route them through the solver write path.
|
||||
if (!m_targetp && nodep->user1()) memberSelp->user1(true);
|
||||
memberSelp->user2p(m_targetp);
|
||||
nodep->replaceWith(memberSelp);
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
#!/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: 2026 Wilson Snyder
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('simulator')
|
||||
|
||||
if not test.have_solver:
|
||||
test.skip("No constraint solver installed")
|
||||
|
||||
test.compile()
|
||||
|
||||
test.execute()
|
||||
|
||||
test.passes()
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain.
|
||||
// SPDX-FileCopyrightText: 2026 PlanV GmbH
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
// verilog_format: off
|
||||
`define stop $stop
|
||||
`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
|
||||
// verilog_format: on
|
||||
|
||||
class Cls;
|
||||
int x;
|
||||
int int_q[$];
|
||||
int dyn[];
|
||||
|
||||
function new();
|
||||
x = 0;
|
||||
int_q = '{12, 13, 17, 19};
|
||||
dyn = '{21, 22, 23};
|
||||
endfunction
|
||||
|
||||
task rand_with_queue();
|
||||
int ok;
|
||||
ok = std::randomize(x) with {x inside {int_q};};
|
||||
`checkd(ok, 1);
|
||||
`checkd(int_q.size(), 4);
|
||||
`checkd(int_q[0], 12);
|
||||
`checkd(int_q[1], 13);
|
||||
`checkd(int_q[2], 17);
|
||||
`checkd(int_q[3], 19);
|
||||
if (!(x inside {int_q})) `stop;
|
||||
endtask
|
||||
|
||||
task rand_with_dyn();
|
||||
int ok;
|
||||
ok = std::randomize(x) with {x inside {dyn};};
|
||||
`checkd(ok, 1);
|
||||
`checkd(dyn.size(), 3);
|
||||
`checkd(dyn[0], 21);
|
||||
`checkd(dyn[1], 22);
|
||||
`checkd(dyn[2], 23);
|
||||
if (!(x inside {dyn})) `stop;
|
||||
endtask
|
||||
endclass
|
||||
|
||||
module t;
|
||||
Cls obj;
|
||||
|
||||
initial begin
|
||||
obj = new();
|
||||
repeat (20) obj.rand_with_queue();
|
||||
repeat (20) obj.rand_with_dyn();
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
||||
Loading…
Reference in New Issue