Skip to content

[HWAggregateToComb] Mux of unions #10571

@mndstrmr

Description

@mndstrmr

Consider the following minimal.mlir (compiled from SV):

module {
  hw.module @demo(in %a : !hw.union<a: i1>, in %b : !hw.union<a: i1>, in %c : i1, out d : !hw.union<a: i1>) {
    %0 = comb.mux %c, %a, %b : !hw.union<a: i1>
    hw.output %0 : !hw.union<a: i1>
  }
}

circt-opt minimal.mlir --aggregate-to-comb fails with

minimal.mlir:3:10: error: failed to legalize operation 'comb.mux' that was explicitly marked illegal: %0 = "comb.mux"(%arg2, %arg0, %arg1) : (i1, !hw.union<a: i1>, !hw.union<a: i1>) -> !hw.union<a: i1>
    %0 = comb.mux %c, %a, %b : !hw.union<a: i1>

Muxes of hw.struct work fine.

If this is a bug/unimplemented feature then I'm happy to try to implement the fix myself, though some guidance on where to start would be great! If it's not a bug, advice on what I should be doing differently would be great also!

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions