Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
This commit is contained in:
parent
aecf38e3ad
commit
f133a2811f
|
|
@ -865,8 +865,10 @@ class CaptureVisitor final : public VNVisitor {
|
||||||
const bool varIsFuncLocal = varRefp->varp()->isFuncLocal();
|
const bool varIsFuncLocal = varRefp->varp()->isFuncLocal();
|
||||||
const bool varHasAutomaticLifetime = varRefp->varp()->lifetime().isAutomatic();
|
const bool varHasAutomaticLifetime = varRefp->varp()->lifetime().isAutomatic();
|
||||||
const bool varIsFieldOfCaller = AstClass::isClassExtendedFrom(callerClassp, varClassp);
|
const bool varIsFieldOfCaller = AstClass::isClassExtendedFrom(callerClassp, varClassp);
|
||||||
|
const bool varIsParam = varRefp->varp()->isParam();
|
||||||
if (refIsXref) return CaptureMode::CAP_VALUE | CaptureMode::CAP_F_XREF;
|
if (refIsXref) return CaptureMode::CAP_VALUE | CaptureMode::CAP_F_XREF;
|
||||||
if (varIsFuncLocal && varHasAutomaticLifetime) return CaptureMode::CAP_VALUE;
|
if (varIsFuncLocal && varHasAutomaticLifetime) return CaptureMode::CAP_VALUE;
|
||||||
|
if (varIsParam) return CaptureMode::CAP_VALUE;
|
||||||
// Static var in function (will not be inlined, because it's in class)
|
// Static var in function (will not be inlined, because it's in class)
|
||||||
if (callerIsClass && varIsFuncLocal) return CaptureMode::CAP_VALUE;
|
if (callerIsClass && varIsFuncLocal) return CaptureMode::CAP_VALUE;
|
||||||
if (callerIsClass && varIsFieldOfCaller) return CaptureMode::CAP_THIS;
|
if (callerIsClass && varIsFieldOfCaller) return CaptureMode::CAP_THIS;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ endclass
|
||||||
class c2;
|
class c2;
|
||||||
rand int c2_f;
|
rand int c2_f;
|
||||||
endclass
|
endclass
|
||||||
|
localparam int PARAM = 42;
|
||||||
class Cls;
|
class Cls;
|
||||||
rand int x;
|
rand int x;
|
||||||
rand enum {
|
rand enum {
|
||||||
|
|
@ -80,6 +80,10 @@ class SubC extends SubB;
|
||||||
if (doit != 1) $stop;
|
if (doit != 1) $stop;
|
||||||
if (f.en != SubA::AMBIG) $stop;
|
if (f.en != SubA::AMBIG) $stop;
|
||||||
|
|
||||||
|
doit &= f.randomize() with { x == PARAM; };
|
||||||
|
if (doit != 1) $stop;
|
||||||
|
if (f.x != PARAM) $stop;
|
||||||
|
|
||||||
f.en = SubA::ONE_A;
|
f.en = SubA::ONE_A;
|
||||||
doit &= f.randomize() with { en == ONE_A; };
|
doit &= f.randomize() with { en == ONE_A; };
|
||||||
doit &= f.randomize() with { local::en == local::AMBIG; };
|
doit &= f.randomize() with { local::en == local::AMBIG; };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue