Skip to content

Conversation

fabianschuiki
Copy link
Contributor

Add a canonicalizer that removes comb.mux and arith.select ops on the data input of the register if those ops use the register's enable as select operand. For example:

%0 = comb.mux %enable, %a, %b
seq.compreg.ce %0, %clock, %enable

gets canonicalized to

seq.compreg.ce %a, %clock, %enable

Add a canonicalizer that removes `comb.mux` and `arith.select` ops on
the data input of the register if those ops use the register's enable as
select operand. For example:

    %0 = comb.mux %enable, %a, %b
    seq.compreg.ce %0, %clock, %enable

gets canonicalized to

    seq.compreg.ce %a, %clock, %enable
@fabianschuiki fabianschuiki requested review from teqdruid and uenoku May 12, 2025 19:17
@fabianschuiki fabianschuiki added the Seq Involving the `seq` dialect label May 12, 2025
Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fabianschuiki fabianschuiki merged commit b70b2bb into main May 12, 2025
5 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/compregce-drop-mux branch May 12, 2025 21:55
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Jul 17, 2025
Add a canonicalizer that removes `comb.mux` and `arith.select` ops on
the data input of the register if those ops use the register's enable as
select operand. For example:

    %0 = comb.mux %enable, %a, %b
    seq.compreg.ce %0, %clock, %enable

gets canonicalized to

    seq.compreg.ce %a, %clock, %enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Seq Involving the `seq` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants