Internals: Add AST nodes for tagged union parsing (#6867 partial) (#6881)

This commit is contained in:
Jose Drowne 2026-01-17 14:15:52 -05:00 committed by GitHub
parent 26ebb14c98
commit 12080dfcb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 663 additions and 482 deletions

View File

@ -412,6 +412,8 @@ public:
BIT,
BYTE,
CHANDLE,
// Void type for tagged union members (CVOID to avoid Windows VOID macro)
CVOID,
EVENT,
INT,
INTEGER,
@ -449,6 +451,7 @@ public:
"bit",
"byte",
"chandle",
"void",
"event",
"int",
"integer",
@ -476,13 +479,35 @@ public:
return names[m_e];
}
const char* dpiType() const {
static const char* const names[]
= {"%E-unk", "svBit", "char", "void*", "char",
"int", "%E-integer", "svLogic", "long long", "double",
"short", "%E-time", "const char*", "%E-untyped", "dpiScope",
"const char*", "%E-mtaskstate", "%E-dly-sched", "%E-trig-sched", "%E-dyn-sched",
"%E-fork", "%E-proc-ref", "%E-rand-gen", "%E-stdrand-gen", "IData",
"QData", "%E-logic-implct", " MAX"};
static const char* const names[] = {"%E-unk",
"svBit",
"char",
"void*",
"void",
"char",
"int",
"%E-integer",
"svLogic",
"long long",
"double",
"short",
"%E-time",
"const char*",
"%E-untyped",
"dpiScope",
"const char*",
"%E-mtaskstate",
"%E-dly-sched",
"%E-trig-sched",
"%E-dyn-sched",
"%E-fork",
"%E-proc-ref",
"%E-rand-gen",
"%E-stdrand-gen",
"IData",
"QData",
"%E-logic-implct",
" MAX"};
return names[m_e];
}
static void selfTest() {
@ -596,6 +621,7 @@ public:
/* BIT: */ "BIT",
/* BYTE: */ "BYTE",
/* CHANDLE: */ "LONGINT",
/* CVOID: */ "", // Should not be traced
/* EVENT: */ "EVENT",
/* INT: */ "INT",
/* INTEGER: */ "INTEGER",
@ -942,7 +968,14 @@ inline std::ostream& operator<<(std::ostream& os, const VCMethod& rhs) {
class VCaseType final {
public:
enum en : uint8_t { CT_CASE, CT_CASEX, CT_CASEZ, CT_CASEINSIDE, CT_RANDSEQUENCE };
enum en : uint8_t {
CT_CASE,
CT_CASEX,
CT_CASEZ,
CT_CASEINSIDE,
CT_CASEMATCHES,
CT_RANDSEQUENCE
};
enum en m_e;
VCaseType()
: m_e{CT_CASE} {}

View File

@ -1471,19 +1471,24 @@ public:
};
class AstUnionDType final : public AstNodeUOrStructDType {
bool m_isSoft; // Is a "union soft"
bool m_isTagged; // Is a "union tagged"
public:
// UNSUP: bool isTagged;
// VSigning below is mispurposed to indicate if packed or not
// isSoft implies packed
AstUnionDType(FileLine* fl, bool isSoft, VSigning numericUnpack)
AstUnionDType(FileLine* fl, bool isSoft, bool isTagged, VSigning numericUnpack)
: ASTGEN_SUPER_UnionDType(fl, numericUnpack)
, m_isSoft{isSoft} {
, m_isSoft{isSoft}
, m_isTagged{isTagged} {
packed(packed() | m_isSoft);
}
ASTGEN_MEMBERS_AstUnionDType;
string verilogKwd() const override { return "union"; }
bool isSoft() const { return m_isSoft; }
bool isTagged() const { return m_isTagged; }
bool sameNode(const AstNode* samep) const override;
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
};
#endif // Guard

View File

@ -1714,6 +1714,22 @@ public:
bool index() const { return m_index; }
bool isExprCoverageEligible() const override { return false; }
};
class AstMatches final : public AstNodeExpr {
// "matches" operator: "expr matches pattern"
// @astgen op1 := lhsp : AstNodeExpr // Expression to match
// @astgen op2 := patternp : AstNode // Pattern to match against
public:
AstMatches(FileLine* fl, AstNodeExpr* lhsp, AstNode* patternp)
: ASTGEN_SUPER_Matches(fl) {
this->lhsp(lhsp);
this->patternp(patternp);
}
ASTGEN_MEMBERS_AstMatches;
string emitVerilog() override { return "%l matches %r"; }
string emitC() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { return false; }
bool sameNode(const AstNode* /*samep*/) const override { return true; }
};
class AstMemberSel final : public AstNodeExpr {
// @astgen op1 := fromp : AstNodeExpr
//
@ -1907,6 +1923,33 @@ public:
AstNodeDType* getChildDTypep() const override { return childDTypep(); }
AstNodeDType* subDTypep() const VL_MT_STABLE { return dtypep() ? dtypep() : childDTypep(); }
};
class AstPatternStar final : public AstNodeExpr {
// Pattern wildcard: ".*"
public:
explicit AstPatternStar(FileLine* fl)
: ASTGEN_SUPER_PatternStar(fl) {}
ASTGEN_MEMBERS_AstPatternStar;
string emitVerilog() override { return ".*"; }
string emitC() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { return false; }
bool sameNode(const AstNode* /*samep*/) const override { return true; }
};
class AstPatternVar final : public AstNodeExpr {
// Pattern variable binding: ".variable"
string m_name; // Variable name
public:
AstPatternVar(FileLine* fl, const string& name)
: ASTGEN_SUPER_PatternVar(fl)
, m_name{name} {}
ASTGEN_MEMBERS_AstPatternVar;
string emitVerilog() override { return ".%k"; }
string emitC() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { return false; }
bool sameNode(const AstNode* samep) const override {
return m_name == VN_DBG_AS(samep, PatternVar)->m_name;
}
string name() const override VL_MT_STABLE { return m_name; }
};
class AstRand final : public AstNodeExpr {
// $random/$random(seed) or $urandom/$urandom(seed)
// Return a random number, based upon width()
@ -2374,6 +2417,44 @@ public:
bool sameNode(const AstNode* /*samep*/) const override { return true; }
bool isSystemFunc() const override { return true; }
};
class AstTaggedExpr final : public AstNodeExpr {
// Tagged union expression: "tagged MemberName [expr]"
// @astgen op1 := exprp : Optional[AstNodeExpr] // Optional value expression
string m_name; // Member identifier name
public:
AstTaggedExpr(FileLine* fl, const string& name, AstNodeExpr* exprp)
: ASTGEN_SUPER_TaggedExpr(fl)
, m_name{name} {
this->exprp(exprp);
}
ASTGEN_MEMBERS_AstTaggedExpr;
string emitVerilog() override { return "tagged %k"; }
string emitC() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { return false; }
bool sameNode(const AstNode* samep) const override {
return m_name == VN_DBG_AS(samep, TaggedExpr)->m_name;
}
string name() const override VL_MT_STABLE { return m_name; }
};
class AstTaggedPattern final : public AstNodeExpr {
// Tagged pattern for matches: "tagged MemberName [pattern]"
// @astgen op1 := patternp : Optional[AstNode] // Optional nested pattern
string m_name; // Member identifier name
public:
AstTaggedPattern(FileLine* fl, const string& name, AstNode* patternp)
: ASTGEN_SUPER_TaggedPattern(fl)
, m_name{name} {
this->patternp(patternp);
}
ASTGEN_MEMBERS_AstTaggedPattern;
string emitVerilog() override { return "tagged %k"; }
string emitC() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { return false; }
bool sameNode(const AstNode* samep) const override {
return m_name == VN_DBG_AS(samep, TaggedPattern)->m_name;
}
string name() const override VL_MT_STABLE { return m_name; }
};
class AstTestPlusArgs final : public AstNodeExpr {
// Search expression. If nullptr then this is a $test$plusargs instead of $value$plusargs.
// @astgen op1 := searchp : Optional[AstNode]

View File

@ -391,8 +391,10 @@ public:
bool casex() const { return m_casex == VCaseType::CT_CASEX; }
bool casez() const { return m_casex == VCaseType::CT_CASEZ; }
bool caseInside() const { return m_casex == VCaseType::CT_CASEINSIDE; }
bool caseMatches() const { return m_casex == VCaseType::CT_CASEMATCHES; }
bool caseSimple() const { return m_casex == VCaseType::CT_CASE; }
void caseInsideSet() { m_casex = VCaseType::CT_CASEINSIDE; }
void caseMatchesSet() { m_casex = VCaseType::CT_CASEMATCHES; }
bool fullPragma() const { return m_fullPragma; }
void fullPragma(bool flag) { m_fullPragma = flag; }
bool parallelPragma() const { return m_parallelPragma; }

View File

@ -2404,6 +2404,20 @@ void AstNodeUOrStructDType::dumpJson(std::ostream& str) const {
dumpJsonBoolFunc(str, isFourstate);
dumpJsonGen(str);
}
void AstUnionDType::dump(std::ostream& str) const {
this->AstNodeUOrStructDType::dump(str);
if (isSoft()) str << " [soft]";
if (isTagged()) str << " [tagged]";
}
void AstUnionDType::dumpJson(std::ostream& str) const {
this->AstNodeUOrStructDType::dumpJson(str);
dumpJsonBoolFunc(str, isSoft);
dumpJsonBoolFunc(str, isTagged);
}
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;
}
string AstNodeUOrStructDType::prettyDTypeName(bool full) const {
string result = verilogKwd() + "{";
if (full) { // else shorten for errors

View File

@ -861,6 +861,10 @@ class LinkParseVisitor final : public VNVisitor {
}
void visit(AstCase* nodep) override {
V3Control::applyCase(nodep);
// Check for unsupported case matches (for tagged union)
if (nodep->caseMatches()) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: case matches (for tagged union)");
}
cleanFileline(nodep);
iterateChildren(nodep);
}
@ -1018,6 +1022,41 @@ class LinkParseVisitor final : public VNVisitor {
iterateChildren(nodep);
}
// Tagged union features - flag as unsupported early
void visit(AstTaggedExpr* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: tagged union");
cleanFileline(nodep);
iterateChildren(nodep);
}
void visit(AstTaggedPattern* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: tagged pattern");
cleanFileline(nodep);
iterateChildren(nodep);
}
void visit(AstPatternVar* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: pattern variable");
cleanFileline(nodep);
iterateChildren(nodep);
}
void visit(AstPatternStar* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: pattern wildcard");
cleanFileline(nodep);
iterateChildren(nodep);
}
void visit(AstMatches* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: matches operator");
cleanFileline(nodep);
iterateChildren(nodep);
}
void visit(AstBasicDType* nodep) override {
// Check for void type used in tagged unions
if (nodep->keyword() == VBasicDTypeKwd::CVOID) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: void (for tagged unions)");
}
cleanFileline(nodep);
iterateChildren(nodep);
}
void visit(AstNode* nodep) override {
// Default: Just iterate
cleanFileline(nodep);

View File

@ -610,6 +610,33 @@ size_t V3ParseImp::tokenPipeScanEqNew(size_t depth) {
return depth;
}
bool V3ParseImp::tokenPipeScanTaggedFollowsPrimary(size_t depth) {
// Check if token at depth is a primary-starting token
// Used to disambiguate tagged union expressions
// Returns true if the token starts a primary expression (IEEE A.8.4)
// Note: '.' and '.*' are pattern-specific, NOT primaries
const int tok = tokenPeekp(depth)->token;
if (tok == '(') return true; // Parenthesized expression
if (tok == '{') return true; // Concatenation
if (tok == yP_TICKBRA) return true; // Assignment pattern '{
if (tok == yaINTNUM) return true; // Integer literal
if (tok == yaFLOATNUM) return true; // Float literal
if (tok == yaTIMENUM) return true; // Time literal
if (tok == yaSTRING) return true; // String literal
if (tok == yNULL) return true; // null
if (tok == yTHIS) return true; // this
if (tok == '$') return true; // $
if (tok == yaID__LEX) return true; // Identifier (raw)
if (tok == yaID__ETC) return true; // Identifier
if (tok == yaID__CC) return true; // Identifier with ::
if (tok == yaID__aTYPE) return true; // Type identifier
if (tok == yaID__aINST) return true; // Instance identifier
if (tok == yTAGGED__LEX) return true; // Nested tagged (raw)
if (tok == yTAGGED) return true; // Nested tagged
if (tok == yTAGGED__NONPRIMARY) return true; // Nested tagged (no primary)
return false;
}
int V3ParseImp::tokenPipelineId(int token) {
const V3ParseBisonYYSType* nexttokp = tokenPeekp(0); // First char after yaID
const int nexttok = nexttokp->token;
@ -644,6 +671,7 @@ void V3ParseImp::tokenPipeline() {
|| token == yLOCAL__LEX //
|| token == yNEW__LEX //
|| token == ySTATIC__LEX //
|| token == yTAGGED__LEX //
|| token == yTYPE__LEX //
|| token == yVIRTUAL__LEX //
|| token == yWITH__LEX //
@ -726,6 +754,22 @@ void V3ParseImp::tokenPipeline() {
} else {
token = yVIRTUAL__ETC;
}
} else if (token == yTAGGED__LEX) {
// Look past 'tagged id' to see if primary follows
// Check for all ID token types (both raw and processed forms)
if (nexttok == yaID__LEX || nexttok == yaID__ETC || nexttok == yaID__aTYPE
|| nexttok == yaID__aINST) {
VL_RESTORER(yylval); // Remember value, as about to read ahead
// Check token after the identifier
if (tokenPipeScanTaggedFollowsPrimary(1)) {
token = yTAGGED; // Has value expression following
} else {
token = yTAGGED__NONPRIMARY; // No primary follows
}
} else {
// No identifier follows, not a tagged expression (e.g., 'union tagged {')
token = yTAGGED;
}
} else if (token == yWITH__LEX) {
if (nexttok == '(') {
VL_RESTORER(yylval); // Remember value, as about to read ahead

View File

@ -39,6 +39,8 @@ class V3Lexer;
enum V3UniqState : uint8_t { uniq_NONE, uniq_UNIQUE, uniq_UNIQUE0, uniq_PRIORITY };
enum V3TaggedState : uint8_t { tagged_NONE, tagged_SOFT, tagged_TAGGED };
enum V3ImportProperty : uint8_t { iprop_NONE, iprop_CONTEXT, iprop_PURE };
//============================================================================
@ -119,6 +121,7 @@ struct V3ParseBisonYYSType final {
bool cbool;
VMemberQualifiers qualifiers;
V3UniqState uniqstate;
V3TaggedState taggedstate;
V3ImportProperty iprop;
VSigning::en signstate;
V3ErrorCode::en errcodeen;
@ -322,6 +325,7 @@ private:
size_t tokenPipeScanParam(size_t depth, bool forInst) VL_MT_DISABLED;
size_t tokenPipeScanParens(size_t depth) VL_MT_DISABLED;
size_t tokenPipeScanEqNew(size_t depth) VL_MT_DISABLED;
bool tokenPipeScanTaggedFollowsPrimary(size_t depth) VL_MT_DISABLED;
const V3ParseBisonYYSType* tokenPeekp(size_t depth) VL_MT_DISABLED;
void preprocDumps(std::ostream& os, bool forInputs) VL_MT_DISABLED;
};

View File

@ -3240,6 +3240,10 @@ class WidthVisitor final : public VNVisitor {
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
nodep->doingWidth(true);
UINFO(5, " NODEUORS " << nodep);
// Check for tagged unions
if (const AstUnionDType* const unionp = VN_CAST(nodep, UnionDType)) {
if (unionp->isTagged()) { nodep->v3warn(E_UNSUPPORTED, "Unsupported: tagged union"); }
}
// UINFOTREE(9, nodep, "", "class-in");
if (!nodep->packed() && v3Global.opt.structsPacked()) nodep->packed(true);
userIterateChildren(nodep, nullptr); // First size all members
@ -4855,6 +4859,37 @@ class WidthVisitor final : public VNVisitor {
}
}
void visit(AstTaggedExpr* nodep) override {
// Tagged union expressions are currently unsupported
nodep->v3warn(E_UNSUPPORTED, "Unsupported: tagged union");
// Set a placeholder type to allow further processing
nodep->dtypeSetBit();
userIterateChildren(nodep, m_vup);
}
void visit(AstTaggedPattern* nodep) override {
// Tagged patterns are currently unsupported
nodep->v3warn(E_UNSUPPORTED, "Unsupported: tagged pattern");
nodep->dtypeSetBit();
userIterateChildren(nodep, m_vup);
}
void visit(AstPatternVar* nodep) override {
// Pattern variable bindings are currently unsupported
nodep->v3warn(E_UNSUPPORTED, "Unsupported: pattern variable");
nodep->dtypeSetBit();
}
void visit(AstPatternStar* nodep) override {
// Pattern wildcards are currently unsupported
nodep->v3warn(E_UNSUPPORTED, "Unsupported: pattern wildcard");
nodep->dtypeSetBit();
}
void visit(AstMatches* nodep) override {
// Matches operator is currently unsupported
nodep->v3warn(E_UNSUPPORTED, "Unsupported: matches operator");
// Matches returns a boolean
nodep->dtypeSetBit();
userIterateChildren(nodep, m_vup);
}
void visit(AstPattern* nodep) override {
if (nodep->didWidthAndSet()) return;
UINFO(9, "PATTERN " << nodep);

View File

@ -639,7 +639,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"string" { FL; return ySTRING; }
"struct" { FL; return ySTRUCT; }
"super" { FL; return ySUPER; }
"tagged" { FL; return yTAGGED; }
"tagged" { FL; return yTAGGED__LEX; }
"this" { FL; return yTHIS; }
"throughout" { FL; return yTHROUGHOUT; }
"timeprecision" { FL; return yTIMEPRECISION; }

View File

@ -539,6 +539,8 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"})
%token<fl> yS_UNTIL_WITH "s_until_with"
%token<fl> yTABLE "table"
%token<fl> yTAGGED "tagged"
%token<fl> yTAGGED__LEX "tagged-in-lex"
%token<fl> yTAGGED__NONPRIMARY "tagged-nonprimary"
%token<fl> yTASK "task"
%token<fl> yTHIS "this"
%token<fl> yTHROUGHOUT "throughout"
@ -2103,8 +2105,7 @@ data_typeVirtual<nodeDTypep>: // ==IEEE: data_type after yVIRTUAL [ yI
data_type_or_void<nodeDTypep>: // ==IEEE: data_type_or_void
data_typeAny { $$ = $1; }
| yVOID
{ $$ = new AstBasicDType{$1, LOGIC_IMPLICIT};
BBUNSUP($1, "Unsupported: void (for tagged unions)"); }
{ $$ = new AstBasicDType{$1, VBasicDTypeKwd::CVOID}; }
;
var_data_type<nodeDTypep>: // ==IEEE: var_data_type
@ -2135,7 +2136,7 @@ struct_unionDecl<nodeUOrStructDTypep>: // IEEE: part of data_type
/*cont*/ struct_union_memberListEnd
{ $$ = $<nodeUOrStructDTypep>4; $$->addMembersp($5); }
| yUNION taggedSoftE packedSigningE '{'
/*mid*/ { $<nodeUOrStructDTypep>$ = new AstUnionDType{$1, $2, $3}; }
/*mid*/ { $<nodeUOrStructDTypep>$ = new AstUnionDType{$1, $2 == tagged_SOFT, $2 == tagged_TAGGED, $3}; }
/*cont*/ struct_union_memberListEnd
{ $$ = $<nodeUOrStructDTypep>5; $$->addMembersp($6); }
;
@ -2273,10 +2274,10 @@ random_qualifier<qualifiers>: // ==IEEE: random_qualifier
| yRANDC { $$ = VMemberQualifiers::none(); $$.m_randc = true; }
;
taggedSoftE<cbool>:
/*empty*/ { $$ = false; }
| ySOFT { $$ = true; }
| yTAGGED { $$ = false; BBUNSUP($<fl>1, "Unsupported: tagged union"); }
taggedSoftE<taggedstate>:
/*empty*/ { $$ = tagged_NONE; }
| ySOFT { $$ = tagged_SOFT; }
| yTAGGED { $$ = tagged_TAGGED; }
;
packedSigningE<signstate>:
@ -3557,9 +3558,13 @@ statement_item<nodeStmtp>: // IEEE: statement_item
if ($1 == uniq_UNIQUE) $2->uniquePragma(true);
if ($1 == uniq_UNIQUE0) $2->unique0Pragma(true);
if ($1 == uniq_PRIORITY) $2->priorityPragma(true); }
// &&& is part of expr so case_patternList aliases to case_itemList
| unique_priorityE caseStart caseAttrE yMATCHES case_itemList yENDCASE
{ $$ = nullptr; BBUNSUP($4, "Unsupported: matches (for tagged union)"); DEL($2, $5); }
// case matches uses patterns, not expressions
| unique_priorityE caseStart caseAttrE yMATCHES case_matches_itemList yENDCASE
{ $$ = $2; if ($5) $2->addItemsp($5);
$2->caseMatchesSet();
if ($1 == uniq_UNIQUE) $2->uniquePragma(true);
if ($1 == uniq_UNIQUE0) $2->unique0Pragma(true);
if ($1 == uniq_PRIORITY) $2->priorityPragma(true); }
| unique_priorityE caseStart caseAttrE yINSIDE case_inside_itemList yENDCASE
{ $$ = $2; if ($5) $2->addItemsp($5);
if (!$2->caseSimple()) $4->v3error("Illegal to have inside on a casex/casez");
@ -3864,6 +3869,21 @@ case_inside_itemList<caseItemp>: // IEEE: { case_inside_item + range_list
| case_inside_itemList yDEFAULT colon stmt { $$ = $1->addNext(new AstCaseItem{$2, nullptr, $4}); }
;
case_matches_itemList<caseItemp>: // IEEE: { case_pattern_item + ... }
// // IEEE: case_pattern_item ::= pattern [&&& expr] : stmt
// // pattern includes expr for tagged void members (tagged id)
patternNoExpr colon stmt { $$ = new AstCaseItem{$2, $1, $3}; }
| expr colon stmt { $$ = new AstCaseItem{$2, $1, $3}; }
| yDEFAULT colon stmt { $$ = new AstCaseItem{$1, nullptr, $3}; }
| yDEFAULT stmt { $$ = new AstCaseItem{$1, nullptr, $2}; }
| case_matches_itemList patternNoExpr colon stmt
{ $$ = $1->addNext(new AstCaseItem{$3, $2, $4}); }
| case_matches_itemList expr colon stmt
{ $$ = $1->addNext(new AstCaseItem{$3, $2, $4}); }
| case_matches_itemList yDEFAULT stmt { $$ = $1->addNext(new AstCaseItem{$2, nullptr, $3}); }
| case_matches_itemList yDEFAULT colon stmt { $$ = $1->addNext(new AstCaseItem{$2, nullptr, $4}); }
;
rand_case_itemList<caseItemp>: // IEEE: { rand_case_item + ... }
// // Randcase syntax doesn't have default, or expression lists
expr colon stmt { $$ = new AstCaseItem{$2, $1, $3}; }
@ -3909,15 +3929,19 @@ caseCondList<nodeExprp>: // IEEE: part of case_item
| caseCondList ',' exprTypeCompare { $$ = $1->addNext($3); }
;
patternNoExpr<nodep>: // IEEE: pattern **Excluding Expr*
patternNoExpr<nodeExprp>: // IEEE: pattern **Excluding Expr*
'.' idAny/*variable*/
{ $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); }
{ $$ = new AstPatternVar{$1, *$2}; }
| yP_DOTSTAR
{ $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); }
{ $$ = new AstPatternStar{$1}; }
// // IEEE: "expr" excluded; expand in callers
// // "yTAGGED idAny [expr]" Already part of expr
// // IEEE: tagged member_identifier [ pattern ]
// // Standalone "yTAGGED__NONPRIMARY idAny" is handled via expr in patternOne
// // Here, we need to treat yTAGGED and yTAGGED__NONPRIMARY identically.
| yTAGGED idAny/*member_identifier*/ patternNoExpr
{ $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); DEL($3); }
{ $$ = new AstTaggedPattern{$1, *$2, $3}; }
| yTAGGED__NONPRIMARY idAny/*member_identifier*/ patternNoExpr
{ $$ = new AstTaggedPattern{$1, *$2, $3}; }
// // "yP_TICKBRA patternList '}'" part of expr under assignment_pattern
;
@ -3940,10 +3964,10 @@ patternMemberList<nodep>: // IEEE: part of pattern and assignment_pattern
patternMemberOne<patMemberp>: // IEEE: part of pattern and assignment_pattern
patternKey ':' expr { $$ = new AstPatMember{$1->fileline(), $3, $1, nullptr}; }
| patternKey ':' patternNoExpr { $$ = nullptr; BBUNSUP($2, "Unsupported: '{} .* patterns"); DEL($1, $3); }
| patternKey ':' patternNoExpr { $$ = new AstPatMember{$1->fileline(), $3, $1, nullptr}; }
// // From assignment_pattern_key
| yDEFAULT ':' expr { $$ = new AstPatMember{$1, $3, nullptr, nullptr}; $$->isDefault(true); }
| yDEFAULT ':' patternNoExpr { $$ = nullptr; BBUNSUP($2, "Unsupported: '{} .* patterns"); DEL($3); }
| yDEFAULT ':' patternNoExpr { AstPatMember* const patp = new AstPatMember{$1, $3, nullptr, nullptr}; patp->isDefault(true); $$ = patp; }
;
patternKey<nodep>: // IEEE: merge structure_pattern_key, array_pattern_key, assignment_pattern_key
@ -5020,9 +5044,34 @@ expr<nodeExprp>: // IEEE: part of expression/constant_expression/
| ~l~expr yINSIDE '{' range_list '}' { $$ = new AstInside{$2, $1, $4}; }
//
// // IEEE: tagged_union_expression
//UNSUP yTAGGED id/*member*/ %prec prTAGGED { $$ = $2; BBUNSUP("tagged reference"); }
// // Spec only allows primary
//UNSUP yTAGGED id/*member*/ %prec prTAGGED expr /*primary*/ { $$ = $2; BBUNSUP("tagged reference"); }
// // yTAGGED__NONPRIMARY = tokenPipeline determined no primary follows
| yTAGGED__NONPRIMARY idAny/*member*/ %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, nullptr}; }
// // yTAGGED = primary follows; handle specific primary types
// // Parenthesized expression
| yTAGGED idAny/*member*/ '(' expr ')' %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, $4}; }
// // Assignment patterns like tagged Add '{a, b, c}
| yTAGGED idAny/*member*/ assignment_pattern %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, $3}; }
// // Integer literal
| yTAGGED idAny/*member*/ yaINTNUM %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, new AstConst{$<fl>3, *$3}}; }
// // Float literal
| yTAGGED idAny/*member*/ yaFLOATNUM %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, new AstConst{$<fl>3, AstConst::RealDouble{}, $3}}; }
// // String literal
| yTAGGED idAny/*member*/ yaSTRING %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, new AstConst{$<fl>3, AstConst::VerilogStringLiteral{}, *$3}}; }
// // null literal
| yTAGGED idAny/*member*/ yNULL %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, new AstConst{$3, AstConst::Null{}}}; }
// // Identifier as value
| yTAGGED idAny/*member*/ idAny %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, new AstParseRef{$<fl>3, *$3, nullptr, nullptr}}; }
// // Concatenation
| yTAGGED idAny/*member*/ '{' cateList '}' %prec prTAGGED
{ $$ = new AstTaggedExpr{$1, *$2, $4}; }
//
//======================// IEEE: primary/constant_primary
//
@ -5128,10 +5177,8 @@ expr<nodeExprp>: // IEEE: part of expression/constant_expression/
// // IEEE: cond_pattern - here to avoid reduce problems
// // "expr yMATCHES pattern"
// // IEEE: pattern - expanded here to avoid conflicts
| ~l~expr yMATCHES patternNoExpr { $$ = new AstConst{$2, AstConst::BitFalse{}};
BBUNSUP($<fl>2, "Unsupported: matches operator"); }
| ~l~expr yMATCHES ~r~expr { $$ = new AstConst{$2, AstConst::BitFalse{}};
BBUNSUP($<fl>2, "Unsupported: matches operator"); }
| ~l~expr yMATCHES patternNoExpr { $$ = new AstMatches{$2, $1, $3}; }
| ~l~expr yMATCHES ~r~expr { $$ = new AstMatches{$2, $1, $3}; }
//
// // IEEE: expression_or_dist - here to avoid reduce problems
// // "expr yDIST '{' dist_list '}'"

View File

@ -1,42 +1,69 @@
%Error-UNSUPPORTED: t/t_tagged.v:9:18: Unsupported: tagged union
9 | typedef union tagged {
| ^~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_tagged.v:10:6: Unsupported: void (for tagged unions)
10 | void m_invalid;
| ^~~~
%Error: t/t_tagged.v:19:14: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_tagged.v:19:14: Unsupported: tagged union
19 | u = tagged m_invalid;
| ^~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error-UNSUPPORTED: t/t_tagged.v:24:16: Unsupported: matches (for tagged union)
%Error-UNSUPPORTED: t/t_tagged.v:24:7: Unsupported: case matches (for tagged union)
24 | case (u) matches
| ^~~~~~~
%Error: t/t_tagged.v:29:9: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
| ^~~~
%Error-UNSUPPORTED: t/t_tagged.v:28:7: Unsupported: case matches (for tagged union)
28 | case (u) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged.v:29:9: Unsupported: tagged union
29 | tagged m_invalid: ;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:34:34: Unsupported: '{} tagged patterns
34 | if (u matches tagged m_int .n) $stop;
| ^
%Error-UNSUPPORTED: t/t_tagged.v:34:21: Unsupported: '{} tagged patterns
34 | if (u matches tagged m_int .n) $stop;
%Error-UNSUPPORTED: t/t_tagged.v:30:9: Unsupported: tagged union
30 | tagged m_int: $stop;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:33:13: Unsupported: matches operator
33 | if (u matches tagged m_invalid) ;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:33:21: Unsupported: tagged union
33 | if (u matches tagged m_invalid) ;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:34:13: Unsupported: matches operator
34 | if (u matches tagged m_int .n) $stop;
| ^~~~~~~
%Error: t/t_tagged.v:36:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
%Error-UNSUPPORTED: t/t_tagged.v:34:21: Unsupported: tagged pattern
34 | if (u matches tagged m_int .n) $stop;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:34:34: Unsupported: pattern variable
34 | if (u matches tagged m_int .n) $stop;
| ^
%Error-UNSUPPORTED: t/t_tagged.v:36:11: Unsupported: tagged union
36 | u = tagged m_int (123);
| ^~~~~~
%Error: t/t_tagged.v:40:9: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
%Error-UNSUPPORTED: t/t_tagged.v:39:7: Unsupported: case matches (for tagged union)
39 | case (u) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged.v:40:9: Unsupported: tagged union
40 | tagged m_invalid: $stop;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:45:34: Unsupported: '{} tagged patterns
45 | if (u matches tagged m_int .n) if (n != 123) $stop;
| ^
%Error-UNSUPPORTED: t/t_tagged.v:45:21: Unsupported: '{} tagged patterns
45 | if (u matches tagged m_int .n) if (n != 123) $stop;
%Error-UNSUPPORTED: t/t_tagged.v:41:9: Unsupported: tagged pattern
41 | tagged m_int .n: if (n !== 123) $stop;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:41:22: Unsupported: pattern variable
41 | tagged m_int .n: if (n !== 123) $stop;
| ^
%Error-UNSUPPORTED: t/t_tagged.v:44:13: Unsupported: matches operator
44 | if (u matches tagged m_invalid) $stop;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:44:21: Unsupported: tagged union
44 | if (u matches tagged m_invalid) $stop;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:45:13: Unsupported: matches operator
45 | if (u matches tagged m_int .n) if (n != 123) $stop;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:45:21: Unsupported: tagged pattern
45 | if (u matches tagged m_int .n) if (n != 123) $stop;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged.v:45:34: Unsupported: pattern variable
45 | if (u matches tagged m_int .n) if (n != 123) $stop;
| ^
%Error: t/t_tagged.v:41:30: Can't find definition of variable: 'n'
41 | tagged m_int .n: if (n !== 123) $stop;
| ^
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: Exiting due to

View File

@ -1,158 +1,152 @@
%Error-UNSUPPORTED: t/t_tagged_case.v:24:17: Unsupported: tagged union
24 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:27:5: Unsupported: void (for tagged unions)
27 | void Invalid;
| ^~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_tagged_case.v:25:5: Unsupported: void (for tagged unions)
25 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:33:5: Unsupported: void (for tagged unions)
33 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:30:17: Unsupported: tagged union
30 | typedef union tagged packed {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:31:5: Unsupported: void (for tagged unions)
31 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:42:5: Unsupported: void (for tagged unions)
42 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:39:17: Unsupported: tagged union
39 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:40:5: Unsupported: void (for tagged unions)
40 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:63:5: Unsupported: void (for tagged unions)
63 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:46:17: Unsupported: tagged union
46 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:50:11: Unsupported: tagged union
50 | union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:60:17: Unsupported: tagged union
60 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:61:5: Unsupported: void (for tagged unions)
61 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:69:5: Unsupported: void (for tagged unions)
69 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:66:17: Unsupported: tagged union
66 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:67:5: Unsupported: void (for tagged unions)
67 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:78:5: Unsupported: void (for tagged unions)
78 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:75:17: Unsupported: tagged union
75 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:76:5: Unsupported: void (for tagged unions)
76 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:85:5: Unsupported: void (for tagged unions)
85 | void Invalid;
| ^~~~
%Warning-SHORTREAL: t/t_tagged_case.v:78:5: Unsupported: shortreal being promoted to real (suggest use real instead)
78 | shortreal ShortRealVal;
| ^~~~~~~~~
... For warning description see https://verilator.org/warn/SHORTREAL?v=latest
... Use "/* verilator lint_off SHORTREAL */" and lint_on around source to disable this message.
%Error-UNSUPPORTED: t/t_tagged_case.v:82:17: Unsupported: tagged union
82 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:83:5: Unsupported: void (for tagged unions)
83 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:91:5: Unsupported: void (for tagged unions)
91 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:88:17: Unsupported: tagged union
88 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:89:5: Unsupported: void (for tagged unions)
89 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:100:5: Unsupported: void (for tagged unions)
100 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:97:17: Unsupported: tagged union
97 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:98:5: Unsupported: void (for tagged unions)
98 | void Invalid;
| ^~~~
%Error: t/t_tagged_case.v:122:9: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
122 | v = tagged Invalid;
%Error-UNSUPPORTED: t/t_tagged_case.v:124:9: Unsupported: tagged union
124 | v = tagged Invalid;
| ^~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: t/t_tagged_case.v:125:7: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
125 | tagged Invalid : result = 1;
%Error-UNSUPPORTED: t/t_tagged_case.v:126:5: Unsupported: case matches (for tagged union)
126 | case (v) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:127:7: Unsupported: tagged union
127 | tagged Invalid : result = 1;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:128:7: Unsupported: tagged pattern
128 | tagged Valid .n : result = n;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:128:20: Unsupported: pattern variable
128 | tagged Valid .n : result = n;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:133:9: Unsupported: tagged union
133 | v = tagged Valid (123);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:135:5: Unsupported: case matches (for tagged union)
135 | case (v) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:136:7: Unsupported: tagged union
136 | tagged Invalid : result = -1;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:137:7: Unsupported: tagged pattern
137 | tagged Valid .n : result = n;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:137:20: Unsupported: pattern variable
137 | tagged Valid .n : result = n;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:142:10: Unsupported: tagged union
142 | wt = tagged Wide60 (60'hFEDCBA987654321);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:144:5: Unsupported: case matches (for tagged union)
144 | case (wt) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:145:7: Unsupported: tagged union
145 | tagged Invalid : wide60_result = 0;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:146:7: Unsupported: tagged pattern
146 | tagged Wide60 .w : wide60_result = w;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:146:21: Unsupported: pattern variable
146 | tagged Wide60 .w : wide60_result = w;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:152:10: Unsupported: tagged union
152 | wt = tagged Wide90 (90'hDE_ADBEEFCA_FEBABE12_3456);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:154:5: Unsupported: case matches (for tagged union)
154 | case (wt) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:155:7: Unsupported: tagged union
155 | tagged Invalid : wide90_result = 0;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:156:7: Unsupported: tagged pattern
156 | tagged Wide90 .w : wide90_result = w;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:156:21: Unsupported: pattern variable
156 | tagged Wide90 .w : wide90_result = w;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:162:10: Unsupported: tagged union
162 | wt = tagged Byte8NonZeroLSB (8'hA5);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:164:5: Unsupported: case matches (for tagged union)
164 | case (wt) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:165:7: Unsupported: tagged pattern
165 | tagged Byte8NonZeroLSB .b : result = b;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:165:30: Unsupported: pattern variable
165 | tagged Byte8NonZeroLSB .b : result = b;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:171:10: Unsupported: tagged union
171 | wt = tagged Word32LittleEndian (32'hDEADBEEF);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:173:5: Unsupported: case matches (for tagged union)
173 | case (wt) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:174:7: Unsupported: tagged pattern
174 | tagged Word32LittleEndian .w : result = w;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:174:33: Unsupported: pattern variable
174 | tagged Word32LittleEndian .w : result = w;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:180:10: Unsupported: tagged union
180 | at = tagged Arr '{10, 20, 30, 40};
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:182:5: Unsupported: case matches (for tagged union)
182 | case (at) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:183:7: Unsupported: tagged union
183 | tagged Invalid : result = -1;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:184:7: Unsupported: tagged pattern
184 | tagged Scalar .s : result = s;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:184:21: Unsupported: pattern variable
184 | tagged Scalar .s : result = s;
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:185:7: Unsupported: tagged pattern
185 | tagged Arr .a : result = a[0] + a[1] + a[2] + a[3];
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:185:18: Unsupported: pattern variable
185 | tagged Arr .a : result = a[0] + a[1] + a[2] + a[3];
| ^
%Error-UNSUPPORTED: t/t_tagged_case.v:190:13: Unsupported: tagged union
190 | instr = tagged Jmp (tagged JmpC '{2'd1, 10'd256});
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:190:25: Unsupported: tagged union
190 | instr = tagged Jmp (tagged JmpC '{2'd1, 10'd256});
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:192:5: Unsupported: case matches (for tagged union)
192 | case (instr) matches
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:193:7: Unsupported: tagged pattern
193 | tagged Add .* : result = -1;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_case.v:193:18: Unsupported: pattern wildcard
193 | tagged Add .* : result = -1;
| ^~
%Error-UNSUPPORTED: t/t_tagged_case.v:194:7: Unsupported: tagged union
194 | tagged Jmp (tagged JmpU .a) : result = a;
| ^~~~~~
%Error: t/t_tagged_case.v:128:161: syntax error, unexpected while
128 | do if ((result) !== (1)) begin $write("%%Error: %s:%0d: got=%0x exp=%0x (%s !== %s)\n", "t/t_tagged_case.v",128, (result), (1), "result", "1"); $stop; end while(0);;
| ^~~~~
%Error: t/t_tagged_case.v:131:7: syntax error, unexpected '=', expecting '('
131 | v = tagged Valid (123);
| ^
%Error: t/t_tagged_case.v:133:14: syntax error, unexpected matches, expecting IDENTIFIER-for-type
133 | case (v) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:140:8: syntax error, unexpected '=', expecting '('
140 | wt = tagged Wide60 (60'hFEDCBA987654321);
| ^
%Error: t/t_tagged_case.v:142:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
142 | case (wt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:150:8: syntax error, unexpected '=', expecting '('
150 | wt = tagged Wide90 (90'hDE_ADBEEFCA_FEBABE12_3456);
| ^
%Error: t/t_tagged_case.v:152:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
152 | case (wt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:160:8: syntax error, unexpected '=', expecting '('
160 | wt = tagged Byte8NonZeroLSB (8'hA5);
| ^
%Error: t/t_tagged_case.v:162:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
162 | case (wt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:169:8: syntax error, unexpected '=', expecting '('
169 | wt = tagged Word32LittleEndian (32'hDEADBEEF);
| ^
%Error: t/t_tagged_case.v:171:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
171 | case (wt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:178:8: syntax error, unexpected '=', expecting '('
178 | at = tagged Arr '{10, 20, 30, 40};
| ^
%Error: t/t_tagged_case.v:180:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
180 | case (at) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:188:11: syntax error, unexpected '=', expecting '('
188 | instr = tagged Jmp (tagged JmpC '{2'd1, 10'd256});
| ^
%Error: t/t_tagged_case.v:190:18: syntax error, unexpected matches, expecting IDENTIFIER-for-type
190 | case (instr) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:198:9: syntax error, unexpected '=', expecting '('
198 | cht = tagged Invalid;
| ^
%Error: t/t_tagged_case.v:200:16: syntax error, unexpected matches, expecting IDENTIFIER-for-type
200 | case (cht) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:207:9: syntax error, unexpected =-then-new, expecting '('
207 | obj = new(42);
| ^
%Error: t/t_tagged_case.v:210:16: syntax error, unexpected matches, expecting IDENTIFIER-for-type
210 | case (clt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:217:8: syntax error, unexpected '=', expecting '('
217 | rt = tagged Invalid;
| ^
%Error: t/t_tagged_case.v:219:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
219 | case (rt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:226:8: syntax error, unexpected '=', expecting '('
226 | rt = tagged RealVal (3.14159);
| ^
%Error: t/t_tagged_case.v:228:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
228 | case (rt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:239:8: syntax error, unexpected '=', expecting '('
239 | rt = tagged ShortRealVal (2.5);
| ^
%Error: t/t_tagged_case.v:241:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
241 | case (rt) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:252:8: syntax error, unexpected '=', expecting '('
252 | st = tagged Invalid;
| ^
%Error: t/t_tagged_case.v:254:15: syntax error, unexpected matches, expecting IDENTIFIER-for-type
254 | case (st) matches
| ^~~~~~~
%Error: t/t_tagged_case.v:260:8: syntax error, unexpected '=', expecting '('
260 | st = tagged StrVal ("hello");
| ^
%Error: Exiting due to

View File

@ -4,6 +4,8 @@
// any use, without warranty, 2024 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// verilator lint_off SHORTREAL
// Test case pattern matching with tagged unions
// IEEE 1800-2023 Section 12.6.1

View File

@ -1,158 +1,14 @@
%Error-UNSUPPORTED: t/t_tagged_if.v:24:17: Unsupported: tagged union
24 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:216:37: Unsupported: &&& expression
216 | if (instr matches tagged Jmp .j &&&
| ^~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_tagged_if.v:25:5: Unsupported: void (for tagged unions)
25 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:30:17: Unsupported: tagged union
30 | typedef union tagged packed {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:31:5: Unsupported: void (for tagged unions)
31 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:39:17: Unsupported: tagged union
39 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:40:5: Unsupported: void (for tagged unions)
40 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:46:17: Unsupported: tagged union
46 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:50:11: Unsupported: tagged union
50 | union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:60:17: Unsupported: tagged union
60 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:61:5: Unsupported: void (for tagged unions)
61 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:66:17: Unsupported: tagged union
66 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:67:5: Unsupported: void (for tagged unions)
67 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:75:17: Unsupported: tagged union
75 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:76:5: Unsupported: void (for tagged unions)
76 | void Invalid;
| ^~~~
%Warning-SHORTREAL: t/t_tagged_if.v:78:5: Unsupported: shortreal being promoted to real (suggest use real instead)
78 | shortreal ShortRealVal;
| ^~~~~~~~~
... For warning description see https://verilator.org/warn/SHORTREAL?v=latest
... Use "/* verilator lint_off SHORTREAL */" and lint_on around source to disable this message.
%Error-UNSUPPORTED: t/t_tagged_if.v:82:17: Unsupported: tagged union
82 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:83:5: Unsupported: void (for tagged unions)
83 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:88:17: Unsupported: tagged union
88 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:89:5: Unsupported: void (for tagged unions)
89 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:97:17: Unsupported: tagged union
97 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:98:5: Unsupported: void (for tagged unions)
98 | void Invalid;
| ^~~~
%Error: t/t_tagged_if.v:122:9: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
122 | v = tagged Invalid;
| ^~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: t/t_tagged_if.v:124:33: syntax error, unexpected ')', expecting '.' or tagged or .*
124 | if (v matches tagged Invalid)
| ^
%Error: t/t_tagged_if.v:131:9: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
131 | v = tagged Valid (42);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:133:32: Unsupported: '{} tagged patterns
133 | if (v matches tagged Valid .n)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:133:19: Unsupported: '{} tagged patterns
133 | if (v matches tagged Valid .n)
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:133:11: Unsupported: matches operator
133 | if (v matches tagged Valid .n)
| ^~~~~~~
%Error: t/t_tagged_if.v:140:9: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
140 | v = tagged Valid (100);
| ^~~~~~
%Error: t/t_tagged_if.v:142:33: syntax error, unexpected ')', expecting '.' or tagged or .*
142 | if (v matches tagged Invalid)
| ^
%Error: t/t_tagged_if.v:149:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
149 | wt = tagged Wide60 (60'hFEDCBA987654321);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:151:34: Unsupported: '{} tagged patterns
151 | if (wt matches tagged Wide60 .w)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:151:20: Unsupported: '{} tagged patterns
151 | if (wt matches tagged Wide60 .w)
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:151:12: Unsupported: matches operator
151 | if (wt matches tagged Wide60 .w)
| ^~~~~~~
%Error: t/t_tagged_if.v:158:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
158 | wt = tagged Wide90 (90'hDE_ADBEEFCA_FEBABE12_3456);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:160:34: Unsupported: '{} tagged patterns
160 | if (wt matches tagged Wide90 .w)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:160:20: Unsupported: '{} tagged patterns
160 | if (wt matches tagged Wide90 .w)
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:160:12: Unsupported: matches operator
160 | if (wt matches tagged Wide90 .w)
| ^~~~~~~
%Error: t/t_tagged_if.v:167:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
167 | wt = tagged Byte8NonZeroLSB (8'hA5);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:169:43: Unsupported: '{} tagged patterns
169 | if (wt matches tagged Byte8NonZeroLSB .b)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:169:20: Unsupported: '{} tagged patterns
169 | if (wt matches tagged Byte8NonZeroLSB .b)
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:169:12: Unsupported: matches operator
169 | if (wt matches tagged Byte8NonZeroLSB .b)
| ^~~~~~~
%Error: t/t_tagged_if.v:176:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
176 | wt = tagged Word32LittleEndian (32'hDEADBEEF);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:178:46: Unsupported: '{} tagged patterns
178 | if (wt matches tagged Word32LittleEndian .w)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:178:20: Unsupported: '{} tagged patterns
178 | if (wt matches tagged Word32LittleEndian .w)
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:178:12: Unsupported: matches operator
178 | if (wt matches tagged Word32LittleEndian .w)
| ^~~~~~~
%Error: t/t_tagged_if.v:185:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
185 | at = tagged Arr '{10, 20, 30, 40};
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:187:31: Unsupported: '{} tagged patterns
187 | if (at matches tagged Arr .a)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:187:20: Unsupported: '{} tagged patterns
187 | if (at matches tagged Arr .a)
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:187:12: Unsupported: matches operator
187 | if (at matches tagged Arr .a)
| ^~~~~~~
%Error: t/t_tagged_if.v:194:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
194 | at = tagged Scalar (999);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_if.v:196:34: Unsupported: '{} tagged patterns
196 | if (at matches tagged Scalar .s)
| ^
%Error-UNSUPPORTED: t/t_tagged_if.v:226:35: Unsupported: &&& expression
226 | if (v matches tagged Valid .n &&& (n > 50))
| ^~~
%Error-UNSUPPORTED: t/t_tagged_if.v:235:35: Unsupported: &&& expression
235 | if (v matches tagged Valid .n &&& (n > 50))
| ^~~
%Error-UNSUPPORTED: t/t_tagged_if.v:264:37: Unsupported: &&& expression
264 | if (instr matches tagged Jmp .j &&&
| ^~~
%Error: Exiting due to

View File

@ -4,6 +4,8 @@
// any use, without warranty, 2024 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// verilator lint_off SHORTREAL
// Test if pattern matching with tagged unions
// IEEE 1800-2023 Section 12.6.2

View File

@ -1,158 +1,152 @@
%Error-UNSUPPORTED: t/t_tagged_union.v:24:17: Unsupported: tagged union
24 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:27:5: Unsupported: void (for tagged unions)
27 | void Invalid;
| ^~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_tagged_union.v:25:5: Unsupported: void (for tagged unions)
25 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:34:5: Unsupported: void (for tagged unions)
34 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:31:17: Unsupported: tagged union
31 | typedef union tagged packed {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:32:5: Unsupported: void (for tagged unions)
32 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:55:5: Unsupported: void (for tagged unions)
55 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:52:17: Unsupported: tagged union
52 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:53:5: Unsupported: void (for tagged unions)
53 | void Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:77:5: Unsupported: void (for tagged unions)
77 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:60:17: Unsupported: tagged union
60 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:64:11: Unsupported: tagged union
64 | union tagged {
%Error-UNSUPPORTED: t/t_tagged_union.v:83:5: Unsupported: void (for tagged unions)
83 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:92:5: Unsupported: void (for tagged unions)
92 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:99:5: Unsupported: void (for tagged unions)
99 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:105:5: Unsupported: void (for tagged unions)
105 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:114:5: Unsupported: void (for tagged unions)
114 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:135:11: Unsupported: tagged union
135 | vi1 = tagged Invalid;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:74:17: Unsupported: tagged union
74 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:75:5: Unsupported: void (for tagged unions)
75 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:80:17: Unsupported: tagged union
80 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:81:5: Unsupported: void (for tagged unions)
81 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:89:17: Unsupported: tagged union
89 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:90:5: Unsupported: void (for tagged unions)
90 | void Invalid;
| ^~~~
%Warning-SHORTREAL: t/t_tagged_union.v:92:5: Unsupported: shortreal being promoted to real (suggest use real instead)
92 | shortreal ShortRealVal;
| ^~~~~~~~~
... For warning description see https://verilator.org/warn/SHORTREAL?v=latest
... Use "/* verilator lint_off SHORTREAL */" and lint_on around source to disable this message.
%Error-UNSUPPORTED: t/t_tagged_union.v:96:17: Unsupported: tagged union
96 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:97:5: Unsupported: void (for tagged unions)
97 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:102:17: Unsupported: tagged union
102 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:103:5: Unsupported: void (for tagged unions)
103 | void Invalid;
| ^~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:111:17: Unsupported: tagged union
111 | typedef union tagged {
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:112:5: Unsupported: void (for tagged unions)
112 | void Invalid;
| ^~~~
%Error: t/t_tagged_union.v:133:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
133 | vi1 = tagged Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:136:11: Unsupported: tagged union
136 | vi2 = tagged Invalid;
| ^~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: t/t_tagged_union.v:134:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
134 | vi2 = tagged Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:139:11: Unsupported: tagged union
139 | vi1 = tagged Valid (42);
| ^~~~~~
%Error: t/t_tagged_union.v:137:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
137 | vi1 = tagged Valid (42);
%Error-UNSUPPORTED: t/t_tagged_union.v:142:11: Unsupported: tagged union
142 | vi2 = tagged Valid (23 + 34);
| ^~~~~~
%Error: t/t_tagged_union.v:140:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
140 | vi2 = tagged Valid (23 + 34);
| ^~~~~~
%Error: t/t_tagged_union.v:144:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
144 | mt = tagged Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:146:10: Unsupported: tagged union
146 | mt = tagged Invalid;
| ^~~~~~
%Error: t/t_tagged_union.v:146:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
146 | mt = tagged IntVal (32'h12345678);
%Error-UNSUPPORTED: t/t_tagged_union.v:148:10: Unsupported: tagged union
148 | mt = tagged IntVal (32'h12345678);
| ^~~~~~
%Error: t/t_tagged_union.v:149:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
149 | mt = tagged ShortVal (16'hABCD);
%Error-UNSUPPORTED: t/t_tagged_union.v:151:10: Unsupported: tagged union
151 | mt = tagged ShortVal (16'hABCD);
| ^~~~~~
%Error: t/t_tagged_union.v:152:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
152 | mt = tagged ByteVal (8'h5A);
%Error-UNSUPPORTED: t/t_tagged_union.v:154:10: Unsupported: tagged union
154 | mt = tagged ByteVal (8'h5A);
| ^~~~~~
%Error: t/t_tagged_union.v:155:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
155 | mt = tagged BitVal (1'b1);
%Error-UNSUPPORTED: t/t_tagged_union.v:157:10: Unsupported: tagged union
157 | mt = tagged BitVal (1'b1);
| ^~~~~~
%Error: t/t_tagged_union.v:159:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
159 | mt = tagged Byte8NonZeroLSB (8'hA5);
%Error-UNSUPPORTED: t/t_tagged_union.v:161:10: Unsupported: tagged union
161 | mt = tagged Byte8NonZeroLSB (8'hA5);
| ^~~~~~
%Error: t/t_tagged_union.v:162:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
162 | mt = tagged Word16NonZeroLSB (16'h1234);
%Error-UNSUPPORTED: t/t_tagged_union.v:164:10: Unsupported: tagged union
164 | mt = tagged Word16NonZeroLSB (16'h1234);
| ^~~~~~
%Error: t/t_tagged_union.v:166:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
166 | mt = tagged Word32LittleEndian (32'hDEADBEEF);
%Error-UNSUPPORTED: t/t_tagged_union.v:168:10: Unsupported: tagged union
168 | mt = tagged Word32LittleEndian (32'hDEADBEEF);
| ^~~~~~
%Error: t/t_tagged_union.v:169:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
169 | mt = tagged Word16LittleEndian (16'hCAFE);
%Error-UNSUPPORTED: t/t_tagged_union.v:171:10: Unsupported: tagged union
171 | mt = tagged Word16LittleEndian (16'hCAFE);
| ^~~~~~
%Error: t/t_tagged_union.v:173:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
173 | mt = tagged Wide60 (60'hFEDCBA987654321);
%Error-UNSUPPORTED: t/t_tagged_union.v:175:10: Unsupported: tagged union
175 | mt = tagged Wide60 (60'hFEDCBA987654321);
| ^~~~~~
%Error: t/t_tagged_union.v:176:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
176 | mt = tagged Wide60NonZeroLSB (60'h123456789ABCDEF);
%Error-UNSUPPORTED: t/t_tagged_union.v:178:10: Unsupported: tagged union
178 | mt = tagged Wide60NonZeroLSB (60'h123456789ABCDEF);
| ^~~~~~
%Error: t/t_tagged_union.v:179:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
179 | mt = tagged Wide60LittleEndian (60'hABCDEF012345678);
%Error-UNSUPPORTED: t/t_tagged_union.v:181:10: Unsupported: tagged union
181 | mt = tagged Wide60LittleEndian (60'hABCDEF012345678);
| ^~~~~~
%Error: t/t_tagged_union.v:183:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
183 | mt = tagged Wide90 (90'hFF_FFFFFFFF_FFFFFFFF_FFFF);
%Error-UNSUPPORTED: t/t_tagged_union.v:185:10: Unsupported: tagged union
185 | mt = tagged Wide90 (90'hFF_FFFFFFFF_FFFFFFFF_FFFF);
| ^~~~~~
%Error: t/t_tagged_union.v:186:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
186 | mt = tagged Wide90NonZeroLSB (90'hDE_ADBEEFCA_FEBABE12_3456);
%Error-UNSUPPORTED: t/t_tagged_union.v:188:10: Unsupported: tagged union
188 | mt = tagged Wide90NonZeroLSB (90'hDE_ADBEEFCA_FEBABE12_3456);
| ^~~~~~
%Error: t/t_tagged_union.v:189:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
189 | mt = tagged Wide90LittleEndian (90'h11_11111122_22222233_3333);
%Error-UNSUPPORTED: t/t_tagged_union.v:191:10: Unsupported: tagged union
191 | mt = tagged Wide90LittleEndian (90'h11_11111122_22222233_3333);
| ^~~~~~
%Error: t/t_tagged_union.v:193:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
193 | at = tagged Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:195:10: Unsupported: tagged union
195 | at = tagged Invalid;
| ^~~~~~
%Error: t/t_tagged_union.v:195:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
195 | at = tagged Scalar (999);
%Error-UNSUPPORTED: t/t_tagged_union.v:197:10: Unsupported: tagged union
197 | at = tagged Scalar (999);
| ^~~~~~
%Error: t/t_tagged_union.v:198:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
198 | at = tagged UnpackedArr '{100, 200, 300, 400};
%Error-UNSUPPORTED: t/t_tagged_union.v:200:10: Unsupported: tagged union
200 | at = tagged UnpackedArr '{100, 200, 300, 400};
| ^~~~~~
%Error: t/t_tagged_union.v:204:10: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
204 | at = tagged UnpackedArr2D '{'{32'hA, 32'hB, 32'hC}, '{32'hD, 32'hE, 32'hF}};
%Error-UNSUPPORTED: t/t_tagged_union.v:206:10: Unsupported: tagged union
206 | at = tagged UnpackedArr2D '{'{32'hA, 32'hB, 32'hC}, '{32'hD, 32'hE, 32'hF}};
| ^~~~~~
%Error: t/t_tagged_union.v:213:13: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
213 | instr = tagged Add '{5'd1, 5'd2, 5'd3};
%Error-UNSUPPORTED: t/t_tagged_union.v:215:13: Unsupported: tagged union
215 | instr = tagged Add '{5'd1, 5'd2, 5'd3};
| ^~~~~~
%Error: t/t_tagged_union.v:219:13: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
219 | instr = tagged Add '{reg2:5'd10, regd:5'd20, reg1:5'd5};
%Error-UNSUPPORTED: t/t_tagged_union.v:221:13: Unsupported: tagged union
221 | instr = tagged Add '{reg2:5'd10, regd:5'd20, reg1:5'd5};
| ^~~~~~
%Error: t/t_tagged_union.v:225:13: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
225 | instr = tagged Jmp (tagged JmpU 10'd512);
%Error-UNSUPPORTED: t/t_tagged_union.v:227:13: Unsupported: tagged union
227 | instr = tagged Jmp (tagged JmpU 10'd512);
| ^~~~~~
%Error: t/t_tagged_union.v:229:13: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
229 | instr = tagged Jmp (tagged JmpC '{2'd1, 10'd256});
%Error-UNSUPPORTED: t/t_tagged_union.v:227:25: Unsupported: tagged union
227 | instr = tagged Jmp (tagged JmpU 10'd512);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:231:13: Unsupported: tagged union
231 | instr = tagged Jmp (tagged JmpC '{2'd1, 10'd256});
| ^~~~~~
%Error: t/t_tagged_union.v:234:13: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
234 | instr = tagged Jmp (tagged JmpC '{cc:2'd3, addr:10'd100});
%Error-UNSUPPORTED: t/t_tagged_union.v:231:25: Unsupported: tagged union
231 | instr = tagged Jmp (tagged JmpC '{2'd1, 10'd256});
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:236:13: Unsupported: tagged union
236 | instr = tagged Jmp (tagged JmpC '{cc:2'd3, addr:10'd100});
| ^~~~~~
%Error: t/t_tagged_union.v:239:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
239 | cht = tagged Invalid;
%Error-UNSUPPORTED: t/t_tagged_union.v:236:25: Unsupported: tagged union
236 | instr = tagged Jmp (tagged JmpC '{cc:2'd3, addr:10'd100});
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:241:11: Unsupported: tagged union
241 | cht = tagged Invalid;
| ^~~~~~
%Error: t/t_tagged_union.v:240:11: syntax error, unexpected tagged, expecting IDENTIFIER-for-type
240 | cht = tagged Handle (null);
%Error-UNSUPPORTED: t/t_tagged_union.v:242:11: Unsupported: tagged union
242 | cht = tagged Handle (null);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:246:11: Unsupported: tagged union
246 | clt = tagged Invalid;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:247:11: Unsupported: tagged union
247 | clt = tagged Obj (obj);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:251:10: Unsupported: tagged union
251 | rt = tagged Invalid;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:252:10: Unsupported: tagged union
252 | rt = tagged RealVal (3.14159);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:256:10: Unsupported: tagged union
256 | rt = tagged ShortRealVal (2.5);
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:260:10: Unsupported: tagged union
260 | st = tagged Invalid;
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:261:10: Unsupported: tagged union
261 | st = tagged StrVal ("hello");
| ^~~~~~
%Error-UNSUPPORTED: t/t_tagged_union.v:265:10: Unsupported: tagged union
265 | et = tagged Invalid;
| ^~~~~~
%Error: Exiting due to

View File

@ -4,6 +4,8 @@
// any use, without warranty, 2024 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// verilator lint_off SHORTREAL
// Test tagged union declaration, expressions, and member access
// IEEE 1800-2023 Sections 7.3.2, 11.9