Skip to content

[FIRRTL] Domain inference should consider control dependencies #9488

@dtzSiFive

Description

@dtzSiFive

Consider:

FIRRTL version 6.0.0

circuit WhenDom:
  domain ClockDomain:

  public module WhenDom:
    input A : Domain of ClockDomain
    input B : Domain of ClockDomain
    input c : UInt<1> domains [A]
    input x : UInt<1> domains [B]
    input y : UInt<1> domains [B]
    output z : UInt<1> domains [B]

    when c:
      connect z, x
    else:
      connect z, y

firtool -domain-mode=infer-all

-->

// Generated by CIRCT firtool-1.139.0-59-gd2c1575fe9-dirty
module WhenDom(
  input  c,
         x,
         y,
  output z
);

  assign z = c ? x : y;
endmodule

This should error, as can be seen in the produce verilog z depends on c and needs to be on the same domain.

Title is for end-to-end behavior, running domain inference after ExpandWhens addresses this issue.

Metadata

Metadata

Assignees

Labels

FIRRTLInvolving the `firrtl` dialect

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions