mirror of https://github.com/llvm/circt.git
[ImportVerilog] Ignore type parameters
Ignore type parameter AST nodes since these are already handled during Slang's type checking pass. Also tweak the diagnostics on unsupported SV constructs to be a bit more descriptive.
This commit is contained in:
parent
272af6c158
commit
58f6daa425
|
@ -97,6 +97,9 @@ struct PackageVisitor : public BaseVisitor {
|
|||
// Ignore parameters. These are materialized on-the-fly as `ConstantOp`s.
|
||||
LogicalResult visit(const slang::ast::ParameterSymbol &) { return success(); }
|
||||
LogicalResult visit(const slang::ast::SpecparamSymbol &) { return success(); }
|
||||
LogicalResult visit(const slang::ast::TypeParameterSymbol &) {
|
||||
return success();
|
||||
}
|
||||
|
||||
// Handle functions and tasks.
|
||||
LogicalResult visit(const slang::ast::SubroutineSymbol &subroutine) {
|
||||
|
@ -106,7 +109,7 @@ struct PackageVisitor : public BaseVisitor {
|
|||
/// Emit an error for all other members.
|
||||
template <typename T>
|
||||
LogicalResult visit(T &&node) {
|
||||
mlir::emitError(loc, "unsupported construct: ")
|
||||
mlir::emitError(loc, "unsupported package member: ")
|
||||
<< slang::ast::toString(node.kind);
|
||||
return failure();
|
||||
}
|
||||
|
@ -192,6 +195,12 @@ struct ModuleVisitor : public BaseVisitor {
|
|||
return success();
|
||||
}
|
||||
|
||||
// Ignore type parameters. These have already been handled by Slang's type
|
||||
// checking.
|
||||
LogicalResult visit(const slang::ast::TypeParameterSymbol &) {
|
||||
return success();
|
||||
}
|
||||
|
||||
// Handle instances.
|
||||
LogicalResult visit(const slang::ast::InstanceSymbol &instNode) {
|
||||
using slang::ast::ArgumentDirection;
|
||||
|
@ -515,7 +524,7 @@ struct ModuleVisitor : public BaseVisitor {
|
|||
/// Emit an error for all other members.
|
||||
template <typename T>
|
||||
LogicalResult visit(T &&node) {
|
||||
mlir::emitError(loc, "unsupported construct: ")
|
||||
mlir::emitError(loc, "unsupported module member: ")
|
||||
<< slang::ast::toString(node.kind);
|
||||
return failure();
|
||||
}
|
||||
|
@ -632,7 +641,7 @@ Context::convertModuleHeader(const slang::ast::InstanceBodySymbol *module) {
|
|||
// only minor differences in semantics.
|
||||
if (module->getDefinition().definitionKind !=
|
||||
slang::ast::DefinitionKind::Module) {
|
||||
mlir::emitError(loc) << "unsupported construct: "
|
||||
mlir::emitError(loc) << "unsupported definition: "
|
||||
<< module->getDefinition().getKindString();
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ endmodule
|
|||
// CHECK: moore.module private @DedupB(in %a : !moore.i32)
|
||||
// CHECK: moore.module private @DedupB_0(in %a : !moore.i16)
|
||||
// CHECK-NOT: @DedupB
|
||||
module DedupB #(parameter int W)(input bit [W-1:0] a);
|
||||
module DedupB #(parameter int W, parameter type T = bit [W-1:0])(input T a);
|
||||
endmodule
|
||||
|
||||
// CHECK-LABEL: moore.module @Dedup()
|
||||
|
|
|
@ -28,13 +28,13 @@ endmodule
|
|||
// -----
|
||||
module Foo;
|
||||
parameter a = 1;
|
||||
// expected-error @below {{unsupported construct}}
|
||||
// expected-error @below {{unsupported module member}}
|
||||
defparam a = 2;
|
||||
endmodule
|
||||
|
||||
// -----
|
||||
module Foo;
|
||||
// expected-error @below {{unsupported construct}}
|
||||
// expected-error @below {{unsupported module member}}
|
||||
nettype real x;
|
||||
endmodule
|
||||
|
||||
|
|
Loading…
Reference in New Issue