forked from github/verilator
Add default parameters to some Ast nodes for convenience
Also update usage to utilize. No functional change.
This commit is contained in:
parent
a9cd2998e5
commit
b22e368b25
@ -98,7 +98,7 @@ private:
|
|||||||
? static_cast<AstNode*>(
|
? static_cast<AstNode*>(
|
||||||
new AstCMath(fl, "vlSymsp->_vm_contextp__->assertOn()", 1))
|
new AstCMath(fl, "vlSymsp->_vm_contextp__->assertOn()", 1))
|
||||||
: static_cast<AstNode*>(new AstConst(fl, AstConst::BitFalse())))),
|
: static_cast<AstNode*>(new AstConst(fl, AstConst::BitFalse())))),
|
||||||
nodep, nullptr);
|
nodep);
|
||||||
newp->user1(true); // Don't assert/cover this if
|
newp->user1(true); // Don't assert/cover this if
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bodysp && passsp) bodysp = bodysp->addNext(passsp);
|
if (bodysp && passsp) bodysp = bodysp->addNext(passsp);
|
||||||
ifp = new AstIf(nodep->fileline(), propp, bodysp, nullptr);
|
ifp = new AstIf(nodep->fileline(), propp, bodysp);
|
||||||
bodysp = ifp;
|
bodysp = ifp;
|
||||||
} else if (VN_IS(nodep, Assert) || VN_IS(nodep, AssertIntrinsic)) {
|
} else if (VN_IS(nodep, Assert) || VN_IS(nodep, AssertIntrinsic)) {
|
||||||
if (nodep->immediate()) {
|
if (nodep->immediate()) {
|
||||||
@ -313,8 +313,7 @@ private:
|
|||||||
AstIf* const ifp = new AstIf(
|
AstIf* const ifp = new AstIf(
|
||||||
nodep->fileline(), new AstLogNot(nodep->fileline(), ohot),
|
nodep->fileline(), new AstLogNot(nodep->fileline(), ohot),
|
||||||
newFireAssert(nodep,
|
newFireAssert(nodep,
|
||||||
"synthesis parallel_case, but multiple matches found"),
|
"synthesis parallel_case, but multiple matches found"));
|
||||||
nullptr);
|
|
||||||
ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
||||||
nodep->addNotParallelp(ifp);
|
nodep->addNotParallelp(ifp);
|
||||||
}
|
}
|
||||||
@ -384,7 +383,7 @@ private:
|
|||||||
new AstLogAnd{fl, new AstLogNot{fl, newMonitorOffVarRefp(nodep, VAccess::READ)},
|
new AstLogAnd{fl, new AstLogNot{fl, newMonitorOffVarRefp(nodep, VAccess::READ)},
|
||||||
new AstEq{fl, new AstConst{fl, monNum},
|
new AstEq{fl, new AstConst{fl, monNum},
|
||||||
newMonitorNumVarRefp(nodep, VAccess::READ)}},
|
newMonitorNumVarRefp(nodep, VAccess::READ)}},
|
||||||
stmtsp, nullptr};
|
stmtsp};
|
||||||
ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
||||||
AstNode* const newp = new AstAlwaysPostponed{fl, ifp};
|
AstNode* const newp = new AstAlwaysPostponed{fl, ifp};
|
||||||
m_modp->addStmtp(newp);
|
m_modp->addStmtp(newp);
|
||||||
@ -402,8 +401,7 @@ private:
|
|||||||
nodep->replaceWith(newsetp);
|
nodep->replaceWith(newsetp);
|
||||||
// Add "always_comb if (__Vstrobe) begin $display(...); __Vstrobe = '0; end"
|
// Add "always_comb if (__Vstrobe) begin $display(...); __Vstrobe = '0; end"
|
||||||
AstNode* const stmtsp = nodep;
|
AstNode* const stmtsp = nodep;
|
||||||
AstIf* const ifp
|
AstIf* const ifp = new AstIf{fl, new AstVarRef{fl, varp, VAccess::READ}, stmtsp};
|
||||||
= new AstIf{fl, new AstVarRef{fl, varp, VAccess::READ}, stmtsp, nullptr};
|
|
||||||
ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
||||||
AstNode* const newp = new AstAlwaysPostponed{fl, ifp};
|
AstNode* const newp = new AstAlwaysPostponed{fl, ifp};
|
||||||
stmtsp->addNext(new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE},
|
stmtsp->addNext(new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE},
|
||||||
|
@ -1914,14 +1914,14 @@ private:
|
|||||||
bool m_pure = false; // Pure optimizable
|
bool m_pure = false; // Pure optimizable
|
||||||
public:
|
public:
|
||||||
AstCMethodHard(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name,
|
AstCMethodHard(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name,
|
||||||
AstNode* pinsp)
|
AstNode* pinsp = nullptr)
|
||||||
: ASTGEN_SUPER_CMethodHard(fl, false)
|
: ASTGEN_SUPER_CMethodHard(fl, false)
|
||||||
, m_name{name} {
|
, m_name{name} {
|
||||||
setOp1p(fromp);
|
setOp1p(fromp);
|
||||||
dtypep(nullptr); // V3Width will resolve
|
dtypep(nullptr); // V3Width will resolve
|
||||||
addNOp2p(pinsp);
|
addNOp2p(pinsp);
|
||||||
}
|
}
|
||||||
AstCMethodHard(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp)
|
AstCMethodHard(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp = nullptr)
|
||||||
: ASTGEN_SUPER_CMethodHard(fl, false)
|
: ASTGEN_SUPER_CMethodHard(fl, false)
|
||||||
, m_name{name} {
|
, m_name{name} {
|
||||||
setOp1p(fromp);
|
setOp1p(fromp);
|
||||||
@ -4610,7 +4610,7 @@ public:
|
|||||||
|
|
||||||
class AstWhile final : public AstNodeStmt {
|
class AstWhile final : public AstNodeStmt {
|
||||||
public:
|
public:
|
||||||
AstWhile(FileLine* fl, AstNode* condp, AstNode* bodysp, AstNode* incsp = nullptr)
|
AstWhile(FileLine* fl, AstNode* condp, AstNode* bodysp = nullptr, AstNode* incsp = nullptr)
|
||||||
: ASTGEN_SUPER_While(fl) {
|
: ASTGEN_SUPER_While(fl) {
|
||||||
setOp2p(condp);
|
setOp2p(condp);
|
||||||
addNOp3p(bodysp);
|
addNOp3p(bodysp);
|
||||||
@ -4714,7 +4714,7 @@ private:
|
|||||||
bool m_unique0Pragma; // unique0 case
|
bool m_unique0Pragma; // unique0 case
|
||||||
bool m_priorityPragma; // priority case
|
bool m_priorityPragma; // priority case
|
||||||
public:
|
public:
|
||||||
AstIf(FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp = nullptr)
|
AstIf(FileLine* fl, AstNode* condp, AstNode* ifsp = nullptr, AstNode* elsesp = nullptr)
|
||||||
: ASTGEN_SUPER_If(fl, condp, ifsp, elsesp) {
|
: ASTGEN_SUPER_If(fl, condp, ifsp, elsesp) {
|
||||||
m_uniquePragma = false;
|
m_uniquePragma = false;
|
||||||
m_unique0Pragma = false;
|
m_unique0Pragma = false;
|
||||||
|
@ -427,8 +427,7 @@ private:
|
|||||||
if (++depth > CASE_ENCODER_GROUP_DEPTH) depth = 1;
|
if (++depth > CASE_ENCODER_GROUP_DEPTH) depth = 1;
|
||||||
if (depth == 1) { // First group or starting new group
|
if (depth == 1) { // First group or starting new group
|
||||||
itemnextp = nullptr;
|
itemnextp = nullptr;
|
||||||
AstIf* const newp
|
AstIf* const newp = new AstIf(itemp->fileline(), ifexprp->cloneTree(true));
|
||||||
= new AstIf(itemp->fileline(), ifexprp->cloneTree(true), nullptr, nullptr);
|
|
||||||
if (groupnextp) {
|
if (groupnextp) {
|
||||||
groupnextp->addElsesp(newp);
|
groupnextp->addElsesp(newp);
|
||||||
} else {
|
} else {
|
||||||
@ -448,7 +447,7 @@ private:
|
|||||||
VL_DO_DANGLING(itemexprp->deleteTree(), itemexprp);
|
VL_DO_DANGLING(itemexprp->deleteTree(), itemexprp);
|
||||||
itemexprp = new AstConst(itemp->fileline(), AstConst::BitTrue());
|
itemexprp = new AstConst(itemp->fileline(), AstConst::BitTrue());
|
||||||
}
|
}
|
||||||
AstIf* const newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, nullptr);
|
AstIf* const newp = new AstIf(itemp->fileline(), itemexprp, istmtsp);
|
||||||
if (itemnextp) {
|
if (itemnextp) {
|
||||||
itemnextp->addElsesp(newp);
|
itemnextp->addElsesp(newp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -185,7 +185,7 @@ private:
|
|||||||
AstIf* makeActiveIf(AstSenTree* sensesp) {
|
AstIf* makeActiveIf(AstSenTree* sensesp) {
|
||||||
AstNode* const senEqnp = createSenseEquation(sensesp->sensesp());
|
AstNode* const senEqnp = createSenseEquation(sensesp->sensesp());
|
||||||
UASSERT_OBJ(senEqnp, sensesp, "No sense equation, shouldn't be in sequent activation.");
|
UASSERT_OBJ(senEqnp, sensesp, "No sense equation, shouldn't be in sequent activation.");
|
||||||
AstIf* const newifp = new AstIf(sensesp->fileline(), senEqnp, nullptr, nullptr);
|
AstIf* const newifp = new AstIf(sensesp->fileline(), senEqnp);
|
||||||
return newifp;
|
return newifp;
|
||||||
}
|
}
|
||||||
void clearLastSen() {
|
void clearLastSen() {
|
||||||
@ -310,8 +310,8 @@ private:
|
|||||||
AstNode* const origp = nodep->origp()->unlinkFrBack();
|
AstNode* const origp = nodep->origp()->unlinkFrBack();
|
||||||
AstNode* const changeWrp = nodep->changep()->unlinkFrBack();
|
AstNode* const changeWrp = nodep->changep()->unlinkFrBack();
|
||||||
AstNode* const changeRdp = ConvertWriteRefsToRead::main(changeWrp->cloneTree(false));
|
AstNode* const changeRdp = ConvertWriteRefsToRead::main(changeWrp->cloneTree(false));
|
||||||
AstIf* const newp = new AstIf(
|
AstIf* const newp
|
||||||
nodep->fileline(), new AstXor(nodep->fileline(), origp, changeRdp), incp, nullptr);
|
= new AstIf(nodep->fileline(), new AstXor(nodep->fileline(), origp, changeRdp), incp);
|
||||||
// We could add another IF to detect posedges, and only increment if so.
|
// We could add another IF to detect posedges, and only increment if so.
|
||||||
// It's another whole branch though versus a potential memory miss.
|
// It's another whole branch though versus a potential memory miss.
|
||||||
// We'll go with the miss.
|
// We'll go with the miss.
|
||||||
|
@ -351,8 +351,7 @@ private:
|
|||||||
"Delayed assignment misoptimized; prev var found w/o associated IF");
|
"Delayed assignment misoptimized; prev var found w/o associated IF");
|
||||||
} else {
|
} else {
|
||||||
postLogicp = new AstIf(nodep->fileline(),
|
postLogicp = new AstIf(nodep->fileline(),
|
||||||
new AstVarRef(nodep->fileline(), setvscp, VAccess::READ),
|
new AstVarRef(nodep->fileline(), setvscp, VAccess::READ));
|
||||||
nullptr, nullptr);
|
|
||||||
UINFO(9, " Created " << postLogicp << endl);
|
UINFO(9, " Created " << postLogicp << endl);
|
||||||
finalp->addStmtp(postLogicp);
|
finalp->addStmtp(postLogicp);
|
||||||
finalp->user3p(setvscp); // Remember IF's vset variable
|
finalp->user3p(setvscp); // Remember IF's vset variable
|
||||||
|
@ -161,7 +161,7 @@ private:
|
|||||||
new AstCMath(funcp->fileline(),
|
new AstCMath(funcp->fileline(),
|
||||||
string("&(") + funcp->scopep()->nameVlSym() + ")",
|
string("&(") + funcp->scopep()->nameVlSym() + ")",
|
||||||
64)),
|
64)),
|
||||||
returnp, nullptr);
|
returnp);
|
||||||
newfuncp->addStmtsp(ifp);
|
newfuncp->addStmtsp(ifp);
|
||||||
} else {
|
} else {
|
||||||
newfuncp->addStmtsp(returnp);
|
newfuncp->addStmtsp(returnp);
|
||||||
|
@ -266,7 +266,7 @@ private:
|
|||||||
// and we also need to keep track of it for comparisons later.
|
// and we also need to keep track of it for comparisons later.
|
||||||
m_mgCondp = m_mgCondp->cloneTree(false);
|
m_mgCondp = m_mgCondp->cloneTree(false);
|
||||||
// Create equivalent 'if' statement and insert it before the first node
|
// Create equivalent 'if' statement and insert it before the first node
|
||||||
AstIf* const resultp = new AstIf(m_mgCondp->fileline(), m_mgCondp, nullptr, nullptr);
|
AstIf* const resultp = new AstIf(m_mgCondp->fileline(), m_mgCondp);
|
||||||
m_mgFirstp->addHereThisAsNext(resultp);
|
m_mgFirstp->addHereThisAsNext(resultp);
|
||||||
// Unzip the list and insert under branches
|
// Unzip the list and insert under branches
|
||||||
AstNode* nextp = m_mgFirstp;
|
AstNode* nextp = m_mgFirstp;
|
||||||
|
@ -367,7 +367,7 @@ private:
|
|||||||
AstNode* const condp
|
AstNode* const condp
|
||||||
= new AstAnd(fl, select(fl, outputAssignedTableVscp, indexVscp),
|
= new AstAnd(fl, select(fl, outputAssignedTableVscp, indexVscp),
|
||||||
new AstConst(fl, outputChgMask));
|
new AstConst(fl, outputChgMask));
|
||||||
outsetp = new AstIf(fl, condp, outsetp, nullptr);
|
outsetp = new AstIf(fl, condp, outsetp);
|
||||||
}
|
}
|
||||||
|
|
||||||
stmtsp->addNext(outsetp);
|
stmtsp->addNext(outsetp);
|
||||||
|
@ -656,7 +656,7 @@ private:
|
|||||||
condp = condp ? new AstOr(flp, condp, selp) : selp;
|
condp = condp ? new AstOr(flp, condp, selp) : selp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ifp = new AstIf(flp, condp, nullptr, nullptr);
|
ifp = new AstIf(flp, condp);
|
||||||
if (!always) ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
if (!always) ifp->branchPred(VBranchPred::BP_UNLIKELY);
|
||||||
subFuncp->addStmtsp(ifp);
|
subFuncp->addStmtsp(ifp);
|
||||||
subStmts += ifp->nodeCount();
|
subStmts += ifp->nodeCount();
|
||||||
|
@ -127,8 +127,7 @@ private:
|
|||||||
(needDly ? static_cast<AstNode*>(
|
(needDly ? static_cast<AstNode*>(
|
||||||
new AstAssignDly(fl, prep, new AstVarRef(fl, varp, VAccess::READ)))
|
new AstAssignDly(fl, prep, new AstVarRef(fl, varp, VAccess::READ)))
|
||||||
: static_cast<AstNode*>(
|
: static_cast<AstNode*>(
|
||||||
new AstAssign(fl, prep, new AstVarRef(fl, varp, VAccess::READ)))),
|
new AstAssign(fl, prep, new AstVarRef(fl, varp, VAccess::READ)))));
|
||||||
nullptr);
|
|
||||||
newp->branchPred(VBranchPred::BP_LIKELY);
|
newp->branchPred(VBranchPred::BP_LIKELY);
|
||||||
newp->isBoundsCheck(true);
|
newp->isBoundsCheck(true);
|
||||||
if (debug() >= 9) newp->dumpTree(cout, " _new: ");
|
if (debug() >= 9) newp->dumpTree(cout, " _new: ");
|
||||||
|
@ -1366,7 +1366,7 @@ private:
|
|||||||
switch (nodep->attrType()) {
|
switch (nodep->attrType()) {
|
||||||
case VAttrType::DIM_SIZE: {
|
case VAttrType::DIM_SIZE: {
|
||||||
AstNode* const newp = new AstCMethodHard(
|
AstNode* const newp = new AstCMethodHard(
|
||||||
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", nullptr);
|
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size");
|
||||||
newp->dtypeSetSigned32();
|
newp->dtypeSetSigned32();
|
||||||
newp->didWidth(true);
|
newp->didWidth(true);
|
||||||
newp->protect(false);
|
newp->protect(false);
|
||||||
@ -1384,7 +1384,7 @@ private:
|
|||||||
case VAttrType::DIM_RIGHT:
|
case VAttrType::DIM_RIGHT:
|
||||||
case VAttrType::DIM_HIGH: {
|
case VAttrType::DIM_HIGH: {
|
||||||
AstNode* const sizep = new AstCMethodHard(
|
AstNode* const sizep = new AstCMethodHard(
|
||||||
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", nullptr);
|
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size");
|
||||||
sizep->dtypeSetSigned32();
|
sizep->dtypeSetSigned32();
|
||||||
sizep->didWidth(true);
|
sizep->didWidth(true);
|
||||||
sizep->protect(false);
|
sizep->protect(false);
|
||||||
@ -2676,8 +2676,8 @@ private:
|
|||||||
if (nodep->name() == "num" // function int num()
|
if (nodep->name() == "num" // function int num()
|
||||||
|| nodep->name() == "size") {
|
|| nodep->name() == "size") {
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size",
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
nullptr); // So don't need num()
|
"size"); // So don't need num()
|
||||||
newp->dtypeSetSigned32();
|
newp->dtypeSetSigned32();
|
||||||
} else if (nodep->name() == "first" // function int first(ref index)
|
} else if (nodep->name() == "first" // function int first(ref index)
|
||||||
|| nodep->name() == "last" //
|
|| nodep->name() == "last" //
|
||||||
@ -2703,7 +2703,7 @@ private:
|
|||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
||||||
if (!nodep->pinsp()) {
|
if (!nodep->pinsp()) {
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
"clear", nullptr);
|
"clear");
|
||||||
newp->makeStatement();
|
newp->makeStatement();
|
||||||
} else {
|
} else {
|
||||||
AstNode* const index_exprp = methodCallAssocIndexExpr(nodep, adtypep);
|
AstNode* const index_exprp = methodCallAssocIndexExpr(nodep, adtypep);
|
||||||
@ -2731,7 +2731,7 @@ private:
|
|||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
nodep->name(), nullptr);
|
nodep->name());
|
||||||
if (nodep->name() == "unique_index") {
|
if (nodep->name() == "unique_index") {
|
||||||
newp->dtypep(queueDTypeIndexedBy(adtypep->keyDTypep()));
|
newp->dtypep(queueDTypeIndexedBy(adtypep->keyDTypep()));
|
||||||
} else {
|
} else {
|
||||||
@ -2794,19 +2794,16 @@ private:
|
|||||||
if (nodep->name() == "at") { // Created internally for []
|
if (nodep->name() == "at") { // Created internally for []
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at",
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at");
|
||||||
nullptr);
|
|
||||||
newp->dtypeFrom(adtypep->subDTypep());
|
newp->dtypeFrom(adtypep->subDTypep());
|
||||||
} else if (nodep->name() == "size") {
|
} else if (nodep->name() == "size") {
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size",
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size");
|
||||||
nullptr);
|
|
||||||
newp->dtypeSetSigned32();
|
newp->dtypeSetSigned32();
|
||||||
} else if (nodep->name() == "delete") { // function void delete()
|
} else if (nodep->name() == "delete") { // function void delete()
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "clear",
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "clear");
|
||||||
nullptr);
|
|
||||||
newp->makeStatement();
|
newp->makeStatement();
|
||||||
} else if (nodep->name() == "and" || nodep->name() == "or" || nodep->name() == "xor"
|
} else if (nodep->name() == "and" || nodep->name() == "or" || nodep->name() == "xor"
|
||||||
|| nodep->name() == "sum" || nodep->name() == "product") {
|
|| nodep->name() == "sum" || nodep->name() == "product") {
|
||||||
@ -2837,7 +2834,7 @@ private:
|
|||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
nodep->name(), nullptr);
|
nodep->name());
|
||||||
if (nodep->name() == "unique_index") {
|
if (nodep->name() == "unique_index") {
|
||||||
newp->dtypep(newp->findQueueIndexDType());
|
newp->dtypep(newp->findQueueIndexDType());
|
||||||
} else {
|
} else {
|
||||||
@ -2883,27 +2880,25 @@ private:
|
|||||||
if (nodep->name() == "at") { // Created internally for []
|
if (nodep->name() == "at") { // Created internally for []
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at",
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at");
|
||||||
nullptr);
|
|
||||||
newp->dtypeFrom(adtypep->subDTypep());
|
newp->dtypeFrom(adtypep->subDTypep());
|
||||||
} else if (nodep->name() == "num" // function int num()
|
} else if (nodep->name() == "num" // function int num()
|
||||||
|| nodep->name() == "size") {
|
|| nodep->name() == "size") {
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size",
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size");
|
||||||
nullptr);
|
|
||||||
newp->dtypeSetSigned32();
|
newp->dtypeSetSigned32();
|
||||||
} else if (nodep->name() == "delete") { // function void delete([input integer index])
|
} else if (nodep->name() == "delete") { // function void delete([input integer index])
|
||||||
methodOkArguments(nodep, 0, 1);
|
methodOkArguments(nodep, 0, 1);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
||||||
if (!nodep->pinsp()) {
|
if (!nodep->pinsp()) {
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
"clear", nullptr);
|
"clear");
|
||||||
newp->makeStatement();
|
newp->makeStatement();
|
||||||
} else {
|
} else {
|
||||||
AstNode* const index_exprp = methodCallQueueIndexExpr(nodep);
|
AstNode* const index_exprp = methodCallQueueIndexExpr(nodep);
|
||||||
if (index_exprp->isZero()) { // delete(0) is a pop_front
|
if (index_exprp->isZero()) { // delete(0) is a pop_front
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
"pop_front", nullptr);
|
"pop_front");
|
||||||
newp->dtypeFrom(adtypep->subDTypep());
|
newp->dtypeFrom(adtypep->subDTypep());
|
||||||
newp->makeStatement();
|
newp->makeStatement();
|
||||||
} else {
|
} else {
|
||||||
@ -2933,7 +2928,7 @@ private:
|
|||||||
// Returns element, so method both consumes (reads) and modifies the queue
|
// Returns element, so method both consumes (reads) and modifies the queue
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READWRITE);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READWRITE);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
nodep->name(), nullptr);
|
nodep->name());
|
||||||
newp->dtypeFrom(adtypep->subDTypep());
|
newp->dtypeFrom(adtypep->subDTypep());
|
||||||
if (!nodep->firstAbovep()) newp->makeStatement();
|
if (!nodep->firstAbovep()) newp->makeStatement();
|
||||||
} else if (nodep->name() == "push_back" || nodep->name() == "push_front") {
|
} else if (nodep->name() == "push_back" || nodep->name() == "push_front") {
|
||||||
@ -2972,7 +2967,7 @@ private:
|
|||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
|
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
|
||||||
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
nodep->name(), nullptr);
|
nodep->name());
|
||||||
if (nodep->name() == "unique_index") {
|
if (nodep->name() == "unique_index") {
|
||||||
newp->dtypep(newp->findQueueIndexDType());
|
newp->dtypep(newp->findQueueIndexDType());
|
||||||
} else {
|
} else {
|
||||||
@ -3850,8 +3845,7 @@ private:
|
|||||||
} else if (VN_IS(fromDtp, DynArrayDType) || VN_IS(fromDtp, QueueDType)) {
|
} else if (VN_IS(fromDtp, DynArrayDType) || VN_IS(fromDtp, QueueDType)) {
|
||||||
if (varp) {
|
if (varp) {
|
||||||
auto* const leftp = new AstConst{fl, AstConst::Signed32{}, 0};
|
auto* const leftp = new AstConst{fl, AstConst::Signed32{}, 0};
|
||||||
auto* const sizep
|
auto* const sizep = new AstCMethodHard{fl, fromp->cloneTree(false), "size"};
|
||||||
= new AstCMethodHard{fl, fromp->cloneTree(false), "size", nullptr};
|
|
||||||
sizep->dtypeSetSigned32();
|
sizep->dtypeSetSigned32();
|
||||||
sizep->didWidth(true);
|
sizep->didWidth(true);
|
||||||
sizep->protect(false);
|
sizep->protect(false);
|
||||||
|
@ -3111,7 +3111,7 @@ statement_item<nodep>: // IEEE: statement_item
|
|||||||
//
|
//
|
||||||
// // IEEE: conditional_statement
|
// // IEEE: conditional_statement
|
||||||
| unique_priorityE yIF '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE
|
| unique_priorityE yIF '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE
|
||||||
{ AstIf* const newp = new AstIf{$2, $4, $6, nullptr};
|
{ AstIf* const newp = new AstIf{$2, $4, $6};
|
||||||
$$ = newp;
|
$$ = newp;
|
||||||
if ($1 == uniq_UNIQUE) newp->uniquePragma(true);
|
if ($1 == uniq_UNIQUE) newp->uniquePragma(true);
|
||||||
if ($1 == uniq_UNIQUE0) newp->unique0Pragma(true);
|
if ($1 == uniq_UNIQUE0) newp->unique0Pragma(true);
|
||||||
@ -3180,7 +3180,7 @@ statement_item<nodep>: // IEEE: statement_item
|
|||||||
$$ = $2->cloneTree(true);
|
$$ = $2->cloneTree(true);
|
||||||
$$->addNext(new AstWhile($1,$5,$2));
|
$$->addNext(new AstWhile($1,$5,$2));
|
||||||
}
|
}
|
||||||
else $$ = new AstWhile($1,$5,nullptr); }
|
else $$ = new AstWhile($1,$5); }
|
||||||
// // IEEE says array_identifier here, but dotted accepted in VMM and 1800-2009
|
// // IEEE says array_identifier here, but dotted accepted in VMM and 1800-2009
|
||||||
| yFOREACH '(' idClassSelForeach ')' stmtBlock { $$ = new AstForeach($1, $3, $5); }
|
| yFOREACH '(' idClassSelForeach ')' stmtBlock { $$ = new AstForeach($1, $3, $5); }
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user