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
3 changes: 2 additions & 1 deletion lib/Conversion/MooreToCore/MooreToCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ struct ExtractOpConversion : public OpConversionPattern<ExtractOp> {
int32_t width = llvm::Log2_64_Ceil(arrTy.getNumElements());
int32_t inputWidth = arrTy.getNumElements();

if (auto resArrTy = dyn_cast<hw::ArrayType>(resultType)) {
if (auto resArrTy = dyn_cast<hw::ArrayType>(resultType);
resArrTy && resArrTy != arrTy.getElementType()) {
int32_t elementWidth = hw::getBitWidth(arrTy.getElementType());
if (elementWidth < 0)
return failure();
Expand Down
9 changes: 9 additions & 0 deletions test/Conversion/MooreToCore/basic.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -1283,3 +1283,12 @@ func.func @SeverityToPrint() {
func.func @CHandle(%arg0: !moore.chandle) {
return
}

// CHECK-LABEL: @MultiDimensionalSlice
moore.module @MultiDimensionalSlice(in %in : !moore.array<2 x array<2 x l2>>, out out : !moore.array<2 x l2>) {
// CHECK-NEXT: [[IDX:%.*]] = hw.constant false
// CHECK-NEXT: [[V:%.*]] = hw.array_get %in[[[IDX]]]
// CHECK-NEXT: hw.output [[V]] : !hw.array<2xi2>
%0 = moore.extract %in from 0 : array<2 x array<2 x l2>> -> array<2 x l2>
moore.output %0 : !moore.array<2 x l2>
}