mirror of https://github.com/llvm/circt.git
[HWArithToHW] Add support for unpacked arrays
Pass did not support unpacked arrays.
This commit is contained in:
parent
f26f1ed5c1
commit
137b13de04
|
@ -112,6 +112,8 @@ static bool isSignednessType(Type type) {
|
|||
.Case<IntegerType>([](auto type) { return !type.isSignless(); })
|
||||
.Case<hw::ArrayType>(
|
||||
[](auto type) { return isSignednessType(type.getElementType()); })
|
||||
.Case<hw::UnpackedArrayType>(
|
||||
[](auto type) { return isSignednessType(type.getElementType()); })
|
||||
.Case<hw::StructType>([](auto type) {
|
||||
return llvm::any_of(type.getElements(), [](auto element) {
|
||||
return isSignednessType(element.type);
|
||||
|
@ -368,6 +370,10 @@ Type HWArithToHWTypeConverter::removeSignedness(Type type) {
|
|||
return hw::ArrayType::get(removeSignedness(type.getElementType()),
|
||||
type.getNumElements());
|
||||
})
|
||||
.Case<hw::UnpackedArrayType>([this](auto type) {
|
||||
return hw::UnpackedArrayType::get(
|
||||
removeSignedness(type.getElementType()), type.getNumElements());
|
||||
})
|
||||
.Case<hw::StructType>([this](auto type) {
|
||||
// Recursively convert each element.
|
||||
llvm::SmallVector<hw::StructType::FieldInfo> convertedElements;
|
||||
|
|
|
@ -381,3 +381,17 @@ hw.module @MMIOAxiReadWriteMux(out cmd : !hw.typealias<@pycde::@MMIOIntermediate
|
|||
%4 = hw.struct_create (%3) : !hw.typealias<@pycde::@MMIOIntermediateCmd, !hw.struct<offset: ui32>>
|
||||
hw.output %4: !hw.typealias<@pycde::@MMIOIntermediateCmd, !hw.struct<offset: ui32>>
|
||||
}
|
||||
|
||||
|
||||
// -----
|
||||
// CHECK-LABEL: hw.module @UnpackedArrayInout() {
|
||||
// CHECK-NEXT: %vec_a = sv.reg : !hw.inout<uarray<16xi32>>
|
||||
// CHECK-NEXT: %c0_i4 = hw.constant 0 : i4
|
||||
// CHECK-NEXT: [[R0:%.+]] = sv.array_index_inout %vec_a[%c0_i4] : !hw.inout<uarray<16xi32>>, i4
|
||||
// CHECK-NEXT: sv.read_inout [[R0]] : !hw.inout<i32>
|
||||
hw.module @UnpackedArrayInout() {
|
||||
%vec_a = sv.reg : !hw.inout<uarray<16xsi32>>
|
||||
%1 = hw.constant 0 : i4
|
||||
%2 = sv.array_index_inout %vec_a[%1] : !hw.inout<uarray<16xsi32>>, i4
|
||||
%3 = sv.read_inout %2 : !hw.inout<si32>
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue