Skip to content

Commit

Permalink
[ExportVerilog] Fix struct inject op emisson (#6325)
Browse files Browse the repository at this point in the history
Fix #6316
  • Loading branch information
uenoku authored Oct 20, 2023
1 parent f94c4ed commit 2f8381c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/Conversion/ExportVerilog/ExportVerilog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3102,7 +3102,8 @@ SubExprInfo ExprEmitter::visitTypeOp(StructInjectOp op) {
emitSubExpr(op.getNewValue(), Selection);
} else {
emitSubExpr(op.getInput(), Selection);
ps << "." << PPExtString(field.name.getValue());
ps << "."
<< PPExtString(emitter.getVerilogStructFieldName(field.name));
}
});
},
Expand Down
6 changes: 3 additions & 3 deletions test/Conversion/ExportVerilog/hw-dialect.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -1094,12 +1094,12 @@ hw.module @useRenamedStruct(inout %a: !hw.struct<repeat: i1, repeat_0: i1>, out

%0 = sv.struct_field_inout %a["repeat"] : !hw.inout<struct<repeat: i1, repeat_0: i1>>
%1 = sv.read_inout %0 : !hw.inout<i1>
// assign r1 = a.repeat_0;
// CHECK: assign r1 = a.repeat_0;
%2 = hw.struct_extract %read["repeat_0"] : !hw.struct<repeat: i1, repeat_0: i1>
// assign r2 = a.repeat_0_1;
// CHECK: assign r2 = a.repeat_0_0
%true = hw.constant true
%3 = hw.struct_inject %read["repeat_0"], %true : !hw.struct<repeat: i1, repeat_0: i1>
// assign r3 = '{repeat_0: a.repeat_0, repeat_0_0: (1'h1)};
// CHECK: assign r3 = '{repeat_0: a.repeat_0, repeat_0_0: (1'h1)};
hw.output %1, %2, %3, %i0 : i1, i1, !hw.struct<repeat: i1, repeat_0: i1>, !hw.struct<repeat: i1, repeat_0: i1>
}

Expand Down

0 comments on commit 2f8381c

Please sign in to comment.