Support $assertcontrol assertion_type (#5236)

Signed-off-by: Bartłomiej Chmiel <bchmiel@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Co-authored-by: Ryszard Rozak <rrozak@antmicro.com>
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Bartłomiej Chmiel 2024-07-10 11:06:13 +02:00 committed by GitHub
parent 2cfec0ecc3
commit 11da07d3b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 932 additions and 136 deletions

View File

@ -2494,9 +2494,24 @@ VerilatedContext::Serialized::Serialized() {
m_timeprecision = picosecond; // Initial value until overridden by _Vconfigure
}
bool VerilatedContext::assertOn() const VL_MT_SAFE {
const VerilatedLockGuard lock{m_mutex};
return m_s.m_assertOn;
}
void VerilatedContext::assertOn(bool flag) VL_MT_SAFE {
const VerilatedLockGuard lock{m_mutex};
m_s.m_assertOn = flag;
// set all assert types to 'on' when true, set all types to 'off' when false
m_s.m_assertOn = std::numeric_limits<VerilatedAssertType_t>::max()
* static_cast<VerilatedAssertType_t>(flag);
}
bool VerilatedContext::assertOnGet(VerilatedAssertType_t flags) const VL_MT_SAFE {
return m_s.m_assertOn & flags;
}
void VerilatedContext::assertOnSet(VerilatedAssertType_t flags) VL_MT_SAFE {
m_s.m_assertOn |= flags;
}
void VerilatedContext::assertOnClear(VerilatedAssertType_t flags) VL_MT_SAFE {
m_s.m_assertOn &= flags;
}
void VerilatedContext::calcUnusedSigs(bool flag) VL_MT_SAFE {
const VerilatedLockGuard lock{m_mutex};

View File

@ -55,6 +55,7 @@
#include <cstring>
#include <deque>
#include <functional>
#include <limits>
#include <map>
#include <memory>
#include <set>
@ -153,6 +154,19 @@ enum VerilatedVarFlags {
VLVF_DPI_CLAY = (1 << 10) // DPI compatible C standard layout
};
// IEEE 1800-2023 Table 20-6
enum class VerilatedAssertType : uint8_t {
ASSERT_TYPE_CONCURRENT = (1 << 0),
ASSERT_TYPE_SIMPLE_IMMEDIATE = (1 << 1),
ASSERT_TYPE_OBSERVED_DEFERRED_IMMEDIATE = (1 << 2),
ASSERT_TYPE_FINAL_DEFERRED_IMMEDIATE = (1 << 3),
ASSERT_TYPE_EXPECT = (1 << 4),
ASSERT_TYPE_UNIQUE = (1 << 5),
ASSERT_TYPE_UNIQUE0 = (1 << 6),
ASSERT_TYPE_PRIORITY = (1 << 7),
};
using VerilatedAssertType_t = std::underlying_type<VerilatedAssertType>::type;
//=============================================================================
// Utility functions
@ -360,7 +374,8 @@ protected:
// No std::strings or pointers or will serialize badly!
// Fast path
uint64_t m_time = 0; // Current $time (unscaled), 0=at zero, or legacy
bool m_assertOn = true; // Assertions are enabled
std::atomic<VerilatedAssertType_t> m_assertOn{
std::numeric_limits<VerilatedAssertType_t>::max()}; // Enabled assertion types
bool m_calcUnusedSigs = false; // Waves file on, need all signals calculated
bool m_fatalOnError = true; // Fatal on $stop/non-fatal error
bool m_fatalOnVpiError = true; // Fatal on vpi error/unsupported
@ -449,9 +464,15 @@ public:
// METHODS - User called
/// Return if assertions enabled
bool assertOn() const VL_MT_SAFE { return m_s.m_assertOn; }
/// Enable assertions
bool assertOn() const VL_MT_SAFE;
/// Enable all assertion types
void assertOn(bool flag) VL_MT_SAFE;
/// Get enabled status for given assertion types
bool assertOnGet(VerilatedAssertType_t flags) const VL_MT_SAFE;
/// Set enabled status for given assertion types
void assertOnSet(VerilatedAssertType_t flags) VL_MT_SAFE;
/// Clear enabled status for given assertion types
void assertOnClear(VerilatedAssertType_t flags) VL_MT_SAFE;
/// Return if calculating of unused signals (for traces)
bool calcUnusedSigs() const VL_MT_SAFE { return m_s.m_calcUnusedSigs; }
/// Enable calculation of unused signals (for traces)

View File

@ -20,6 +20,7 @@
#include "V3Stats.h"
#include <limits>
VL_DEFINE_DEBUG_FUNCTIONS;
//######################################################################
@ -27,12 +28,15 @@ VL_DEFINE_DEBUG_FUNCTIONS;
class AssertVisitor final : public VNVisitor {
// TYPES
enum assertType_e : uint8_t {
ASSERT_TYPE_INTRINSIC, // AstNodeAssertIntrinsinc
ASSERT_TYPE_SVA, // SVA, PSL
ASSERT_TYPE_CASE, // unique/unique0/priority case related checks
ASSERT_TYPE_IF // unique/unique0/priority if related checks
enum class DirectiveType : uint8_t {
INTRINSIC, // AstNodeAssertIntrinsinc
CASE, // unique/unique0/priority case related checks
IF, // unique/unique0/priority if related checks
ASSERT, // assert statement
COVER, // cover statement
ASSUME, // assume statement
};
using VAssertType_t = std::underlying_type<VAssertType::en>::type;
// NODE STATE/TYPES
// Cleared on netlist
// AstNode::user() -> bool. True if processed
@ -54,10 +58,9 @@ class AssertVisitor final : public VNVisitor {
bool m_inSampled = false; // True inside a sampled expression
// METHODS
static bool assertTypeOn(assertType_e assertType) {
if (assertType == ASSERT_TYPE_INTRINSIC) return true;
static bool assertTypeOn(DirectiveType type) {
if (v3Global.opt.assertOn()) return true;
if (assertType == ASSERT_TYPE_CASE && v3Global.opt.assertCaseOn()) return true;
if (type == DirectiveType::CASE && v3Global.opt.assertCaseOn()) return true;
return false;
}
string assertDisplayMessage(AstNode* nodep, const string& prefix, const string& message,
@ -72,6 +75,24 @@ class AssertVisitor final : public VNVisitor {
+ ((message != "") ? ": " : "") + message + "\n");
}
}
static bool resolveAssertType(AstAssertCtl* nodep) {
if (!nodep->assertTypesp()) {
nodep->ctlAssertTypes(std::numeric_limits<VAssertType_t>::max());
return true;
}
if (const AstConst* const assertTypesp = VN_CAST(nodep->assertTypesp(), Const)) {
nodep->ctlAssertTypes(assertTypesp->toUInt());
return true;
}
return false;
}
static bool resolveControlType(AstAssertCtl* nodep) {
if (const AstConst* const constp = VN_CAST(nodep->controlTypep(), Const)) {
nodep->ctlType(constp->toSInt());
return true;
}
return false;
}
void replaceDisplay(AstDisplay* nodep, const string& prefix) {
nodep->fmtp()->text(
assertDisplayMessage(nodep, prefix, nodep->fmtp()->text(), nodep->displayType()));
@ -112,43 +133,45 @@ class AssertVisitor final : public VNVisitor {
varrefp->classOrPackagep(v3Global.rootp()->dollarUnitPkgAddp());
return varrefp;
}
AstNode* newIfAssertOn(AstNode* nodep, assertType_e assertType) {
static AstNodeStmt* newIfAssertOn(AstNode* bodyp, DirectiveType directiveType,
VAssertType::en type = VAssertType::INTERNAL) {
// Add a internal if to check assertions are on.
// Don't make this a AND term, as it's unlikely to need to test this.
FileLine* const fl = nodep->fileline();
FileLine* const fl = bodyp->fileline();
// If assertions are off, have constant propagation rip them out later
// This allows syntax errors and such to be detected normally.
AstNodeExpr* const condp
= assertType == ASSERT_TYPE_INTRINSIC
= type == VAssertType::INTERNAL
? static_cast<AstNodeExpr*>(new AstConst{fl, AstConst::BitTrue{}})
: assertTypeOn(assertType)
? static_cast<AstNodeExpr*>(
new AstCExpr{fl, "vlSymsp->_vm_contextp__->assertOn()", 1})
: static_cast<AstNodeExpr*>(new AstConst{fl, AstConst::BitFalse{}});
AstNodeIf* const newp = new AstIf{fl, condp, nodep};
: assertTypeOn(directiveType) ? static_cast<AstNodeExpr*>(new AstCExpr{
fl, "vlSymsp->_vm_contextp__->assertOnGet("s + std::to_string(type) + ")"s, 1})
: static_cast<AstNodeExpr*>(
new AstConst{fl, AstConst::BitFalse{}});
AstNodeIf* const newp = new AstIf{fl, condp, bodyp};
newp->isBoundsCheck(true); // To avoid LATCH warning
newp->user1(true); // Don't assert/cover this if
return newp;
}
AstNode* newFireAssertUnchecked(AstNode* nodep, const string& message,
AstNodeExpr* exprsp = nullptr) {
AstNodeStmt* newFireAssertUnchecked(AstNodeStmt* nodep, const string& message,
AstNodeExpr* exprsp = nullptr) {
// Like newFireAssert() but omits the asserts-on check
AstDisplay* const dispp
= new AstDisplay{nodep->fileline(), VDisplayType::DT_ERROR, message, nullptr, nullptr};
dispp->fmtp()->timeunit(m_modp->timeunit());
AstNode* const bodysp = dispp;
AstNodeStmt* const bodysp = dispp;
replaceDisplay(dispp, "%%Error"); // Convert to standard DISPLAY format
if (exprsp) dispp->fmtp()->exprsp()->addNext(exprsp);
if (v3Global.opt.stopFail()) bodysp->addNext(new AstStop{nodep->fileline(), true});
return bodysp;
}
AstNode* newFireAssert(AstNode* nodep, assertType_e assertType, const string& message,
AstNodeExpr* exprsp = nullptr) {
AstNode* bodysp = newFireAssertUnchecked(nodep, message, exprsp);
bodysp = newIfAssertOn(bodysp, assertType);
AstNodeStmt* newFireAssert(AstNodeStmt* nodep, DirectiveType directiveType,
VAssertType::en assertType, const string& message,
AstNodeExpr* exprsp = nullptr) {
AstNodeStmt* bodysp = newFireAssertUnchecked(nodep, message, exprsp);
bodysp = newIfAssertOn(bodysp, directiveType, assertType);
return bodysp;
}
@ -191,6 +214,7 @@ class AssertVisitor final : public VNVisitor {
}
if (bodysp && passsp) bodysp = bodysp->addNext(passsp);
if (bodysp) bodysp = newIfAssertOn(bodysp, DirectiveType::COVER, nodep->type());
ifp = new AstIf{nodep->fileline(), propp, bodysp};
ifp->isBoundsCheck(true); // To avoid LATCH warning
bodysp = ifp;
@ -200,17 +224,15 @@ class AssertVisitor final : public VNVisitor {
} else {
++m_statAsNotImm;
}
const assertType_e assertType
= VN_IS(nodep, AssertIntrinsic) ? ASSERT_TYPE_INTRINSIC : ASSERT_TYPE_SVA;
if (passsp) passsp = newIfAssertOn(passsp, assertType);
if (failsp) failsp = newIfAssertOn(failsp, assertType);
if (!passsp && !failsp) failsp = newFireAssertUnchecked(nodep, "'assert' failed.");
ifp = new AstIf{nodep->fileline(), propp, passsp, failsp};
ifp->isBoundsCheck(true); // To avoid LATCH warning
// It's more LIKELY that we'll take the nullptr if clause
// than the sim-killing else clause:
ifp->branchPred(VBranchPred::BP_LIKELY);
bodysp = newIfAssertOn(ifp, assertType);
const DirectiveType directiveType
= VN_IS(nodep, AssertIntrinsic) ? DirectiveType::INTRINSIC : DirectiveType::ASSERT;
bodysp = newIfAssertOn(ifp, directiveType, nodep->type());
} else {
nodep->v3fatalSrc("Unknown node type");
}
@ -281,9 +303,13 @@ class AssertVisitor final : public VNVisitor {
= ((allow_none || hasDefaultElse)
? static_cast<AstNodeExpr*>(new AstOneHot0{nodep->fileline(), propp})
: static_cast<AstNodeExpr*>(new AstOneHot{nodep->fileline(), propp}));
AstIf* const checkifp = new AstIf{
nodep->fileline(), new AstLogNot{nodep->fileline(), ohot},
newFireAssert(nodep, ASSERT_TYPE_IF, "'unique if' statement violated"), newifp};
const VAssertType::en assertType
= nodep->uniquePragma() ? VAssertType::UNIQUE : VAssertType::UNIQUE0;
AstIf* const checkifp
= new AstIf{nodep->fileline(), new AstLogNot{nodep->fileline(), ohot},
newFireAssert(nodep, DirectiveType::IF, assertType,
"'unique if' statement violated"),
newifp};
checkifp->isBoundsCheck(true); // To avoid LATCH warning
checkifp->branchPred(VBranchPred::BP_UNLIKELY);
nodep->replaceWith(checkifp);
@ -303,6 +329,16 @@ class AssertVisitor final : public VNVisitor {
if (itemp->isDefault()) has_default = true;
}
const AstNodeDType* exprDtypep = nodep->exprp()->dtypep()->skipRefp();
VAssertType::en assertType = VAssertType::INTERNAL;
if (nodep->priorityPragma()) {
assertType = VAssertType::PRIORITY;
} else if (nodep->uniquePragma()) {
assertType = VAssertType::UNIQUE;
} else if (nodep->unique0Pragma()) {
assertType = VAssertType::UNIQUE0;
}
string valFmt;
if (exprDtypep->isIntegralOrPacked())
valFmt = " for '" + cvtToStr(exprDtypep->widthMin()) + "'h%X'";
@ -312,7 +348,7 @@ class AssertVisitor final : public VNVisitor {
if (!has_default) {
nodep->addItemsp(new AstCaseItem{
nodep->fileline(), nullptr /*DEFAULT*/,
newFireAssert(nodep, ASSERT_TYPE_CASE,
newFireAssert(nodep, DirectiveType::CASE, assertType,
nodep->pragmaString() + ", but non-match found" + valFmt,
valFmt.empty() ? nullptr
: nodep->exprp()->cloneTreePure(false))});
@ -368,11 +404,12 @@ class AssertVisitor final : public VNVisitor {
AstNodeExpr* const exprp = nodep->exprp();
const string pragmaStr = nodep->pragmaString();
if (!allow_none)
zeroIfp->addThensp(newFireAssert(
nodep, ASSERT_TYPE_CASE, pragmaStr + ", but none matched" + valFmt,
valFmt.empty() ? nullptr : exprp->cloneTreePure(false)));
zeroIfp->addThensp(
newFireAssert(nodep, DirectiveType::CASE, assertType,
pragmaStr + ", but none matched" + valFmt,
valFmt.empty() ? nullptr : exprp->cloneTreePure(false)));
zeroIfp->addElsesp(
newFireAssert(nodep, ASSERT_TYPE_CASE,
newFireAssert(nodep, DirectiveType::CASE, assertType,
pragmaStr + ", but multiple matches found" + valFmt,
valFmt.empty() ? nullptr : exprp->cloneTreePure(false)));
ohotIfp->addThensp(zeroIfp);
@ -528,24 +565,44 @@ class AssertVisitor final : public VNVisitor {
iterateChildren(nodep);
if (const AstConst* const constp = VN_CAST(nodep->controlTypep(), Const)) {
nodep->ctlType(constp->toSInt());
} else if (nodep->ctlType() == VAssertCtlType::_TO_BE_EVALUATED) {
if (!resolveAssertType(nodep)) {
nodep->v3warn(E_UNSUPPORTED,
"Unsupported: non-constant assert assertion-type expression");
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
return;
} else if (nodep->ctlAssertTypes()
& (VAssertType::EXPECT | VAssertType::UNIQUE | VAssertType::UNIQUE0
| VAssertType::PRIORITY)
&& !(nodep->ctlAssertTypes() == std::numeric_limits<VAssertType_t>::max())) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: assert control assertion_type");
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
return;
}
if (!resolveControlType(nodep)) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: non-const assert control type expression");
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
return;
}
FileLine* const fl = nodep->fileline();
switch (nodep->ctlType()) {
case VAssertCtlType::ON:
UINFO(9, "Generating assertctl for a module: " << m_modp << endl);
nodep->replaceWith(new AstCExpr{fl,
"vlSymsp->_vm_contextp__->assertOnSet("s
+ std::to_string(nodep->ctlAssertTypes())
+ ");\n"s,
1});
break;
case VAssertCtlType::OFF:
case VAssertCtlType::KILL: {
UINFO(9, "Generating assertctl for a module: " << m_modp << endl);
FileLine* const fl = nodep->fileline();
const string assertOnStmt
= string{"vlSymsp->_vm_contextp__->assertOn("}
+ (nodep->ctlType() == VAssertCtlType::ON ? "true" : "false") + ");\n";
nodep->replaceWith(new AstCExpr{fl, assertOnStmt, 1});
nodep->replaceWith(new AstCExpr{
fl,
"vlSymsp->_vm_contextp__->assertOnClear("s
+ std::to_string(static_cast<VAssertType_t>(~nodep->ctlAssertTypes()))
+ ");\n"s,
1});
break;
}
case VAssertCtlType::LOCK:

View File

@ -1154,6 +1154,50 @@ constexpr bool operator==(VAssertCtlType::en lhs, const VAssertCtlType& rhs) {
// ######################################################################
class VAssertType final {
public:
// IEEE 1800-2023 Table 20-6
enum en : uint8_t {
INTERNAL = 0, // Non IEEE type, for assertions that should not be controlled.
CONCURRENT = (1 << 0),
SIMPLE_IMMEDIATE = (1 << 1),
OBSERVED_DEFERRED_IMMEDIATE = (1 << 2),
FINAL_DEFERRED_IMMEDIATE = (1 << 3),
EXPECT = (1 << 4),
UNIQUE = (1 << 5),
UNIQUE0 = (1 << 6),
PRIORITY = (1 << 7),
};
enum en m_e;
VAssertType()
: m_e{INTERNAL} {}
// cppcheck-suppress noExplicitConstructor
constexpr explicit VAssertType(en _e)
: m_e{_e} {}
explicit VAssertType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
const char* ascii() const {
static const char* const names[] = {"INTERNAL",
"CONCURRENT",
"SIMPLE_IMMEDIATE",
"OBSERVED_DEFERRED_IMMEDIATE",
"FINAL_DEFERRED_IMMEDIATE",
"EXPECT",
"UNIQUE",
"UNIQUE0",
"PRIORITY"};
return names[m_e];
}
constexpr operator en() const { return m_e; }
};
constexpr bool operator==(const VAssertType& lhs, const VAssertType& rhs) {
return lhs.m_e == rhs.m_e;
}
constexpr bool operator==(const VAssertType& lhs, VAssertType::en rhs) { return lhs.m_e == rhs; }
constexpr bool operator==(VAssertType::en lhs, const VAssertType& rhs) { return lhs == rhs.m_e; }
// ######################################################################
class VCaseType final {
public:
enum en : uint8_t { CT_CASE, CT_CASEX, CT_CASEZ, CT_CASEINSIDE };

View File

@ -398,13 +398,13 @@ class AstNodeCoverOrAssert VL_NOT_FINAL : public AstNodeStmt {
// op3 used by some sub-types only
// @astgen op4 := passsp: List[AstNode] // Statements when propp is passing/truthly
string m_name; // Name to report
const bool m_immediate; // Immediate assertion/cover
const VAssertType m_type; // Assertion/cover type
public:
AstNodeCoverOrAssert(VNType t, FileLine* fl, AstNode* propp, AstNode* passsp, bool immediate,
const string& name = "")
AstNodeCoverOrAssert(VNType t, FileLine* fl, AstNode* propp, AstNode* passsp,
VAssertType::en type, const string& name = "")
: AstNodeStmt{t, fl}
, m_name{name}
, m_immediate{immediate} {
, m_type{type} {
this->propp(propp);
this->addPasssp(passsp);
}
@ -414,7 +414,13 @@ public:
void name(const string& name) override { m_name = name; }
void dump(std::ostream& str = std::cout) const override;
void dumpJson(std::ostream& str = std::cout) const override;
bool immediate() const { return m_immediate; }
VAssertType type() const { return m_type; }
bool immediate() const {
return this->type()
& (VAssertType::SIMPLE_IMMEDIATE | VAssertType::OBSERVED_DEFERRED_IMMEDIATE
| VAssertType::FINAL_DEFERRED_IMMEDIATE)
|| this->type() == VAssertType::INTERNAL;
}
};
class AstNodeFor VL_NOT_FINAL : public AstNodeStmt {
// @astgen op1 := initsp : List[AstNode]
@ -2588,16 +2594,19 @@ public:
};
class AstAssertCtl final : public AstNodeStmt {
// @astgen op1 := controlTypep : AstNodeExpr
// @astgen op2 := levelp : AstNodeExpr
// @astgen op3 := itemsp : List[AstNodeExpr]
// @astgen op2 := assertTypesp : Optional[AstNodeExpr]
// @astgen op3 := levelp : AstNodeExpr
// @astgen op4 := itemsp : List[AstNodeExpr]
// Type of assertcontrol task; either known from parser or from evaluated
// controlTypep expression.
VAssertCtlType m_ctlType; // $assert keyword type
VAssertCtlType m_ctlType; // $assert keyword type (control_type)
using VAssertType_t = std::underlying_type<VAssertType::en>::type;
VAssertType_t m_assertTypes; // Type of assertions affected
public:
AstAssertCtl(FileLine* fl, VAssertCtlType ctlType, AstNodeExpr* levelp = nullptr,
AstNodeExpr* itemsp = nullptr);
AstAssertCtl(FileLine* fl, AstNodeExpr* controlTypep, AstNodeExpr* assertionTypep = nullptr,
AstAssertCtl(FileLine* fl, AstNodeExpr* controlTypep, AstNodeExpr* assertTypesp = nullptr,
AstNodeExpr* directiveTypep = nullptr, AstNodeExpr* levelp = nullptr,
AstNodeExpr* itemsp = nullptr);
ASTGEN_MEMBERS_AstAssertCtl;
@ -2608,6 +2617,8 @@ public:
bool isOutputter() override { return true; }
VAssertCtlType ctlType() const { return m_ctlType; }
void ctlType(int32_t type) { m_ctlType = VAssertCtlType{type}; }
VAssertType_t ctlAssertTypes() const { return m_assertTypes; }
void ctlAssertTypes(VAssertType_t types) { m_assertTypes = types; }
void dump(std::ostream& str = std::cout) const override;
void dumpJson(std::ostream& str = std::cout) const override;
};
@ -3619,11 +3630,12 @@ public:
// === AstNodeCoverOrAssert ===
class AstAssert final : public AstNodeCoverOrAssert {
// @astgen op3 := failsp: List[AstNode] // Statements when propp is failing/falsey
public:
ASTGEN_MEMBERS_AstAssert;
AstAssert(FileLine* fl, AstNode* propp, AstNode* passsp, AstNode* failsp, bool immediate,
AstAssert(FileLine* fl, AstNode* propp, AstNode* passsp, AstNode* failsp, VAssertType::en type,
const string& name = "")
: ASTGEN_SUPER_Assert(fl, propp, passsp, immediate, name) {
: ASTGEN_SUPER_Assert(fl, propp, passsp, type, name) {
this->addFailsp(failsp);
}
};
@ -3633,8 +3645,9 @@ class AstAssertIntrinsic final : public AstNodeCoverOrAssert {
public:
ASTGEN_MEMBERS_AstAssertIntrinsic;
AstAssertIntrinsic(FileLine* fl, AstNode* propp, AstNode* passsp, AstNode* failsp,
bool immediate, const string& name = "")
: ASTGEN_SUPER_AssertIntrinsic(fl, propp, passsp, immediate, name) {
const string& name = "")
// Intrinsic asserts are always enabled thus 'type' field is set to INTERNAL.
: ASTGEN_SUPER_AssertIntrinsic(fl, propp, passsp, VAssertType::INTERNAL, name) {
this->addFailsp(failsp);
}
};
@ -3642,16 +3655,16 @@ class AstCover final : public AstNodeCoverOrAssert {
// @astgen op3 := coverincsp: List[AstNode] // Coverage node
public:
ASTGEN_MEMBERS_AstCover;
AstCover(FileLine* fl, AstNode* propp, AstNode* stmtsp, bool immediate,
AstCover(FileLine* fl, AstNode* propp, AstNode* stmtsp, VAssertType::en type,
const string& name = "")
: ASTGEN_SUPER_Cover(fl, propp, stmtsp, immediate, name) {}
virtual bool immediate() const { return false; }
: ASTGEN_SUPER_Cover(fl, propp, stmtsp, type, name) {}
};
class AstRestrict final : public AstNodeCoverOrAssert {
public:
ASTGEN_MEMBERS_AstRestrict;
AstRestrict(FileLine* fl, AstNode* propp)
: ASTGEN_SUPER_Restrict(fl, propp, nullptr, false, "") {}
// Intrinsic asserts are always ignored thus 'type' field is set to INTERNAL.
: ASTGEN_SUPER_Restrict(fl, propp, nullptr, VAssertType::INTERNAL) {}
};
// === AstNodeFor ===

View File

@ -1473,11 +1473,13 @@ AstAssertCtl::AstAssertCtl(FileLine* fl, VAssertCtlType ctlType, AstNodeExpr* le
this->levelp(levelp);
addItemsp(itemsp);
}
AstAssertCtl::AstAssertCtl(FileLine* fl, AstNodeExpr* controlTypep, AstNodeExpr*, AstNodeExpr*,
AstNodeExpr* levelp, AstNodeExpr* itemsp)
AstAssertCtl::AstAssertCtl(FileLine* fl, AstNodeExpr* controlTypep, AstNodeExpr* assertTypesp,
AstNodeExpr*, AstNodeExpr* levelp, AstNodeExpr* itemsp)
: ASTGEN_SUPER_AssertCtl(fl)
, m_ctlType{VAssertCtlType::_TO_BE_EVALUATED} {
, m_ctlType{VAssertCtlType::_TO_BE_EVALUATED}
, m_assertTypes{VAssertType::INTERNAL} {
this->controlTypep(controlTypep);
this->assertTypesp(assertTypesp);
if (!levelp) levelp = new AstConst{fl, 0};
this->levelp(levelp);
addItemsp(itemsp);
@ -1639,10 +1641,10 @@ string AstClassRefDType::prettyDTypeName(bool) const { return "class{}"s + prett
string AstClassRefDType::name() const { return classp() ? classp()->name() : "<unlinked>"; }
void AstNodeCoverOrAssert::dump(std::ostream& str) const {
this->AstNodeStmt::dump(str);
if (immediate()) str << " [IMMEDIATE]";
str << " ["s + this->type().ascii() + "]";
}
void AstNodeCoverOrAssert::dumpJson(std::ostream& str) const {
dumpJsonBoolFunc(str, immediate);
dumpJsonStr(str, "type", "["s + this->type().ascii() + "]");
dumpJsonGen(str);
}
void AstClocking::dump(std::ostream& str) const {

View File

@ -116,6 +116,7 @@ struct V3ParseBisonYYSType final {
VSigning::en signstate;
V3ErrorCode::en errcodeen;
VAttrType::en attrtypeen;
VAssertType::en asserttypeen;
VLifetime::en lifetime;
VStrength::en strength;

View File

@ -5462,6 +5462,10 @@ class WidthVisitor final : public VNVisitor {
userIterateAndNext(nodep->passsp(), nullptr);
userIterateAndNext(nodep->failsp(), nullptr);
}
void visit(AstAssertCtl* nodep) override {
assertAtStatement(nodep);
userIterateChildren(nodep, WidthVP{SELF, BOTH}.p());
}
void visit(AstAssertIntrinsic* nodep) override {
assertAtStatement(nodep);
iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition.

View File

@ -4269,7 +4269,7 @@ system_t_call<nodeStmtp>: // IEEE: system_tf_call (as task)
{ FileLine* const fl_nowarn = new FileLine{$1};
fl_nowarn->warnOff(V3ErrorCode::WIDTH, true);
$$ = new AstAssertIntrinsic{fl_nowarn, new AstCastDynamic{fl_nowarn, $5, $3},
nullptr, nullptr, true}; }
nullptr, nullptr}; }
//
// Any system function as a task
| system_f_call_or_t { $$ = new AstSysFuncAsTask{$<fl>1, $1}; }
@ -6002,13 +6002,13 @@ immediate_assertion_statement<nodep>: // ==IEEE: immediate_assertion_statement
simple_immediate_assertion_statement<nodep>: // ==IEEE: simple_immediate_assertion_statement
// // action_block expanded here, for compatibility with AstAssert
assertOrAssume '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE
{ $$ = new AstAssert{$1, $3, $5, nullptr, true}; }
{ $$ = new AstAssert{$1, $3, $5, nullptr, VAssertType::SIMPLE_IMMEDIATE}; }
| assertOrAssume '(' expr ')' yELSE stmtBlock
{ $$ = new AstAssert{$1, $3, nullptr, $6, true}; }
{ $$ = new AstAssert{$1, $3, nullptr, $6, VAssertType::SIMPLE_IMMEDIATE}; }
| assertOrAssume '(' expr ')' stmtBlock yELSE stmtBlock
{ $$ = new AstAssert{$1, $3, $5, $7, true}; }
{ $$ = new AstAssert{$1, $3, $5, $7, VAssertType::SIMPLE_IMMEDIATE}; }
// // IEEE: simple_immediate_cover_statement
| yCOVER '(' expr ')' stmt { $$ = new AstCover{$1, $3, $5, true}; }
| yCOVER '(' expr ')' stmt { $$ = new AstCover{$1, $3, $5, VAssertType::SIMPLE_IMMEDIATE}; }
;
assertOrAssume<fl>:
@ -6016,23 +6016,24 @@ assertOrAssume<fl>:
| yASSUME { $$ = $1; }
;
final_zero: // IEEE: part of deferred_immediate_assertion_statement
final_zero<asserttypeen>: // IEEE: part of deferred_immediate_assertion_statement
'#' yaINTNUM
{ if ($2->isNeqZero()) { $<fl>2->v3error("Deferred assertions must use '#0' (IEEE 1800-2023 16.4)"); } }
{ if ($2->isNeqZero()) { $<fl>2->v3error("Deferred assertions must use '#0' (IEEE 1800-2023 16.4)"); }
$$ = VAssertType::OBSERVED_DEFERRED_IMMEDIATE; }
// // 1800-2012:
| yFINAL { }
| yFINAL { $$ = VAssertType::FINAL_DEFERRED_IMMEDIATE; }
;
deferred_immediate_assertion_statement<nodep>: // ==IEEE: deferred_immediate_assertion_statement
// // IEEE: deferred_immediate_assert_statement
assertOrAssume final_zero '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE
{ $$ = new AstAssert{$1, $4, $6, nullptr, true}; }
{ $$ = new AstAssert{$1, $4, $6, nullptr, $2}; }
| assertOrAssume final_zero '(' expr ')' yELSE stmtBlock
{ $$ = new AstAssert{$1, $4, nullptr, $7, true}; }
{ $$ = new AstAssert{$1, $4, nullptr, $7, $2}; }
| assertOrAssume final_zero '(' expr ')' stmtBlock yELSE stmtBlock
{ $$ = new AstAssert{$1, $4, $6, $8, true}; }
{ $$ = new AstAssert{$1, $4, $6, $8, $2}; }
// // IEEE: deferred_immediate_cover_statement
| yCOVER final_zero '(' expr ')' stmt { $$ = new AstCover{$1, $4, $6, true}; }
| yCOVER final_zero '(' expr ')' stmt { $$ = new AstCover{$1, $4, $6, $2}; }
;
concurrent_assertion_item<nodep>: // IEEE: concurrent_assertion_item
@ -6048,14 +6049,14 @@ concurrent_assertion_statement<nodep>: // ==IEEE: concurrent_assertion_statemen
// // IEEE: assume_property_statement
// // action_block expanded here
assertOrAssume yPROPERTY '(' property_spec ')' stmt %prec prLOWER_THAN_ELSE
{ $$ = new AstAssert{$1, new AstSampled{$1, $4}, $6, nullptr, false}; }
{ $$ = new AstAssert{$1, new AstSampled{$1, $4}, $6, nullptr, VAssertType::CONCURRENT}; }
| assertOrAssume yPROPERTY '(' property_spec ')' stmt yELSE stmt
{ $$ = new AstAssert{$1, new AstSampled{$1, $4}, $6, $8, false}; }
{ $$ = new AstAssert{$1, new AstSampled{$1, $4}, $6, $8, VAssertType::CONCURRENT}; }
| assertOrAssume yPROPERTY '(' property_spec ')' yELSE stmt
{ $$ = new AstAssert{$1, new AstSampled{$1, $4}, nullptr, $7, false}; }
{ $$ = new AstAssert{$1, new AstSampled{$1, $4}, nullptr, $7, VAssertType::CONCURRENT}; }
// // IEEE: cover_property_statement
| yCOVER yPROPERTY '(' property_spec ')' stmtBlock
{ $$ = new AstCover{$1, $4, $6, false}; }
{ $$ = new AstCover{$1, $4, $6, VAssertType::CONCURRENT}; }
// // IEEE: cover_sequence_statement
| yCOVER ySEQUENCE '(' sexpr ')' stmt
{ $$ = nullptr; BBUNSUP($2, "Unsupported: cover sequence"); }

View File

@ -0,0 +1,290 @@
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:45
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:45
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
-Info: t/t_assert_ctl_assertion_type.v:110: Verilog $stop, ignored due to +verilator+error+limit
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:45
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:45
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:45
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:45
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:45
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:45
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:45
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:45
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:45
Passed 'top.t.cover_simple_immediate_stmt_45' at t/t_assert_ctl_assertion_type.v:45
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:47
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:47
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:47
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:47
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:47
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:47
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:47
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:52
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:52
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:52
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:52
[0] %Error: t_assert_ctl_assertion_type.v:124: Assertion failed in top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:52
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:52
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:52
[0] %Error: t_assert_ctl_assertion_type.v:130: Assertion failed in top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:52
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:52
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:52
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:52
Passed 'top.t.cover_observed_deferred_immediate_stmt_52' at t/t_assert_ctl_assertion_type.v:52
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:54
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:54
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:54
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:54
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:54
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:54
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:54
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:59
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:59
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:59
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:59
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:59
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:59
[0] %Error: t_assert_ctl_assertion_type.v:138: Assertion failed in top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:59
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:59
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:59
[0] %Error: t_assert_ctl_assertion_type.v:144: Assertion failed in top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:59
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:59
Passed 'top.t.cover_final_deferred_immediate_stmt_59' at t/t_assert_ctl_assertion_type.v:59
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:61
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:61
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:61
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:61
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:61
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:61
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:61
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:65
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:65
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:65
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:65
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:65
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:65
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:65
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:67
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:67
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:67
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:67
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:67
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:67
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:67
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:67
[0] %Error: t_assert_ctl_assertion_type.v:124: Assertion failed in top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:67
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:67
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:67
[0] %Error: t_assert_ctl_assertion_type.v:130: Assertion failed in top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:67
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:67
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:67
[0] %Error: t_assert_ctl_assertion_type.v:138: Assertion failed in top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:67
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:67
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:67
[0] %Error: t_assert_ctl_assertion_type.v:144: Assertion failed in top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:67
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:67
Passed 'top.t.cover_simple_immediate_stmt_67' at t/t_assert_ctl_assertion_type.v:67
Passed 'top.t.cover_observed_deferred_immediate_stmt_67' at t/t_assert_ctl_assertion_type.v:67
Passed 'top.t.cover_final_deferred_immediate_stmt_67' at t/t_assert_ctl_assertion_type.v:67
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:69
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:69
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:69
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:69
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:69
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:69
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:69
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:72
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:72
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:72
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:72
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:72
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:72
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:72
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:72
[0] %Error: t_assert_ctl_assertion_type.v:124: Assertion failed in top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:72
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:72
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:72
[0] %Error: t_assert_ctl_assertion_type.v:130: Assertion failed in top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:72
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:72
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:72
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:72
Passed 'top.t.cover_simple_immediate_stmt_72' at t/t_assert_ctl_assertion_type.v:72
Passed 'top.t.cover_observed_deferred_immediate_stmt_72' at t/t_assert_ctl_assertion_type.v:72
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:74
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:74
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:74
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:74
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:74
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:74
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:74
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:74
[0] %Error: t_assert_ctl_assertion_type.v:124: Assertion failed in top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:74
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:74
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:74
[0] %Error: t_assert_ctl_assertion_type.v:130: Assertion failed in top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:74
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:74
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:74
[0] %Error: t_assert_ctl_assertion_type.v:138: Assertion failed in top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:74
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:74
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:74
[0] %Error: t_assert_ctl_assertion_type.v:144: Assertion failed in top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:74
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:74
Passed 'top.t.cover_simple_immediate_stmt_74' at t/t_assert_ctl_assertion_type.v:74
Passed 'top.t.cover_observed_deferred_immediate_stmt_74' at t/t_assert_ctl_assertion_type.v:74
Passed 'top.t.cover_final_deferred_immediate_stmt_74' at t/t_assert_ctl_assertion_type.v:74
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:76
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:76
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:76
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:76
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:76
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:76
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:76
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:76
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:76
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:76
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:76
Passed 'top.t.cover_simple_immediate_stmt_76' at t/t_assert_ctl_assertion_type.v:76
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:78
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:78
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:78
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:78
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:78
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:78
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:78
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:78
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:78
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:78
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:78
Passed 'top.t.cover_simple_immediate_stmt_78' at t/t_assert_ctl_assertion_type.v:78
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:80
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:80
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:80
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:80
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:80
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:80
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:80
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:82
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:82
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:82
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:82
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:82
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:82
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:82
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:82
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:82
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:82
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:82
Passed 'top.t.cover_simple_immediate_stmt_82' at t/t_assert_ctl_assertion_type.v:82
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:84
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:84
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:84
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:84
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:84
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:84
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:84
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:86
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:86
[0] %Error: t_assert_ctl_assertion_type.v:110: Assertion failed in top.$unit.run_simple_immediate.assert_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:86
Failed 'top.$unit.run_simple_immediate.assert_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:86
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:86
[0] %Error: t_assert_ctl_assertion_type.v:116: Assertion failed in top.$unit.run_simple_immediate.assume_simple_immediate: 'assert' failed.
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_else' at t/t_assert_ctl_assertion_type.v:86
Failed 'top.$unit.run_simple_immediate.assume_simple_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:86
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:86
[0] %Error: t_assert_ctl_assertion_type.v:124: Assertion failed in top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:86
Failed 'top.$unit.run_observed_deferred_immediate.assert_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:86
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:86
[0] %Error: t_assert_ctl_assertion_type.v:130: Assertion failed in top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:86
Failed 'top.$unit.run_observed_deferred_immediate.assume_observed_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:86
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:86
[0] %Error: t_assert_ctl_assertion_type.v:138: Assertion failed in top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:86
Failed 'top.$unit.run_final_deferred_immediate.assert_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:86
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:86
[0] %Error: t_assert_ctl_assertion_type.v:144: Assertion failed in top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate: 'assert' failed.
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_else' at t/t_assert_ctl_assertion_type.v:86
Failed 'top.$unit.run_final_deferred_immediate.assume_final_deferred_immediate_stmt_else' at t/t_assert_ctl_assertion_type.v:86
Passed 'top.t.cover_simple_immediate_stmt_86' at t/t_assert_ctl_assertion_type.v:86
Passed 'top.t.cover_observed_deferred_immediate_stmt_86' at t/t_assert_ctl_assertion_type.v:86
Passed 'top.t.cover_final_deferred_immediate_stmt_86' at t/t_assert_ctl_assertion_type.v:86
==========
Running all asserts at: t/t_assert_ctl_assertion_type.v:88
==========
Testing assert_simple_immediate at t/t_assert_ctl_assertion_type.v:88
Testing assume_simple_immediate at t/t_assert_ctl_assertion_type.v:88
Testing assert_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:88
Testing assume_observed_deferred_immediate at t/t_assert_ctl_assertion_type.v:88
Testing assert_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:88
Testing assume_final_deferred_immediate at t/t_assert_ctl_assertion_type.v:88
Disabling concurrent asserts, time: 10
Enabling concurrent asserts, time: 20
[20] %Error: t_assert_ctl_assertion_type.v:155: Assertion failed in top.t.concurrent.assert_concurrent: 'assert' failed.
Failed 'top.t.concurrent.assert_concurrent_else' at t/t_assert_ctl_assertion_type.v:156
Failed 'top.t.concurrent.assert_concurrent_stmt_else' at t/t_assert_ctl_assertion_type.v:158
[20] %Error: t_assert_ctl_assertion_type.v:160: Assertion failed in top.t.concurrent.assume_concurrent: 'assert' failed.
Failed 'top.t.concurrent.assume_concurrent_else' at t/t_assert_ctl_assertion_type.v:161
Failed 'top.t.concurrent.assume_concurrent_stmt_else' at t/t_assert_ctl_assertion_type.v:163

View File

@ -0,0 +1,26 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vlt => 1);
compile(
verilator_flags2 => ['--assert --timing --coverage-user'],
nc_flags2 => ["+nccovoverwrite +nccoverage+all +nccovtest+$Self->{name}"]
);
execute(
all_run_flags => ["+verilator+error+limit+100"],
expect_filename => $Self->{golden_filename},
);
files_identical($Self->{coverage_filename}, "t/t_assert_ctl_assertion_type_coverage.out");
ok(1);
1;

View File

@ -0,0 +1,167 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2024 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
`define DISPLAY_PASS(file, line) \
$display("Passed '%m' at %s:%g", file, line)
`define DISPLAY_FAIL(file, line) \
$display("Failed '%m' at %s:%g", file, line)
`define RUN_ALL_ASSERTS \
$display("==========\nRunning all asserts at: %s:%g\n==========", `__FILE__, `__LINE__); \
run_all_asserts(`__FILE__, `__LINE__); \
cover_simple_immediate_`__LINE__: cover(1); \
cover_simple_immediate_stmt_`__LINE__: cover(1) `DISPLAY_PASS(`__FILE__, `__LINE__); \
cover_observed_deferred_immediate_`__LINE__: cover #0 (1); \
cover_observed_deferred_immediate_stmt_`__LINE__: cover #0 (1) `DISPLAY_PASS(`__FILE__, `__LINE__); \
cover_final_deferred_immediate_`__LINE__: cover final (1); \
cover_final_deferred_immediate_stmt_`__LINE__: cover final (1) `DISPLAY_PASS(`__FILE__, `__LINE__); \
module t (/*AUTOARG*/
clk
);
input clk;
let ON = 3;
let OFF = 4;
let KILL = 5;
let CONCURRENT = 1;
let SIMPLE_IMMEDIATE = 2;
let OBSERVED_DEFERRED_IMMEDIATE = 4;
let FINAL_DEFERRED_IMMEDIATE = 8;
let ALL = CONCURRENT|SIMPLE_IMMEDIATE|OBSERVED_DEFERRED_IMMEDIATE|FINAL_DEFERRED_IMMEDIATE;
concurrent concurrent(.clk(clk));
initial begin
// simple immediate
$assertcontrol(OFF, ALL);
$assertcontrol(ON, SIMPLE_IMMEDIATE);
`RUN_ALL_ASSERTS
$assertcontrol(OFF, SIMPLE_IMMEDIATE);
`RUN_ALL_ASSERTS
// observed deferred immediate
$assertcontrol(OFF, ALL);
$assertcontrol(ON, OBSERVED_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS
$assertcontrol(OFF, OBSERVED_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS
// final deferred immediate
$assertcontrol(OFF, ALL);
$assertcontrol(ON, FINAL_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS
$assertcontrol(OFF, FINAL_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS
// on, off, kill test
$assertoff;
`RUN_ALL_ASSERTS;
$asserton;
`RUN_ALL_ASSERTS;
$assertkill;
`RUN_ALL_ASSERTS;
$assertcontrol(ON, SIMPLE_IMMEDIATE|OBSERVED_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS;
$assertcontrol(ON, FINAL_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS;
$assertcontrol(OFF, OBSERVED_DEFERRED_IMMEDIATE|FINAL_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS;
$assertcontrol(OFF, FINAL_DEFERRED_IMMEDIATE);
`RUN_ALL_ASSERTS;
$assertcontrol(OFF, SIMPLE_IMMEDIATE);
`RUN_ALL_ASSERTS;
$assertcontrol(ON, SIMPLE_IMMEDIATE);
`RUN_ALL_ASSERTS;
$assertcontrol(OFF, ALL);
`RUN_ALL_ASSERTS;
$assertcontrol(ON, ALL);
`RUN_ALL_ASSERTS;
$assertcontrol(KILL, ALL);
`RUN_ALL_ASSERTS;
// concurrent test
#10;
$display("Disabling concurrent asserts, time: %g", $time);
$assertcontrol(ON, ALL);
$assertcontrol(OFF, CONCURRENT);
#10;
$display("Enabling concurrent asserts, time: %g", $time);
$assertcontrol(ON, CONCURRENT);
$finish;
end
endmodule
task run_all_asserts(string file, integer line);
run_simple_immediate(file, line);
run_observed_deferred_immediate(file, line);
run_final_deferred_immediate(file, line);
endtask
task run_simple_immediate(string file, integer line);
$display("Testing assert_simple_immediate at %s:%g", file, line);
assert_simple_immediate: assert(0);
assert_simple_immediate_else: assert(0) else `DISPLAY_FAIL(file, line);
assert_simple_immediate_stmt: assert(0) `DISPLAY_PASS(file, line);
assert_simple_immediate_stmt_else: assert(0) `DISPLAY_PASS(file, line); else `DISPLAY_FAIL(file, line);
$display("Testing assume_simple_immediate at %s:%g", file, line);
assume_simple_immediate: assume(0);
assume_simple_immediate_else: assume(0) else `DISPLAY_FAIL(file, line);
assume_simple_immediate_stmt: assume(0) `DISPLAY_PASS(file, line);
assume_simple_immediate_stmt_else: assume(0) `DISPLAY_PASS(file, line); else `DISPLAY_FAIL(file, line);
endtask
task run_observed_deferred_immediate(string file, integer line);
$display("Testing assert_observed_deferred_immediate at %s:%g", file, line);
assert_observed_deferred_immediate: assert #0 (0);
assert_observed_deferred_immediate_else: assert #0 (0) else `DISPLAY_FAIL(file, line);
assert_observed_deferred_immediate_stmt: assert #0 (0) `DISPLAY_PASS(file, line);
assert_observed_deferred_immediate_stmt_else: assert #0 (0) `DISPLAY_PASS(file, line); else `DISPLAY_FAIL(file, line);
$display("Testing assume_observed_deferred_immediate at %s:%g", file, line);
assume_observed_deferred_immediate: assume #0 (0);
assume_observed_deferred_immediate_else: assume #0 (0) else `DISPLAY_FAIL(file, line);
assume_observed_deferred_immediate_stmt: assume #0 (0) `DISPLAY_PASS(file, line);
assume_observed_deferred_immediate_stmt_else: assume #0 (0) `DISPLAY_PASS(file, line); else `DISPLAY_FAIL(file, line);
endtask
task run_final_deferred_immediate(string file, integer line);
$display("Testing assert_final_deferred_immediate at %s:%g", file, line);
assert_final_deferred_immediate: assert final (0);
assert_final_deferred_immediate_else: assert final (0) else `DISPLAY_FAIL(file, line);
assert_final_deferred_immediate_stmt: assert final (0) `DISPLAY_PASS(file, line);
assert_final_deferred_immediate_stmt_else: assert final (0) `DISPLAY_PASS(file, line); else `DISPLAY_FAIL(file, line);
$display("Testing assume_final_deferred_immediate at %s:%g", file, line);
assume_final_deferred_immediate: assume final (0);
assume_final_deferred_immediate_else: assume final (0) else `DISPLAY_FAIL(file, line);
assume_final_deferred_immediate_stmt: assume final (0) `DISPLAY_PASS(file, line);
assume_final_deferred_immediate_stmt_else: assume final (0) `DISPLAY_PASS(file, line); else `DISPLAY_FAIL(file, line);
endtask
module concurrent(input clk);
property prop();
@(posedge clk) 0
endproperty
assert_concurrent: assert property (prop);
assert_concurrent_else: assert property(prop) else `DISPLAY_FAIL(`__FILE__, `__LINE__);
assert_concurrent_stmt: assert property(prop) `DISPLAY_PASS(`__FILE__, `__LINE__);
assert_concurrent_stmt_else: assert property(prop) `DISPLAY_PASS(`__FILE__, `__LINE__); else `DISPLAY_FAIL(`__FILE__, `__LINE__);
assume_concurrent: assume property(prop);
assume_concurrent_else: assume property(prop) else `DISPLAY_FAIL(`__FILE__, `__LINE__);
assume_concurrent_stmt: assume property(prop) `DISPLAY_PASS(`__FILE__, `__LINE__);
assume_concurrent_stmt_else: assume property(prop) `DISPLAY_PASS(`__FILE__, `__LINE__); else `DISPLAY_FAIL(`__FILE__, `__LINE__);
cover_concurrent: cover property(prop);
cover_concurrent_stmt: cover property(prop) `DISPLAY_PASS(`__FILE__, `__LINE__);
endmodule

View File

@ -0,0 +1,111 @@
# SystemC::Coverage-3
C 'ft/t_assert_ctl_assertion_type.vl165n22pagev_user/concurrentocover_concurrenthtop.t.concurrent.cover_concurrent' 0
C 'ft/t_assert_ctl_assertion_type.vl166n27pagev_user/concurrentocover_concurrent_stmthtop.t.concurrent.cover_concurrent_stmt' 0
C 'ft/t_assert_ctl_assertion_type.vl45n31pagev_user/tocover_simple_immediate_45htop.t.cover_simple_immediate_45' 1
C 'ft/t_assert_ctl_assertion_type.vl45n36pagev_user/tocover_simple_immediate_stmt_45htop.t.cover_simple_immediate_stmt_45' 1
C 'ft/t_assert_ctl_assertion_type.vl45n39pagev_user/tocover_final_deferred_immediate_45htop.t.cover_final_deferred_immediate_45' 0
C 'ft/t_assert_ctl_assertion_type.vl45n42pagev_user/tocover_observed_deferred_immediate_45htop.t.cover_observed_deferred_immediate_45' 0
C 'ft/t_assert_ctl_assertion_type.vl45n44pagev_user/tocover_final_deferred_immediate_stmt_45htop.t.cover_final_deferred_immediate_stmt_45' 0
C 'ft/t_assert_ctl_assertion_type.vl45n47pagev_user/tocover_observed_deferred_immediate_stmt_45htop.t.cover_observed_deferred_immediate_stmt_45' 0
C 'ft/t_assert_ctl_assertion_type.vl47n31pagev_user/tocover_simple_immediate_47htop.t.cover_simple_immediate_47' 0
C 'ft/t_assert_ctl_assertion_type.vl47n36pagev_user/tocover_simple_immediate_stmt_47htop.t.cover_simple_immediate_stmt_47' 0
C 'ft/t_assert_ctl_assertion_type.vl47n39pagev_user/tocover_final_deferred_immediate_47htop.t.cover_final_deferred_immediate_47' 0
C 'ft/t_assert_ctl_assertion_type.vl47n42pagev_user/tocover_observed_deferred_immediate_47htop.t.cover_observed_deferred_immediate_47' 0
C 'ft/t_assert_ctl_assertion_type.vl47n44pagev_user/tocover_final_deferred_immediate_stmt_47htop.t.cover_final_deferred_immediate_stmt_47' 0
C 'ft/t_assert_ctl_assertion_type.vl47n47pagev_user/tocover_observed_deferred_immediate_stmt_47htop.t.cover_observed_deferred_immediate_stmt_47' 0
C 'ft/t_assert_ctl_assertion_type.vl52n31pagev_user/tocover_simple_immediate_52htop.t.cover_simple_immediate_52' 0
C 'ft/t_assert_ctl_assertion_type.vl52n36pagev_user/tocover_simple_immediate_stmt_52htop.t.cover_simple_immediate_stmt_52' 0
C 'ft/t_assert_ctl_assertion_type.vl52n39pagev_user/tocover_final_deferred_immediate_52htop.t.cover_final_deferred_immediate_52' 0
C 'ft/t_assert_ctl_assertion_type.vl52n42pagev_user/tocover_observed_deferred_immediate_52htop.t.cover_observed_deferred_immediate_52' 1
C 'ft/t_assert_ctl_assertion_type.vl52n44pagev_user/tocover_final_deferred_immediate_stmt_52htop.t.cover_final_deferred_immediate_stmt_52' 0
C 'ft/t_assert_ctl_assertion_type.vl52n47pagev_user/tocover_observed_deferred_immediate_stmt_52htop.t.cover_observed_deferred_immediate_stmt_52' 1
C 'ft/t_assert_ctl_assertion_type.vl54n31pagev_user/tocover_simple_immediate_54htop.t.cover_simple_immediate_54' 0
C 'ft/t_assert_ctl_assertion_type.vl54n36pagev_user/tocover_simple_immediate_stmt_54htop.t.cover_simple_immediate_stmt_54' 0
C 'ft/t_assert_ctl_assertion_type.vl54n39pagev_user/tocover_final_deferred_immediate_54htop.t.cover_final_deferred_immediate_54' 0
C 'ft/t_assert_ctl_assertion_type.vl54n42pagev_user/tocover_observed_deferred_immediate_54htop.t.cover_observed_deferred_immediate_54' 0
C 'ft/t_assert_ctl_assertion_type.vl54n44pagev_user/tocover_final_deferred_immediate_stmt_54htop.t.cover_final_deferred_immediate_stmt_54' 0
C 'ft/t_assert_ctl_assertion_type.vl54n47pagev_user/tocover_observed_deferred_immediate_stmt_54htop.t.cover_observed_deferred_immediate_stmt_54' 0
C 'ft/t_assert_ctl_assertion_type.vl59n31pagev_user/tocover_simple_immediate_59htop.t.cover_simple_immediate_59' 0
C 'ft/t_assert_ctl_assertion_type.vl59n36pagev_user/tocover_simple_immediate_stmt_59htop.t.cover_simple_immediate_stmt_59' 0
C 'ft/t_assert_ctl_assertion_type.vl59n39pagev_user/tocover_final_deferred_immediate_59htop.t.cover_final_deferred_immediate_59' 1
C 'ft/t_assert_ctl_assertion_type.vl59n42pagev_user/tocover_observed_deferred_immediate_59htop.t.cover_observed_deferred_immediate_59' 0
C 'ft/t_assert_ctl_assertion_type.vl59n44pagev_user/tocover_final_deferred_immediate_stmt_59htop.t.cover_final_deferred_immediate_stmt_59' 1
C 'ft/t_assert_ctl_assertion_type.vl59n47pagev_user/tocover_observed_deferred_immediate_stmt_59htop.t.cover_observed_deferred_immediate_stmt_59' 0
C 'ft/t_assert_ctl_assertion_type.vl61n31pagev_user/tocover_simple_immediate_61htop.t.cover_simple_immediate_61' 0
C 'ft/t_assert_ctl_assertion_type.vl61n36pagev_user/tocover_simple_immediate_stmt_61htop.t.cover_simple_immediate_stmt_61' 0
C 'ft/t_assert_ctl_assertion_type.vl61n39pagev_user/tocover_final_deferred_immediate_61htop.t.cover_final_deferred_immediate_61' 0
C 'ft/t_assert_ctl_assertion_type.vl61n42pagev_user/tocover_observed_deferred_immediate_61htop.t.cover_observed_deferred_immediate_61' 0
C 'ft/t_assert_ctl_assertion_type.vl61n44pagev_user/tocover_final_deferred_immediate_stmt_61htop.t.cover_final_deferred_immediate_stmt_61' 0
C 'ft/t_assert_ctl_assertion_type.vl61n47pagev_user/tocover_observed_deferred_immediate_stmt_61htop.t.cover_observed_deferred_immediate_stmt_61' 0
C 'ft/t_assert_ctl_assertion_type.vl65n31pagev_user/tocover_simple_immediate_65htop.t.cover_simple_immediate_65' 0
C 'ft/t_assert_ctl_assertion_type.vl65n36pagev_user/tocover_simple_immediate_stmt_65htop.t.cover_simple_immediate_stmt_65' 0
C 'ft/t_assert_ctl_assertion_type.vl65n39pagev_user/tocover_final_deferred_immediate_65htop.t.cover_final_deferred_immediate_65' 0
C 'ft/t_assert_ctl_assertion_type.vl65n42pagev_user/tocover_observed_deferred_immediate_65htop.t.cover_observed_deferred_immediate_65' 0
C 'ft/t_assert_ctl_assertion_type.vl65n44pagev_user/tocover_final_deferred_immediate_stmt_65htop.t.cover_final_deferred_immediate_stmt_65' 0
C 'ft/t_assert_ctl_assertion_type.vl65n47pagev_user/tocover_observed_deferred_immediate_stmt_65htop.t.cover_observed_deferred_immediate_stmt_65' 0
C 'ft/t_assert_ctl_assertion_type.vl67n31pagev_user/tocover_simple_immediate_67htop.t.cover_simple_immediate_67' 1
C 'ft/t_assert_ctl_assertion_type.vl67n36pagev_user/tocover_simple_immediate_stmt_67htop.t.cover_simple_immediate_stmt_67' 1
C 'ft/t_assert_ctl_assertion_type.vl67n39pagev_user/tocover_final_deferred_immediate_67htop.t.cover_final_deferred_immediate_67' 1
C 'ft/t_assert_ctl_assertion_type.vl67n42pagev_user/tocover_observed_deferred_immediate_67htop.t.cover_observed_deferred_immediate_67' 1
C 'ft/t_assert_ctl_assertion_type.vl67n44pagev_user/tocover_final_deferred_immediate_stmt_67htop.t.cover_final_deferred_immediate_stmt_67' 1
C 'ft/t_assert_ctl_assertion_type.vl67n47pagev_user/tocover_observed_deferred_immediate_stmt_67htop.t.cover_observed_deferred_immediate_stmt_67' 1
C 'ft/t_assert_ctl_assertion_type.vl69n31pagev_user/tocover_simple_immediate_69htop.t.cover_simple_immediate_69' 0
C 'ft/t_assert_ctl_assertion_type.vl69n36pagev_user/tocover_simple_immediate_stmt_69htop.t.cover_simple_immediate_stmt_69' 0
C 'ft/t_assert_ctl_assertion_type.vl69n39pagev_user/tocover_final_deferred_immediate_69htop.t.cover_final_deferred_immediate_69' 0
C 'ft/t_assert_ctl_assertion_type.vl69n42pagev_user/tocover_observed_deferred_immediate_69htop.t.cover_observed_deferred_immediate_69' 0
C 'ft/t_assert_ctl_assertion_type.vl69n44pagev_user/tocover_final_deferred_immediate_stmt_69htop.t.cover_final_deferred_immediate_stmt_69' 0
C 'ft/t_assert_ctl_assertion_type.vl69n47pagev_user/tocover_observed_deferred_immediate_stmt_69htop.t.cover_observed_deferred_immediate_stmt_69' 0
C 'ft/t_assert_ctl_assertion_type.vl72n31pagev_user/tocover_simple_immediate_72htop.t.cover_simple_immediate_72' 1
C 'ft/t_assert_ctl_assertion_type.vl72n36pagev_user/tocover_simple_immediate_stmt_72htop.t.cover_simple_immediate_stmt_72' 1
C 'ft/t_assert_ctl_assertion_type.vl72n39pagev_user/tocover_final_deferred_immediate_72htop.t.cover_final_deferred_immediate_72' 0
C 'ft/t_assert_ctl_assertion_type.vl72n42pagev_user/tocover_observed_deferred_immediate_72htop.t.cover_observed_deferred_immediate_72' 1
C 'ft/t_assert_ctl_assertion_type.vl72n44pagev_user/tocover_final_deferred_immediate_stmt_72htop.t.cover_final_deferred_immediate_stmt_72' 0
C 'ft/t_assert_ctl_assertion_type.vl72n47pagev_user/tocover_observed_deferred_immediate_stmt_72htop.t.cover_observed_deferred_immediate_stmt_72' 1
C 'ft/t_assert_ctl_assertion_type.vl74n31pagev_user/tocover_simple_immediate_74htop.t.cover_simple_immediate_74' 1
C 'ft/t_assert_ctl_assertion_type.vl74n36pagev_user/tocover_simple_immediate_stmt_74htop.t.cover_simple_immediate_stmt_74' 1
C 'ft/t_assert_ctl_assertion_type.vl74n39pagev_user/tocover_final_deferred_immediate_74htop.t.cover_final_deferred_immediate_74' 1
C 'ft/t_assert_ctl_assertion_type.vl74n42pagev_user/tocover_observed_deferred_immediate_74htop.t.cover_observed_deferred_immediate_74' 1
C 'ft/t_assert_ctl_assertion_type.vl74n44pagev_user/tocover_final_deferred_immediate_stmt_74htop.t.cover_final_deferred_immediate_stmt_74' 1
C 'ft/t_assert_ctl_assertion_type.vl74n47pagev_user/tocover_observed_deferred_immediate_stmt_74htop.t.cover_observed_deferred_immediate_stmt_74' 1
C 'ft/t_assert_ctl_assertion_type.vl76n31pagev_user/tocover_simple_immediate_76htop.t.cover_simple_immediate_76' 1
C 'ft/t_assert_ctl_assertion_type.vl76n36pagev_user/tocover_simple_immediate_stmt_76htop.t.cover_simple_immediate_stmt_76' 1
C 'ft/t_assert_ctl_assertion_type.vl76n39pagev_user/tocover_final_deferred_immediate_76htop.t.cover_final_deferred_immediate_76' 0
C 'ft/t_assert_ctl_assertion_type.vl76n42pagev_user/tocover_observed_deferred_immediate_76htop.t.cover_observed_deferred_immediate_76' 0
C 'ft/t_assert_ctl_assertion_type.vl76n44pagev_user/tocover_final_deferred_immediate_stmt_76htop.t.cover_final_deferred_immediate_stmt_76' 0
C 'ft/t_assert_ctl_assertion_type.vl76n47pagev_user/tocover_observed_deferred_immediate_stmt_76htop.t.cover_observed_deferred_immediate_stmt_76' 0
C 'ft/t_assert_ctl_assertion_type.vl78n31pagev_user/tocover_simple_immediate_78htop.t.cover_simple_immediate_78' 1
C 'ft/t_assert_ctl_assertion_type.vl78n36pagev_user/tocover_simple_immediate_stmt_78htop.t.cover_simple_immediate_stmt_78' 1
C 'ft/t_assert_ctl_assertion_type.vl78n39pagev_user/tocover_final_deferred_immediate_78htop.t.cover_final_deferred_immediate_78' 0
C 'ft/t_assert_ctl_assertion_type.vl78n42pagev_user/tocover_observed_deferred_immediate_78htop.t.cover_observed_deferred_immediate_78' 0
C 'ft/t_assert_ctl_assertion_type.vl78n44pagev_user/tocover_final_deferred_immediate_stmt_78htop.t.cover_final_deferred_immediate_stmt_78' 0
C 'ft/t_assert_ctl_assertion_type.vl78n47pagev_user/tocover_observed_deferred_immediate_stmt_78htop.t.cover_observed_deferred_immediate_stmt_78' 0
C 'ft/t_assert_ctl_assertion_type.vl80n31pagev_user/tocover_simple_immediate_80htop.t.cover_simple_immediate_80' 0
C 'ft/t_assert_ctl_assertion_type.vl80n36pagev_user/tocover_simple_immediate_stmt_80htop.t.cover_simple_immediate_stmt_80' 0
C 'ft/t_assert_ctl_assertion_type.vl80n39pagev_user/tocover_final_deferred_immediate_80htop.t.cover_final_deferred_immediate_80' 0
C 'ft/t_assert_ctl_assertion_type.vl80n42pagev_user/tocover_observed_deferred_immediate_80htop.t.cover_observed_deferred_immediate_80' 0
C 'ft/t_assert_ctl_assertion_type.vl80n44pagev_user/tocover_final_deferred_immediate_stmt_80htop.t.cover_final_deferred_immediate_stmt_80' 0
C 'ft/t_assert_ctl_assertion_type.vl80n47pagev_user/tocover_observed_deferred_immediate_stmt_80htop.t.cover_observed_deferred_immediate_stmt_80' 0
C 'ft/t_assert_ctl_assertion_type.vl82n31pagev_user/tocover_simple_immediate_82htop.t.cover_simple_immediate_82' 1
C 'ft/t_assert_ctl_assertion_type.vl82n36pagev_user/tocover_simple_immediate_stmt_82htop.t.cover_simple_immediate_stmt_82' 1
C 'ft/t_assert_ctl_assertion_type.vl82n39pagev_user/tocover_final_deferred_immediate_82htop.t.cover_final_deferred_immediate_82' 0
C 'ft/t_assert_ctl_assertion_type.vl82n42pagev_user/tocover_observed_deferred_immediate_82htop.t.cover_observed_deferred_immediate_82' 0
C 'ft/t_assert_ctl_assertion_type.vl82n44pagev_user/tocover_final_deferred_immediate_stmt_82htop.t.cover_final_deferred_immediate_stmt_82' 0
C 'ft/t_assert_ctl_assertion_type.vl82n47pagev_user/tocover_observed_deferred_immediate_stmt_82htop.t.cover_observed_deferred_immediate_stmt_82' 0
C 'ft/t_assert_ctl_assertion_type.vl84n31pagev_user/tocover_simple_immediate_84htop.t.cover_simple_immediate_84' 0
C 'ft/t_assert_ctl_assertion_type.vl84n36pagev_user/tocover_simple_immediate_stmt_84htop.t.cover_simple_immediate_stmt_84' 0
C 'ft/t_assert_ctl_assertion_type.vl84n39pagev_user/tocover_final_deferred_immediate_84htop.t.cover_final_deferred_immediate_84' 0
C 'ft/t_assert_ctl_assertion_type.vl84n42pagev_user/tocover_observed_deferred_immediate_84htop.t.cover_observed_deferred_immediate_84' 0
C 'ft/t_assert_ctl_assertion_type.vl84n44pagev_user/tocover_final_deferred_immediate_stmt_84htop.t.cover_final_deferred_immediate_stmt_84' 0
C 'ft/t_assert_ctl_assertion_type.vl84n47pagev_user/tocover_observed_deferred_immediate_stmt_84htop.t.cover_observed_deferred_immediate_stmt_84' 0
C 'ft/t_assert_ctl_assertion_type.vl86n31pagev_user/tocover_simple_immediate_86htop.t.cover_simple_immediate_86' 1
C 'ft/t_assert_ctl_assertion_type.vl86n36pagev_user/tocover_simple_immediate_stmt_86htop.t.cover_simple_immediate_stmt_86' 1
C 'ft/t_assert_ctl_assertion_type.vl86n39pagev_user/tocover_final_deferred_immediate_86htop.t.cover_final_deferred_immediate_86' 1
C 'ft/t_assert_ctl_assertion_type.vl86n42pagev_user/tocover_observed_deferred_immediate_86htop.t.cover_observed_deferred_immediate_86' 1
C 'ft/t_assert_ctl_assertion_type.vl86n44pagev_user/tocover_final_deferred_immediate_stmt_86htop.t.cover_final_deferred_immediate_stmt_86' 1
C 'ft/t_assert_ctl_assertion_type.vl86n47pagev_user/tocover_observed_deferred_immediate_stmt_86htop.t.cover_observed_deferred_immediate_stmt_86' 1
C 'ft/t_assert_ctl_assertion_type.vl88n31pagev_user/tocover_simple_immediate_88htop.t.cover_simple_immediate_88' 0
C 'ft/t_assert_ctl_assertion_type.vl88n36pagev_user/tocover_simple_immediate_stmt_88htop.t.cover_simple_immediate_stmt_88' 0
C 'ft/t_assert_ctl_assertion_type.vl88n39pagev_user/tocover_final_deferred_immediate_88htop.t.cover_final_deferred_immediate_88' 0
C 'ft/t_assert_ctl_assertion_type.vl88n42pagev_user/tocover_observed_deferred_immediate_88htop.t.cover_observed_deferred_immediate_88' 0
C 'ft/t_assert_ctl_assertion_type.vl88n44pagev_user/tocover_final_deferred_immediate_stmt_88htop.t.cover_final_deferred_immediate_stmt_88' 0
C 'ft/t_assert_ctl_assertion_type.vl88n47pagev_user/tocover_observed_deferred_immediate_stmt_88htop.t.cover_observed_deferred_immediate_stmt_88' 0

View File

@ -0,0 +1,18 @@
%Error-UNSUPPORTED: t/t_assert_ctl_assertion_type_unsup.v:15:7: Unsupported: assert control assertion_type
: ... note: In instance 't'
15 | $assertcontrol(OFF, EXPECT);
| ^~~~~~~~~~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_assert_ctl_assertion_type_unsup.v:16:7: Unsupported: assert control assertion_type
: ... note: In instance 't'
16 | $assertcontrol(OFF, UNIQUE);
| ^~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_assert_ctl_assertion_type_unsup.v:17:7: Unsupported: assert control assertion_type
: ... note: In instance 't'
17 | $assertcontrol(OFF, UNIQUE0);
| ^~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_assert_ctl_assertion_type_unsup.v:18:7: Unsupported: assert control assertion_type
: ... note: In instance 't'
18 | $assertcontrol(OFF, PRIORITY);
| ^~~~~~~~~~~~~~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vlt => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,20 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2024 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
module t;
let OFF = 4;
let EXPECT = 16;
let UNIQUE = 32;
let UNIQUE0 = 64;
let PRIORITY = 128;
initial begin
$assertcontrol(OFF, EXPECT);
$assertcontrol(OFF, UNIQUE);
$assertcontrol(OFF, UNIQUE0);
$assertcontrol(OFF, PRIORITY);
end
endmodule

View File

@ -0,0 +1,6 @@
[0] %Error: t_assert_ctl_immediate.v:47: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
-Info: t/t_assert_ctl_immediate.v:47: Verilog $stop, ignored due to +verilator+error+limit
[0] %Error: t_assert_ctl_immediate.v:53: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
[0] %Error: t_assert_ctl_immediate.v:41: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
[0] %Error: t_assert_ctl_immediate.v:41: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
*-* All Finished *-*

View File

@ -29,10 +29,6 @@ module module_with_assert(input clk);
endmodule
module module_with_assertctl(input clk);
let ON = 3;
let OFF = 4;
let KILL = 5;
function void assert_off; begin
$assertoff;
end
@ -47,23 +43,6 @@ module module_with_assertctl(input clk);
endfunction
initial begin
assert(0);
$assertoff;
assert(0);
$asserton;
assert(0);
$assertkill;
assert(0);
$assertcontrol(ON);
assert(0);
$assertcontrol(OFF);
assert(0);
$assertcontrol(ON);
assert(0);
$assertcontrol(KILL);
assert(0);
assert_on();
assert(0);
assert_off();

View File

@ -1,10 +0,0 @@
[0] %Error: t_assert_ctl_immediate_bad.v:50: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
-Info: t/t_assert_ctl_immediate_bad.v:50: Verilog $stop, ignored due to +verilator+error+limit
[0] %Error: t_assert_ctl_immediate_bad.v:54: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
[0] %Error: t_assert_ctl_immediate_bad.v:59: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
[0] %Error: t_assert_ctl_immediate_bad.v:63: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
[0] %Error: t_assert_ctl_immediate_bad.v:68: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
[0] %Error: t_assert_ctl_immediate_bad.v:74: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
[0] %Error: t_assert_ctl_immediate_bad.v:45: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
[0] %Error: t_assert_ctl_immediate_bad.v:45: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
*-* All Finished *-*

View File

@ -8,8 +8,8 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
top_filename("t_assert_ctl_immediate_bad.v");
golden_filename("t/t_assert_ctl_immediate_bad.out");
top_filename("t_assert_ctl_immediate.v");
golden_filename("t/t_assert_ctl_immediate.out");
scenarios(vlt => 1);
compile(

View File

@ -1,5 +1,6 @@
%Error-UNSUPPORTED: t/t_assert_ctl_unsup.v:18:7: Unsupported assertcontrol control_type
18 | $assertcontrol(1);
%Error-UNSUPPORTED: t/t_assert_ctl_unsup.v:18:7: Unsupported: non-constant assert assertion-type expression
: ... note: In instance 't.unsupported_ctl_type'
18 | $assertcontrol(1, a);
| ^~~~~~~~~~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_assert_ctl_unsup.v:19:7: Unsupported assertcontrol control_type

View File

@ -4,8 +4,8 @@
// any use, without warranty, 2024 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
module t;
unsupported_ctl_type unsupported_ctl_type();
module t(input logic clk);
unsupported_ctl_type unsupported_ctl_type(clk ? 1 : 2);
unsupported_ctl_type_expr unsupported_ctl_type_expr();
bad_assertcontrol_ctl_type bad_assertcontrol_ctl_type();
assert_class assert_class();
@ -13,9 +13,9 @@ module t;
assert_iface_class assert_iface_class();
endmodule
module unsupported_ctl_type;
module unsupported_ctl_type(input int a);
initial begin
$assertcontrol(1);
$assertcontrol(1, a);
$assertcontrol(2);
$assertcontrol(6);
$assertcontrol(7);

View File

@ -87,5 +87,6 @@ module Test(/*AUTOARG*/
$assertkill;
assert(0);
$asserton;
$assertcontrol(3, 8);
end
endmodule

View File

@ -491,27 +491,37 @@
{"type":"ASSERTCTL","name":"","addr":"(WH)","loc":"d,86:7,86:17","ctlType":"$assertoff",
"controlTypep": [
{"type":"CONST","name":"32'h4","addr":"(XH)","loc":"d,86:7,86:17","dtypep":"(MC)"}
],
],"assertTypesp": [],
"levelp": [
{"type":"CONST","name":"32'h0","addr":"(YH)","loc":"d,86:7,86:17","dtypep":"(MC)"}
],"itemsp": []},
{"type":"ASSERTCTL","name":"","addr":"(ZH)","loc":"d,87:7,87:18","ctlType":"$assertkill",
"controlTypep": [
{"type":"CONST","name":"32'h5","addr":"(AI)","loc":"d,87:7,87:18","dtypep":"(MC)"}
],
],"assertTypesp": [],
"levelp": [
{"type":"CONST","name":"32'h0","addr":"(BI)","loc":"d,87:7,87:18","dtypep":"(MC)"}
],"itemsp": []},
{"type":"ASSERT","name":"","addr":"(CI)","loc":"d,88:7,88:13","immediate":true,
{"type":"ASSERT","name":"","addr":"(CI)","loc":"d,88:7,88:13","type":"[SIMPLE_IMMEDIATE]",
"propp": [
{"type":"CONST","name":"?32?sh0","addr":"(DI)","loc":"d,88:14,88:15","dtypep":"(L)"}
],"sentreep": [],"failsp": [],"passsp": []},
{"type":"ASSERTCTL","name":"","addr":"(EI)","loc":"d,89:7,89:16","ctlType":"$asserton",
"controlTypep": [
{"type":"CONST","name":"32'h3","addr":"(FI)","loc":"d,89:7,89:16","dtypep":"(MC)"}
],
],"assertTypesp": [],
"levelp": [
{"type":"CONST","name":"32'h0","addr":"(GI)","loc":"d,89:7,89:16","dtypep":"(MC)"}
],"itemsp": []},
{"type":"ASSERTCTL","name":"","addr":"(HI)","loc":"d,90:7,90:21","ctlType":"",
"controlTypep": [
{"type":"CONST","name":"?32?sh3","addr":"(II)","loc":"d,90:22,90:23","dtypep":"(QD)"}
],
"assertTypesp": [
{"type":"CONST","name":"?32?sh8","addr":"(JI)","loc":"d,90:25,90:26","dtypep":"(JF)"}
],
"levelp": [
{"type":"CONST","name":"32'h0","addr":"(KI)","loc":"d,90:7,90:21","dtypep":"(MC)"}
],"itemsp": []}
]}
]}
@ -519,15 +529,15 @@
],"activesp": []}
],"filesp": [],
"miscsp": [
{"type":"TYPETABLE","name":"","addr":"(C)","loc":"a,0:0,0:0","constraintRefp":"UNLINKED","emptyQueuep":"UNLINKED","queueIndexp":"UNLINKED","streamp":"UNLINKED","voidp":"(HI)",
{"type":"TYPETABLE","name":"","addr":"(C)","loc":"a,0:0,0:0","constraintRefp":"UNLINKED","emptyQueuep":"UNLINKED","queueIndexp":"UNLINKED","streamp":"UNLINKED","voidp":"(LI)",
"typesp": [
{"type":"BASICDTYPE","name":"integer","addr":"(II)","loc":"c,31:27,31:28","dtypep":"(II)","keyword":"integer","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"integer","addr":"(MI)","loc":"c,31:27,31:28","dtypep":"(MI)","keyword":"integer","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(L)","loc":"c,33:32,33:33","dtypep":"(L)","keyword":"logic","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(UE)","loc":"c,50:22,50:24","dtypep":"(UE)","keyword":"logic","generic":true,"rangep": []},
{"type":"VOIDDTYPE","name":"","addr":"(HI)","loc":"c,51:21,51:30","dtypep":"(HI)","generic":false},
{"type":"VOIDDTYPE","name":"","addr":"(LI)","loc":"c,51:21,51:30","dtypep":"(LI)","generic":false},
{"type":"BASICDTYPE","name":"logic","addr":"(QD)","loc":"c,125:22,125:23","dtypep":"(QD)","keyword":"logic","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(JI)","loc":"c,127:22,127:23","dtypep":"(JI)","keyword":"logic","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(KI)","loc":"c,162:17,162:56","dtypep":"(KI)","keyword":"logic","range":"295:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(NI)","loc":"c,127:22,127:23","dtypep":"(NI)","keyword":"logic","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(OI)","loc":"c,162:17,162:56","dtypep":"(OI)","keyword":"logic","range":"295:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"string","addr":"(BG)","loc":"c,162:10,162:16","dtypep":"(BG)","keyword":"string","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(Q)","loc":"d,14:9,14:11","dtypep":"(Q)","keyword":"logic","range":"31:0","generic":true,"rangep": []},
{"type":"BASICDTYPE","name":"logic","addr":"(BB)","loc":"d,18:10,18:12","dtypep":"(BB)","keyword":"logic","range":"31:0","generic":true,"rangep": []},
@ -542,9 +552,9 @@
]},
{"type":"CONSTPOOL","name":"","addr":"(D)","loc":"a,0:0,0:0",
"modulep": [
{"type":"MODULE","name":"@CONST-POOL@","addr":"(LI)","loc":"a,0:0,0:0","origName":"@CONST-POOL@","level":0,"modPublic":false,"inLibrary":false,"dead":false,"recursiveClone":false,"recursive":false,"timeunit":"NONE","inlinesp": [],
{"type":"MODULE","name":"@CONST-POOL@","addr":"(PI)","loc":"a,0:0,0:0","origName":"@CONST-POOL@","level":0,"modPublic":false,"inLibrary":false,"dead":false,"recursiveClone":false,"recursive":false,"timeunit":"NONE","inlinesp": [],
"stmtsp": [
{"type":"SCOPE","name":"@CONST-POOL@","addr":"(MI)","loc":"a,0:0,0:0","aboveScopep":"UNLINKED","aboveCellp":"UNLINKED","modp":"(LI)","varsp": [],"blocksp": [],"inlinesp": []}
{"type":"SCOPE","name":"@CONST-POOL@","addr":"(QI)","loc":"a,0:0,0:0","aboveScopep":"UNLINKED","aboveCellp":"UNLINKED","modp":"(PI)","varsp": [],"blocksp": [],"inlinesp": []}
],"activesp": []}
]}
]}