mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 08:33:38 +02:00
@@ -2185,6 +2185,12 @@ public:
|
||||
&& !isSc() && !isPrimaryIO() && !isConst() && !isDouble() && !isString());
|
||||
}
|
||||
bool isClassMember() const { return varType() == VVarType::MEMBER; }
|
||||
bool isVirtIface() const {
|
||||
if (AstIfaceRefDType* const dtp = VN_CAST(dtypep(), IfaceRefDType)) {
|
||||
return dtp->isVirtual();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isStatementTemp() const { return varType() == VVarType::STMTTEMP; }
|
||||
bool isXTemp() const { return varType() == VVarType::XTEMP; }
|
||||
bool isParam() const { return varType().isParam(); }
|
||||
|
||||
+2
-2
@@ -156,8 +156,8 @@ public:
|
||||
UINFO(6, "New vertex " << vscp);
|
||||
vVtxp = new GateVarVertex{this, vscp};
|
||||
vscp->user1p(vVtxp);
|
||||
if (vscp->varp()->sensIfacep()) {
|
||||
// Can be used in a class method, which cannot be tracked statically
|
||||
if (vscp->varp()->sensIfacep() || vscp->varp()->isVirtIface()) {
|
||||
// Can be read/written to via the referenced actual interface
|
||||
vVtxp->clearReducibleAndDedupable("VirtIface");
|
||||
vVtxp->setConsumed("VirtIface");
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ class LocalizeVisitor final : public VNVisitor {
|
||||
&& !nodep->varp()->isStatic() // Not a static variable
|
||||
&& !nodep->varp()->isClassMember() // Statically exists in design hierarchy
|
||||
&& !nodep->varp()->sensIfacep() // Not sensitive to an interface
|
||||
&& !nodep->varp()->isVirtIface() // Not interface pointer
|
||||
&& !nodep->varp()->valuep() // Does not have an initializer
|
||||
) {
|
||||
UINFO(4, "Consider for localization: " << nodep);
|
||||
|
||||
@@ -104,12 +104,13 @@ private:
|
||||
});
|
||||
}
|
||||
// Error on write across a virtual interface boundary
|
||||
static void unsupportedWriteToVirtIface(AstNode* nodep, const char* locationp) {
|
||||
static void unsupportedWriteToVirtIfaceMember(AstNode* nodep, const char* locationp) {
|
||||
if (!nodep) return;
|
||||
foreachWrittenVirtIface(nodep, [locationp](AstVarRef* const selp, AstIface*) {
|
||||
selp->v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: Write to virtual interface in " << locationp);
|
||||
});
|
||||
foreachWrittenVirtIfaceMember(
|
||||
nodep, [locationp](AstVarRef* const selp, AstIface*, AstVar* varp) {
|
||||
selp->v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: Write to virtual interface in " << locationp);
|
||||
});
|
||||
}
|
||||
// Create trigger var for the given interface if it doesn't exist; return a write ref to it
|
||||
AstVarRef* createVirtIfaceTriggerRefp(FileLine* const flp, AstIface* ifacep) {
|
||||
@@ -164,7 +165,7 @@ private:
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
void visit(AstNodeIf* nodep) override {
|
||||
unsupportedWriteToVirtIface(nodep->condp(), "if condition");
|
||||
unsupportedWriteToVirtIfaceMember(nodep->condp(), "if condition");
|
||||
{
|
||||
VL_RESTORER(m_trigAssignp);
|
||||
VL_RESTORER(m_trigAssignIfacep);
|
||||
@@ -201,7 +202,7 @@ private:
|
||||
}
|
||||
}
|
||||
void visit(AstLoopTest* nodep) override {
|
||||
unsupportedWriteToVirtIface(nodep->condp(), "loop condition");
|
||||
unsupportedWriteToVirtIfaceMember(nodep->condp(), "loop condition");
|
||||
}
|
||||
void visit(AstJumpBlock* nodep) override {
|
||||
{
|
||||
|
||||
@@ -3371,8 +3371,6 @@ class WidthVisitor final : public VNVisitor {
|
||||
nodep->varp(varp);
|
||||
AstIface* const ifacep = adtypep->ifacep();
|
||||
varp->sensIfacep(ifacep);
|
||||
nodep->fromp()->foreach(
|
||||
[ifacep](AstVarRef* const refp) { refp->varp()->sensIfacep(ifacep); });
|
||||
nodep->didWidth(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user