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

[Seq] Lower FirRomOp to HWModuleGeneratedOp #5800

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vowstar
Copy link

@vowstar vowstar commented Aug 8, 2023

Add the LowerFirRom pass which lowers seq.firrom ops to a
corresponding hw.module.generated op. The pass collects a list
of ROM ops in the design, distills them down into ROM parameters,
deduplicates those parameters, creates one hw.module.generated op
for each unique ROM config, and replaces the ROM ops with instances
of this generated module.

This commit reflects that ROM can configure the numReadPorts
parameter, because there are multi-port ROMs, for example:

https://www.intel.com/content/dam/altera-www/global/en_US/others/support/examples/download/dual_port_rom.zip

This commit blocked by: #5798

Add a new `FirRomOp` to the Seq dialect to capture the
semantics of FIRRTL ROM at the HW level. The intent behind this
change is the same as for `FirMemOp`.

ROMs are represented as a declaration with the `seq.firrom`
which returns a value representing the ROM itself. This value
is of type `!seq.firrom<12 x 42>` which represents an opaque
handle to the ROM; it encodes the `depth (12)` and
`width (42)` of the ROM.

ROM ports are represented as separate operations:

- `seq.firrom.read_port`

These operations take the ROM itself as their first operand. The
remaining operands are the specific signals required for the
corresponding type of port: clocks, enables, mode select, etc.
Read ports also return the read data as their result. Enables
are optional to allow for more concise IR for simple memory
configurations.

The reason why adding a new `FirRomOp` instead of reusing the
`FirMemOp` to process Read-Only-Memory is because there are
still huge differences in the behaviors of ROM, SRAM, and
RegFile in different foundry memory compilers, and their DFT
processing is also very different. If they are all merged into
`FirMemOp`, a lot of attributes must be added to
`FirMemOp`, resulting in the post-processing having to judge
these attributes, which increases the burden of post-processing.
Therefore, adding `FirRomOp` as a new op is conducive to
behavior distinction and later maintenance, especially when we
want to add DFT and physical implementation details in the real
chip design process, it will be more conducive to implementation,
and reduce the cost of code errors caused by maintenance.

This commit merely adds the `FirRomOp` alongside some
canonicalization and general tests, but the op isn't used by any
part of CIRCT yet. Use in FIRRTL-to-HW lowering follows as a
separate commit.

Signed-off-by: Huang Rui <[email protected]>
Add the `LowerFirRom` pass which lowers `seq.firrom` ops to a
corresponding `hw.module.generated` op. The pass collects a list
of ROM ops in the design, distills them down into ROM parameters,
deduplicates those parameters, creates one `hw.module.generated` op
for each unique ROM config, and replaces the ROM ops with instances
of this generated module.

This commit reflects that ROM can configure the `numReadPorts`
parameter, because there are multi-port ROMs, for example:

https://www.intel.com/content/dam/altera-www/global/en_US/others/support/examples/download/dual_port_rom.zip

Signed-off-by: Huang Rui <[email protected]>
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.

2 participants