llvm / llvm/circt

[Seq] `seq.compreg` canonicalizations

Open
#6,039 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Seq
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

I'd like to see some canonicalizations for the generic seq register operations.

seq.compreg

Should we inherit the canonicalizations currently defined for FirRegOp?

  • Constant 0 reset: drop reset value and reset signal from the op
  • Feedback register OR constant 1 clock: replace with the reset value if present, else replace with constant zero
  • Constant 1 reset: replace with reset value
  • Constant 0 clock: replace with reset value if present, else constant 0.

seq.compreg.ce

In case of constant clock-enable inputs, what would the following canoncalize to?

%r = seq.compreg.ce %i, %clk, %ce, %rst, %rv : i32
  • %ce = hw.constant 1 : i1 trivially canonicalizes to seq.compreg %i, %clk, %rst, %rv : i32
  • %ce = hw.constant 0 : i1 should, if the last seq.compreg canonicalization is accepted, be identical to the constant 0 clock canonicalization.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing FirRegOp canonicalizations and the seq.compreg and seq.compreg.ce operation definitions. Resolve the listed constant reset, clock, and clock-enable cases, then verify that each agreed canonicalization is covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.