Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/Conversion/ExportVerilog/ExportVerilog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5907,6 +5907,11 @@ LogicalResult StmtEmitter::emitDeclaration(Operation *op) {
auto type = value.getType();
auto word = getVerilogDeclWord(op, emitter);
auto isZeroBit = isZeroBitType(type);

// LocalParams always need the bitwidth, otherwise they are considered to have
// an unknown size.
bool singleBitDefaultType = !isa<LocalParamOp>(op);

ps.scopedBox(isZeroBit ? PP::neverbox : PP::ibox2, [&]() {
unsigned targetColumn = 0;
unsigned column = 0;
Expand All @@ -5930,7 +5935,8 @@ LogicalResult StmtEmitter::emitDeclaration(Operation *op) {
{
llvm::raw_svector_ostream stringStream(typeString);
emitter.printPackedType(stripUnpackedTypes(type), stringStream,
op->getLoc());
op->getLoc(), /*optionalAliasType=*/{},
/*implicitIntType=*/true, singleBitDefaultType);
}
// Emit the type.
if (maxTypeWidth > 0)
Expand Down
2 changes: 1 addition & 1 deletion test/Conversion/ExportVerilog/name-legalize.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ hw.module @parametersNameConflict<p2: i42 = 17, wire: i1>(in %p1: i8) {

// CHECK: `ifdef SOMEMACRO
sv.ifdef @SOMEMACRO {
// CHECK: localparam local_0 = wire_0;
// CHECK: localparam [0:0] local_0 = wire_0;
%local = sv.localparam { value = #hw.param.decl.ref<"wire">: i1 } : i1

// CHECK: assign myWire = wire_0;
Expand Down