[ImportVerilog] Add support for elaboration system tasks (#7632)

Simply skip the elaboration system tasks `$info`, `$warning`, `$error`,
and `$fatal` outside procedural code. Slang already processes these
tasks and generates the corresponding diagnostics for us.
This commit is contained in:
Fabian Schuiki 2024-09-25 13:11:43 -07:00 committed by GitHub
parent b7e2e2005d
commit ee8e605ac6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View File

@ -69,6 +69,11 @@ struct BaseVisitor {
return success();
}
// Skip elaboration system tasks. These are reported directly by Slang.
LogicalResult visit(const slang::ast::ElabSystemTaskSymbol &) {
return success();
}
// Handle parameters.
LogicalResult visit(const slang::ast::ParameterSymbol &param) {
visitParameter(param);

View File

@ -72,3 +72,23 @@ module Foo;
// expected-error @below {{unpacked arrays in 'inside' expressions not supported}}
int c = a inside { b };
endmodule
// -----
module Foo;
// expected-remark @below {{hello}}
$info("hello");
// expected-warning @below {{hello}}
$warning("hello");
endmodule
// -----
module Foo;
// expected-error @below {{hello}}
$error("hello");
endmodule
// -----
module Foo;
// expected-error @below {{hello}}
$fatal(0, "hello");
endmodule