Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIRRTL] firrtl-lower-signatures fails for enum types #7106

Open
programmerjake opened this issue May 30, 2024 · 1 comment
Open

[FIRRTL] firrtl-lower-signatures fails for enum types #7106

programmerjake opened this issue May 30, 2024 · 1 comment
Labels
bug Something isn't working FIRRTL Involving the `firrtl` dialect

Comments

@programmerjake
Copy link

using firtool-1.75.0 from github releases

I expect firtool to be able to lower enum types as specified in the ABI, however it just plain fails.

using the following FIRRTL:

FIRRTL version 3.2.0
circuit check_enum_literals:
    type Ty0 = {|None, Some: UInt<8>|}
    module check_enum_literals:
        input i: UInt<8>
        output o: Ty0
        connect o, {|None, Some: UInt<8>|}(Some, i)

I tried running:

firtool check_enum_literals.fir -o - --mlir-print-ir-after-all

which output:

<snip>
// -----// IR Dump After LowerIntrinsics (firrtl-lower-intrinsics) //----- //
firrtl.module @check_enum_literals(in %i: !firrtl.uint<8>, out %o: !firrtl.alias<Ty0, enum<None: uint<0>, Some: uint<8>>>) attributes {convention = #firrtl<convention scalarized>} {
  %0 = firrtl.enumcreate Some(%i) : (!firrtl.uint<8>) -> !firrtl.enum<None: uint<0>, Some: uint<8>>
  firrtl.connect %o, %0 : !firrtl.alias<Ty0, enum<None: uint<0>, Some: uint<8>>>, !firrtl.enum<None: uint<0>, Some: uint<8>>
}

// -----// IR Dump After LowerSignatures Failed (firrtl-lower-signatures) //----- //
firrtl.circuit "check_enum_literals" {
  firrtl.module @check_enum_literals(in %i: !firrtl.uint<8>, out %o: !firrtl.alias<Ty0, enum<None: uint<0>, Some: uint<8>>>) attributes {convention = #firrtl<convention scalarized>} {
    %0 = firrtl.enumcreate Some(%i) : (!firrtl.uint<8>) -> !firrtl.enum<None: uint<0>, Some: uint<8>>
    firrtl.connect %o, %0 : !firrtl.alias<Ty0, enum<None: uint<0>, Some: uint<8>>>, !firrtl.enum<None: uint<0>, Some: uint<8>>
  }
}
@uenoku
Copy link
Member

uenoku commented May 30, 2024

Thank you for the report! LowerSignature seems not to handle enum right now ;)

.Case<FEnumType>([&](FEnumType fenum) { return failure(); })

@uenoku uenoku changed the title firrtl-lower-signatures fails for enum types [FIRTRL] firrtl-lower-signatures fails for enum types May 30, 2024
@uenoku uenoku added FIRRTL Involving the `firrtl` dialect bug Something isn't working labels May 30, 2024
@uenoku uenoku changed the title [FIRTRL] firrtl-lower-signatures fails for enum types [FIRRTL] firrtl-lower-signatures fails for enum types Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FIRRTL Involving the `firrtl` dialect
Projects
None yet
Development

No branches or pull requests

2 participants