Support until_with property (#7290 partial) (#7436)

This commit is contained in:
Ryszard Rozak
2026-04-17 06:33:36 -04:00
committed by GitHub
parent 72952fd3fb
commit ba508c00d2
10 changed files with 69 additions and 66 deletions
+17 -5
View File
@@ -1148,16 +1148,28 @@ private:
VL_DO_DANGLING(pushDeletep(nodep), nodep);
return;
}
if (nodep->isStrong()) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: s_until"
<< (nodep->isOverlapping() ? "_with" : "")
<< " (in property expresion)");
nodep->replaceWith(new AstConst{flp, AstConst::BitFalse{}});
VL_DO_DANGLING(pushDeletep(nodep), nodep);
return;
}
AstLoop* const loopp = new AstLoop{flp};
AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack();
AstLogAnd* const condp
= new AstLogAnd{flp, nodep->lhsp()->unlinkFrBack(), new AstLogNot{flp, rhsp}};
loopp->addStmtsp(new AstLoopTest{flp, loopp, condp});
AstNodeExpr* const lhsp = nodep->lhsp()->unlinkFrBack();
AstLogAnd* const loopCondp = new AstLogAnd{flp, lhsp, new AstLogNot{flp, rhsp}};
loopp->addStmtsp(new AstLoopTest{flp, loopp, loopCondp});
loopp->addStmtsp(new AstEventControl{flp, newSenTree(nodep), nullptr});
AstNodeExpr* const rhsCopyp = rhsp->cloneTreePure(false);
AstNodeExpr* const passCondp
= nodep->isOverlapping() ? new AstLogAnd{flp, lhsp->cloneTreePure(false), rhsCopyp}
: rhsCopyp;
AstBegin* const beginp = new AstBegin{flp, "", loopp, true};
beginp->addStmtsp(new AstIf{flp, rhsp->cloneTreePure(false), new AstPExprClause{flp},
new AstPExprClause{flp, false}});
beginp->addStmtsp(
new AstIf{flp, passCondp, new AstPExprClause{flp}, new AstPExprClause{flp, false}});
AstPExpr* const pexprp = new AstPExpr{flp, beginp, nodep->dtypep()};
pexprp->user1(1);
+11 -2
View File
@@ -2737,19 +2737,28 @@ class AstUntil final : public AstNodeExpr {
// The until property expression
// @astgen op1 := lhsp : AstNodeExpr
// @astgen op2 := rhsp : AstNodeExpr
const bool m_strong; // 's_' preffix
const bool m_overlapping; // '_with` suffix
public:
AstUntil(FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp)
: ASTGEN_SUPER_Until(fl) {
AstUntil(FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp, bool strong, bool overlapping)
: ASTGEN_SUPER_Until(fl)
, m_strong{strong}
, m_overlapping{overlapping} {
this->lhsp(lhsp);
this->rhsp(rhsp);
}
ASTGEN_MEMBERS_AstUntil;
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
string emitVerilog() override { V3ERROR_NA_RETURN(""); }
string emitC() override { V3ERROR_NA_RETURN(""); }
string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { V3ERROR_NA_RETURN(""); }
int instrCount() const override { return widthInstrs(); }
bool sameNode(const AstNode* /*samep*/) const override { return true; }
bool isStrong() const { return m_strong; }
bool isOverlapping() const { return m_overlapping; }
};
class AstValuePlusArgs final : public AstNodeExpr {
// Search expression. If nullptr then this is a $test$plusargs instead of $value$plusargs.
+10
View File
@@ -2524,6 +2524,16 @@ bool AstUnionDType::sameNode(const AstNode* samep) const {
const AstUnionDType* const asamep = VN_DBG_AS(samep, UnionDType);
return m_isSoft == asamep->m_isSoft && m_isTagged == asamep->m_isTagged;
}
void AstUntil::dump(std::ostream& str) const {
this->AstNodeExpr::dump(str);
if (isStrong()) str << " [strong]";
if (isOverlapping()) str << " [overlapping]";
}
void AstUntil::dumpJson(std::ostream& str) const {
this->AstNodeExpr::dumpJson(str);
dumpJsonBoolFuncIf(str, isStrong);
dumpJsonBoolFuncIf(str, isOverlapping);
}
string AstNodeUOrStructDType::prettyDTypeName(bool full) const {
string result = verilogKwd() + "{";
if (full) { // else shorten for errors
+4 -4
View File
@@ -6759,13 +6759,13 @@ pexpr<nodeExprp>: // IEEE: property_expr (The name pexpr is important as regex
| yEVENTUALLY anyrange pexpr %prec yS_EVENTUALLY
{ $$ = $3; BBUNSUP($1, "Unsupported: eventually[] (in property expression)"); DEL($2); }
| ~o~pexpr yUNTIL pexpr
{ $$ = new AstUntil{$2, $1, $3}; }
{ $$ = new AstUntil{$2, $1, $3, false, false}; }
| ~o~pexpr yS_UNTIL pexpr
{ $$ = $1; BBUNSUP($2, "Unsupported: s_until (in property expression)"); DEL($3); }
{ $$ = new AstUntil{$2, $1, $3, true, false}; }
| ~o~pexpr yUNTIL_WITH pexpr
{ $$ = $1; BBUNSUP($2, "Unsupported: until_with (in property expression)"); DEL($3); }
{ $$ = new AstUntil{$2, $1, $3, false, true}; }
| ~o~pexpr yS_UNTIL_WITH pexpr
{ $$ = $1; BBUNSUP($2, "Unsupported: s_until_with (in property expression)"); DEL($3); }
{ $$ = new AstUntil{$2, $1, $3, true, true}; }
| ~o~pexpr yIMPLIES pexpr
{ $$ = new AstLogOr{$2, new AstLogNot{$2, $1}, $3}; }
// // yIFF also used by event_expression