3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-15 06:01:28 +00:00

Added basic support for $expect cells

This commit is contained in:
Clifford Wolf 2016-07-13 16:56:17 +02:00
parent b3155af5f6
commit 721f1f5ecf
16 changed files with 82 additions and 19 deletions

View file

@ -1296,7 +1296,12 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
// generate $assert cells
case AST_ASSERT:
case AST_ASSUME:
case AST_EXPECT:
{
const char *celltype = "$assert";
if (type == AST_ASSUME) celltype = "$assume";
if (type == AST_EXPECT) celltype = "$expect";
log_assert(children.size() == 2);
RTLIL::SigSpec check = children[0]->genRTLIL();
@ -1308,9 +1313,9 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
en = current_module->ReduceBool(NEW_ID, en);
std::stringstream sstr;
sstr << (type == AST_ASSERT ? "$assert$" : "$assume$") << filename << ":" << linenum << "$" << (autoidx++);
sstr << celltype << "$" << filename << ":" << linenum << "$" << (autoidx++);
RTLIL::Cell *cell = current_module->addCell(sstr.str(), type == AST_ASSERT ? "$assert" : "$assume");
RTLIL::Cell *cell = current_module->addCell(sstr.str(), celltype);
cell->attributes["\\src"] = stringf("%s:%d", filename.c_str(), linenum);
for (auto &attr : attributes) {