llvm / circt

Circuit IR Compilers and Tools
https://circt.org
Other
1.62k stars 281 forks source link

[FIRRTL] Produce Better Error Message For Incorrect Enum FIRRTL Text #6714

Open seldridge opened 6 months ago

seldridge commented 6 months ago

The following is currently failing:

FIRRTL version 4.0.0
circuit Foo:
  module Foo:
    wire x: UInt<8>
    node y = {|some: UInt<8>, None|}(Some, x)

~The problem is that this is parsing Some, x) as the "tag" and then trying to look that. This is then an illegal tag and it errors out.~

See the comment below. This is illegal IR that trips an assert in a builder.

seldridge commented 6 months ago

False alarm on this one---some and Some do not match, therefore this is malformed IR. This should produce a better error message when this does happen, though. Currently this is tripping an assertion in the builder which, in a release build, looks like it would blind dereference an optional type. 😬