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

box_derive: New command to derive modules for boxes #4404

Merged
merged 12 commits into from
May 31, 2024
Merged

Conversation

povik
Copy link
Member

@povik povik commented May 21, 2024

In certain uses cases you want to derive modules for blackbox instances, which are otherwise ignored by the hierarchy process. Here we add a new command, box_derive, by which one can ask to have modules derived for a selected set of blackbox instances.

I can think of two use cases:

  • Functional modelling of blackboxes (the abc9 integration has an abc9_ops -prep_hier command to a similar end, we can merge those commands eventually)
  • Deriving of one of the possible implementations for a blackbox (where the blackbox is a blackbox because an implementation hasn't been selected yet)

An incomplete test is attached.

@povik
Copy link
Member Author

povik commented May 21, 2024

Help sample (updated after rename):


    box_derive [-base <base_module>] [-naming_attr <attr>] [selection]

As part of the assembly of the design hierarchy done by the 'hierarchy' command,
specializations of parametric modules are derived on demand: for each choice of
parameter values appearing in the design, a copy of the parametric module is
derived which is specialized to that choice.

This derivation process ignores blackboxes and whiteboxes (boxes). To supplement,
this 'box_derive' command can be used to request the derivation of modules based
on box instances appearing in the design, which is desirable in certain use
cases. Only the selected cells are considered as the instances that steer the
derivation process.

    -base <base_module>
        instead of deriving the module that directly corresponds to each box
        instance, derive a specialization of <base_module> (this option applies
        to all selected box cells)

    -naming_attr <attr>
        once a specialization is derived, use the value of the module attribute
        <attr> for a name which should be used for the derived module (this
        replaces the internal Yosys naming scheme in which the names of derived
        modules start with '$paramod$')

Copy link
Member

@whitequark whitequark left a comment

Choose a reason for hiding this comment

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

Bikeshed: should this not be called just blackbox_derive? We have blackbox already, so it'd be inconsistent otherwise.

tests/various/bbox_derive.ys Outdated Show resolved Hide resolved
@povik
Copy link
Member Author

povik commented May 21, 2024

Bikeshed: should this not be called just blackbox_derive? We have blackbox already, so it'd be inconsistent otherwise.

I don't have a strong preference, you could say this shouldn't be blackbox_derive because that gets to be too long.

@povik
Copy link
Member Author

povik commented May 21, 2024

box_derive also an option

@whitequark
Copy link
Member

box_derive seems nice, considering you also handle whiteboxes.

@povik povik force-pushed the povik/bbox_derive branch from 5520939 to c0a1961 Compare May 21, 2024 14:18
@povik povik changed the title bbox_derive: New command to derive modules for blackboxes box_derive: New command to derive modules for boxes May 21, 2024
@povik povik marked this pull request as ready for review May 21, 2024 14:37
tests/various/box_derive.ys Show resolved Hide resolved
passes/cmds/select.cc Outdated Show resolved Hide resolved
@povik povik added the merge-soon Merge: PR will be merged at the end of the next work day unless concerns are raised label May 29, 2024
@povik povik merged commit 4b67f37 into main May 31, 2024
38 checks passed
@povik povik deleted the povik/bbox_derive branch May 31, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-soon Merge: PR will be merged at the end of the next work day unless concerns are raised
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants