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] InferWidths: error can point at operation not involved in constraint #7689

Open
youngar opened this issue Oct 9, 2024 · 0 comments
Labels
bug Something isn't working FIRRTL Involving the `firrtl` dialect

Comments

@youngar
Copy link
Member

youngar commented Oct 9, 2024

given

FIRRTL version 4.0.0
circuit Foo:
  public module Foo:
    input clock : Clock
    reg r : UInt, clock
    node n = add(r, UInt(1))
    connect r, add(r, UInt(1))

we get

./test.fir:5:5: error: 'firrtl.reg' op is constrained to be wider than itself
    reg r : UInt, clock
    ^
./test.fir:5:5: note: see current operation: %0 = "firrtl.reg"(%arg0) {annotations = [], name = "r", nameKind = #firrtl<name_kind droppable_name>} : (!firrtl.clock) -> !firrtl.uint
./test.fir:6:14: note: constrained width W >= W+1 here:
    node n = add(r, UInt(1))
             ^
./test.fir:7:5: note: constrained width W >= W+1 here:
    connect r, add(r, UInt(1))
    ^

It is pointing at the wrong instance of add, which I suspect is because CSE runs before width inference.

@youngar youngar added bug Something isn't working FIRRTL Involving the `firrtl` dialect labels Oct 9, 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

1 participant