mirror of https://github.com/llvm/circt.git
[ExportVerilog] Don't print the parameter type if NoneType
When emitting a module parameter which specifies neither a type nor a default attribute, don't emit a type. Subsumes a string default since the type of a StringAttr is NoneType.
This commit is contained in:
parent
2d2f992756
commit
9040885a10
|
@ -3947,9 +3947,9 @@ void ModuleEmitter::emitHWModule(HWModuleOp module) {
|
|||
if (auto fpAttr = defaultValue.dyn_cast<FloatAttr>())
|
||||
if (fpAttr.getType().isF64())
|
||||
return;
|
||||
if (defaultValue.isa<StringAttr>())
|
||||
return;
|
||||
}
|
||||
if (type.isa<NoneType>())
|
||||
return;
|
||||
|
||||
// Classic Verilog parser don't allow a type in the parameter declaration.
|
||||
// For compatibility with them, we omit the type when it is implicit based
|
||||
|
|
|
@ -1107,13 +1107,15 @@ hw.module @UseParameterValue<xx: i42>(%arg0: i8)
|
|||
|
||||
// CHECK-LABEL: module VerilogCompatParameters
|
||||
hw.module @VerilogCompatParameters<p1: i42, p2: i32, p3: f64 = 1.5,
|
||||
p4: i32 = 4, p5: none = "foo">()
|
||||
p4: i32 = 4, p5: none = "foo",
|
||||
p6: none>()
|
||||
-> () {
|
||||
// CHECK-NEXT: #(parameter [41:0] p1,
|
||||
// CHECK-NEXT: parameter /*integer*/ p2,
|
||||
// CHECK-NEXT: parameter p3 = 1.500000e+00,
|
||||
// CHECK-NEXT: parameter p4 = 4,
|
||||
// CHECK-NEXT: parameter p5 = "foo")
|
||||
// CHECK-NEXT: parameter p5 = "foo",
|
||||
// CHECK-NEXT: parameter p6)
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue