Support restrict, bug1350.

This commit is contained in:
Wilson Snyder 2018-09-23 15:20:12 -04:00
parent 0e37747d2c
commit 9f8dbc91f2
7 changed files with 26 additions and 4 deletions

View File

@ -6,6 +6,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
*** Support $past. [Dan Gisselquist]
*** Support restrict, bug1350. [Clifford Wolf]
*** Fix Mac OSX 10.13.6 / LLVM 9.1 compile issues, bug1348. [Kevin Kiningham]
*** Fix MinGW compile issues, msg2636. [HyungKi Jeong]

View File

@ -145,6 +145,10 @@ private:
// than the sim-killing else clause:
ifp->branchPred(AstBranchPred::BP_LIKELY);
bodysp = newIfAssertOn(ifp);
} else if (VN_IS(nodep, PslRestrict)) {
// IEEE says simulator ignores these
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
return;
} else {
nodep->v3fatalSrc("Unknown node type");
}

View File

@ -5346,6 +5346,13 @@ public:
AstNode* stmtsp() const { return op4p(); } // op4 = statements
};
class AstPslAssert : public AstNodePslCoverOrAssert {
public:
ASTNODE_NODE_FUNCS(PslAssert)
AstPslAssert(FileLine* fl, AstNode* propp, AstNode* stmtsp, const string& name="")
: AstNodePslCoverOrAssert(fl, propp, stmtsp, name) {}
};
class AstPslCover : public AstNodePslCoverOrAssert {
public:
ASTNODE_NODE_FUNCS(PslCover)
@ -5355,11 +5362,11 @@ public:
void coverincp(AstCoverInc* nodep) { addOp3p(nodep); } // op3 = coverage node
};
class AstPslAssert : public AstNodePslCoverOrAssert {
class AstPslRestrict : public AstNodePslCoverOrAssert {
public:
ASTNODE_NODE_FUNCS(PslAssert)
AstPslAssert(FileLine* fl, AstNode* propp, AstNode* stmtsp, const string& name="")
: AstNodePslCoverOrAssert(fl, propp, stmtsp, name) {}
ASTNODE_NODE_FUNCS(PslRestrict)
AstPslRestrict(FileLine* fl, AstNode* propp)
: AstNodePslCoverOrAssert(fl, propp, NULL, "") {}
};
//======================================================================

View File

@ -406,6 +406,9 @@ private:
virtual void visit(AstPslCover* nodep) {
visitIterateNoValueMod(nodep);
}
virtual void visit(AstPslRestrict* nodep) {
visitIterateNoValueMod(nodep);
}
virtual void visit(AstNode* nodep) {
// Default: Just iterate

View File

@ -491,6 +491,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"pure" { FL; return yPURE; }
"rand" { FL; return yRAND; }
"randc" { FL; return yRANDC; }
"restrict" { FL; return yRESTRICT; }
"return" { FL; return yRETURN; }
"shortint" { FL; return ySHORTINT; }
"static" { FL; return ySTATIC; }

View File

@ -399,6 +399,7 @@ class AstSenTree;
%token<fl> yREALTIME "realtime"
%token<fl> yREG "reg"
%token<fl> yREPEAT "repeat"
%token<fl> yRESTRICT "restrict"
%token<fl> yRETURN "return"
%token<fl> yRNMOS "rnmos"
%token<fl> yRPMOS "rpmos"
@ -3745,6 +3746,8 @@ concurrent_assertion_statement<nodep>: // ==IEEE: concurrent_assertion_statement
yASSERT yPROPERTY '(' property_spec ')' elseStmtBlock { $$ = new AstPslAssert($1,$4,$6); }
// // IEEE: cover_property_statement
| yCOVER yPROPERTY '(' property_spec ')' stmtBlock { $$ = new AstPslCover($1,$4,$6); }
// // IEEE: restrict_property_statement
| yRESTRICT yPROPERTY '(' property_spec ')' ';' { $$ = new AstPslRestrict($1,$4); }
;
elseStmtBlock<nodep>: // Part of concurrent_assertion_statement

View File

@ -45,6 +45,8 @@ module Test
assert property (@(posedge clk) cyc < 100);
restrict property (@(posedge clk) cyc==1); // Ignored in simulators
// Unclocked is not supported:
// assert property (cyc != 6);