mirror of
https://github.com/verilator/verilator.git
synced 2026-09-03 08:24:31 +02:00
astgen: Enforce the use of aliased operand accessors (#4688)
This patch enforces the use of the most specific accessors for operands which have an '@astgen alias' declaration, by making the superclass accessors of the same operands private. This ensures client code is cleaner as you can't use multiple different methods to reference the same operands (which we used to in some places). Also prep for some refactoring.
This commit is contained in:
+6
-6
@@ -362,11 +362,11 @@ private:
|
||||
} // end expanding ranged cell
|
||||
else if (AstArraySel* const arrselp = VN_CAST(nodep->exprp(), ArraySel)) {
|
||||
if (const AstUnpackArrayDType* const arrp
|
||||
= VN_CAST(arrselp->lhsp()->dtypep(), UnpackArrayDType)) {
|
||||
= VN_CAST(arrselp->fromp()->dtypep(), UnpackArrayDType)) {
|
||||
if (!VN_IS(arrp->subDTypep(), IfaceRefDType)) return;
|
||||
// Interface pin attaches to one element of arrayed interface
|
||||
V3Const::constifyParamsEdit(arrselp->rhsp());
|
||||
const AstConst* const constp = VN_CAST(arrselp->rhsp(), Const);
|
||||
V3Const::constifyParamsEdit(arrselp->bitp());
|
||||
const AstConst* const constp = VN_CAST(arrselp->bitp(), Const);
|
||||
if (!constp) {
|
||||
nodep->v3warn(
|
||||
E_UNSUPPORTED,
|
||||
@@ -374,9 +374,9 @@ private:
|
||||
return;
|
||||
}
|
||||
const string index = AstNode::encodeNumber(constp->toSInt());
|
||||
if (VN_IS(arrselp->lhsp(), SliceSel))
|
||||
arrselp->lhsp()->v3error("Unsupported: interface slices");
|
||||
const AstVarRef* const varrefp = VN_CAST(arrselp->lhsp(), VarRef);
|
||||
if (VN_IS(arrselp->fromp(), SliceSel))
|
||||
arrselp->fromp()->v3error("Unsupported: interface slices");
|
||||
const AstVarRef* const varrefp = VN_CAST(arrselp->fromp(), VarRef);
|
||||
UASSERT_OBJ(varrefp, arrselp, "No interface varref under array");
|
||||
AstVarXRef* const newp = new AstVarXRef{
|
||||
nodep->fileline(), varrefp->name() + "__BRA__" + index + "__KET__", "",
|
||||
|
||||
Reference in New Issue
Block a user