mirror of https://github.com/YosysHQ/yosys.git
Add "read_verilog -noassert -noassume -assert-assumes"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
e8431d1508
commit
89ef6600bc
|
@ -66,12 +66,21 @@ struct VerilogFrontend : public Frontend {
|
||||||
log(" enable support for SystemVerilog assertions and some Yosys extensions\n");
|
log(" enable support for SystemVerilog assertions and some Yosys extensions\n");
|
||||||
log(" replace the implicit -D SYNTHESIS with -D FORMAL\n");
|
log(" replace the implicit -D SYNTHESIS with -D FORMAL\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -noassert\n");
|
||||||
|
log(" ignore assert() statements\n");
|
||||||
|
log("\n");
|
||||||
|
log(" -noassume\n");
|
||||||
|
log(" ignore assume() statements\n");
|
||||||
|
log("\n");
|
||||||
log(" -norestrict\n");
|
log(" -norestrict\n");
|
||||||
log(" ignore restrict() assertions\n");
|
log(" ignore restrict() statements\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" -assume-asserts\n");
|
log(" -assume-asserts\n");
|
||||||
log(" treat all assert() statements like assume() statements\n");
|
log(" treat all assert() statements like assume() statements\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -assert-assumes\n");
|
||||||
|
log(" treat all assume() statements like assert() statements\n");
|
||||||
|
log("\n");
|
||||||
log(" -dump_ast1\n");
|
log(" -dump_ast1\n");
|
||||||
log(" dump abstract syntax tree (before simplification)\n");
|
log(" dump abstract syntax tree (before simplification)\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
@ -229,6 +238,14 @@ struct VerilogFrontend : public Frontend {
|
||||||
formal_mode = true;
|
formal_mode = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (arg == "-noassert") {
|
||||||
|
noassert_mode = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (arg == "-noassume") {
|
||||||
|
noassume_mode = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (arg == "-norestrict") {
|
if (arg == "-norestrict") {
|
||||||
norestrict_mode = true;
|
norestrict_mode = true;
|
||||||
continue;
|
continue;
|
||||||
|
@ -237,6 +254,10 @@ struct VerilogFrontend : public Frontend {
|
||||||
assume_asserts_mode = true;
|
assume_asserts_mode = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (arg == "-assert-assumes") {
|
||||||
|
assert_assumes_mode = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (arg == "-dump_ast1") {
|
if (arg == "-dump_ast1") {
|
||||||
flag_dump_ast1 = true;
|
flag_dump_ast1 = true;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -54,12 +54,21 @@ namespace VERILOG_FRONTEND
|
||||||
// running in -formal mode
|
// running in -formal mode
|
||||||
extern bool formal_mode;
|
extern bool formal_mode;
|
||||||
|
|
||||||
|
// running in -noassert mode
|
||||||
|
extern bool noassert_mode;
|
||||||
|
|
||||||
|
// running in -noassume mode
|
||||||
|
extern bool noassume_mode;
|
||||||
|
|
||||||
// running in -norestrict mode
|
// running in -norestrict mode
|
||||||
extern bool norestrict_mode;
|
extern bool norestrict_mode;
|
||||||
|
|
||||||
// running in -assume-asserts mode
|
// running in -assume-asserts mode
|
||||||
extern bool assume_asserts_mode;
|
extern bool assume_asserts_mode;
|
||||||
|
|
||||||
|
// running in -assert-assumes mode
|
||||||
|
extern bool assert_assumes_mode;
|
||||||
|
|
||||||
// running in -lib mode
|
// running in -lib mode
|
||||||
extern bool lib_mode;
|
extern bool lib_mode;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ namespace VERILOG_FRONTEND {
|
||||||
bool do_not_require_port_stubs;
|
bool do_not_require_port_stubs;
|
||||||
bool default_nettype_wire;
|
bool default_nettype_wire;
|
||||||
bool sv_mode, formal_mode, lib_mode;
|
bool sv_mode, formal_mode, lib_mode;
|
||||||
bool norestrict_mode, assume_asserts_mode;
|
bool noassert_mode, noassume_mode, norestrict_mode;
|
||||||
|
bool assume_asserts_mode, assert_assumes_mode;
|
||||||
bool current_wire_rand, current_wire_const;
|
bool current_wire_rand, current_wire_const;
|
||||||
std::istream *lexin;
|
std::istream *lexin;
|
||||||
}
|
}
|
||||||
|
@ -1281,16 +1282,28 @@ opt_stmt_label:
|
||||||
|
|
||||||
assert:
|
assert:
|
||||||
opt_stmt_label TOK_ASSERT opt_property '(' expr ')' ';' {
|
opt_stmt_label TOK_ASSERT opt_property '(' expr ')' ';' {
|
||||||
ast_stack.back()->children.push_back(new AstNode(assume_asserts_mode ? AST_ASSUME : AST_ASSERT, $5));
|
if (noassert_mode)
|
||||||
|
delete $5;
|
||||||
|
else
|
||||||
|
ast_stack.back()->children.push_back(new AstNode(assume_asserts_mode ? AST_ASSUME : AST_ASSERT, $5));
|
||||||
} |
|
} |
|
||||||
opt_stmt_label TOK_ASSUME opt_property '(' expr ')' ';' {
|
opt_stmt_label TOK_ASSUME opt_property '(' expr ')' ';' {
|
||||||
ast_stack.back()->children.push_back(new AstNode(AST_ASSUME, $5));
|
if (noassume_mode)
|
||||||
|
delete $5;
|
||||||
|
else
|
||||||
|
ast_stack.back()->children.push_back(new AstNode(assert_assumes_mode ? AST_ASSERT : AST_ASSUME, $5));
|
||||||
} |
|
} |
|
||||||
opt_stmt_label TOK_ASSERT opt_property '(' TOK_EVENTUALLY expr ')' ';' {
|
opt_stmt_label TOK_ASSERT opt_property '(' TOK_EVENTUALLY expr ')' ';' {
|
||||||
ast_stack.back()->children.push_back(new AstNode(assume_asserts_mode ? AST_FAIR : AST_LIVE, $6));
|
if (noassert_mode)
|
||||||
|
delete $6;
|
||||||
|
else
|
||||||
|
ast_stack.back()->children.push_back(new AstNode(assume_asserts_mode ? AST_FAIR : AST_LIVE, $6));
|
||||||
} |
|
} |
|
||||||
opt_stmt_label TOK_ASSUME opt_property '(' TOK_EVENTUALLY expr ')' ';' {
|
opt_stmt_label TOK_ASSUME opt_property '(' TOK_EVENTUALLY expr ')' ';' {
|
||||||
ast_stack.back()->children.push_back(new AstNode(AST_FAIR, $6));
|
if (noassume_mode)
|
||||||
|
delete $6;
|
||||||
|
else
|
||||||
|
ast_stack.back()->children.push_back(new AstNode(assert_assumes_mode ? AST_LIVE : AST_FAIR, $6));
|
||||||
} |
|
} |
|
||||||
opt_stmt_label TOK_COVER opt_property '(' expr ')' ';' {
|
opt_stmt_label TOK_COVER opt_property '(' expr ')' ';' {
|
||||||
ast_stack.back()->children.push_back(new AstNode(AST_COVER, $5));
|
ast_stack.back()->children.push_back(new AstNode(AST_COVER, $5));
|
||||||
|
|
Loading…
Reference in New Issue