Skip to content

[FIRRTL] Probes can target the wrong signal when a local signal has the same name as the containing module #7593

Open
@youngar

Description

@youngar

Probes can target the wrong signal when a local signal has the same name as the containing module. When given the following input, compiled with firtool xmr.fir we get the subsequent verilog:

FIRRTL version 4.0.0
circuit Foo: %[[
  {
    "class": "firrtl.transforms.DontTouchAnnotation",
    "target": "~Foo|Problem2>w_probe"
  },
  {
    "class": "firrtl.transforms.DontTouchAnnotation",
    "target": "~Foo|Baz>w"
  }
]]
  public module Foo:
    output out : UInt<1>
    inst Foo of Problem
    inst baz of Baz
    connect out, read(baz.probe)
  module Problem:
    inst baz of Problem2
  module Problem2:
    wire w_probe : UInt<1>
    connect w_probe, UInt<1>(1)
  module Baz:
    output probe : Probe<UInt<1>>
    wire w : UInt<1>
    connect w, UInt<1>(0)
    define probe = probe(w)
// Generated by CIRCT unknown git version
module Foo(
  output out
);

  Problem Foo ();
  Baz baz ();
  assign out = Foo.baz.w_probe;
endmodule

module Problem();
  Problem2 baz ();
endmodule

module Problem2();
  wire w_probe = 1'h1;
endmodule

module Baz();
  wire w = 1'h0;
  wire w_probe = w;
endmodule

By sticking initial $monitor(out); in the top module, we can see that the signal out has the value 1, which comes Problem2, when we would expect it to have the value 0 from Baz.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FIRRTLInvolving the `firrtl` dialectbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions