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

Backport IMDCE improvements into firtool 1.37 #5318

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Jun 6, 2023

This PR backports several IMDCE improvements to delete dead instances associated with OMIRTrackers.

Close #4867

This improves IMDCE by managing instance liveness per instance (previously if there exists an alive instance, it affected all other instances). As we cannot delete modules with side effects (e.g. print/assert/cover) even when they don't have arguments, `undeletableBlocks` keeps tracks of modules we cannot delete.
```scala
circuit Top:
  module PassThrough:
    input a: UInt<1>
    output b: UInt<1>
    b <= a
  module Top:
    input a: UInt<1>
    output b: UInt<1>
    inst p1 of PassThrough
    inst p2 of PassThrough
    p1.a <= a
    p2.a <= a
    b <= p2.b
```
Previous output:
```verilog
module Top(
  input  a,
  output b
);

  PassThrough p1 (
    .a (a),
    .b (/* unused */)
  );
  PassThrough p2 (
    .a (a),
    .b (b)
  );
endmodule
```
New output:
```verilog
module Top(
  input  a,
  output b
);

  PassThrough p2 (
    .a (a),
    .b (b)
  );
endmodule
```
We've changed the modeling of InvalidValueOp to have side-effect so 
it's necessary to handle invalid values specially. Since InvalidValueOp has
MemAlloc side-effects trait, this PR allows dead operations with 
known side-effects(Alloc/Read) to be removed.
@uenoku uenoku changed the title Backport IMDCE improvements into 1.37 Backport IMDCE improvements into firtool 1.37 Jun 6, 2023
This PR adds functionality to find and remove dead hierpaths and weak referencing annotations in IMDCE.
Even though it's not explicitly defined yet, some annotations (for example OMIRTracker)
are expected to be removed when annotation targets are dead. In many cases OMIRTracker
is represented as non-local annotations associated with hierpaths which are users of inner symbols.
So this PR imports some of InnerSymbolDCE  logic into IMDCE and aggressively removes inner symbols.
@uenoku uenoku merged commit d299e9d into firtool-1.37 Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant