rdaly525 / coreir

BSD 3-Clause "New" or "Revised" License
99 stars 24 forks source link

Inline mantle wires #899

Closed leonardt closed 4 years ago

leonardt commented 4 years ago

See https://github.com/rdaly525/coreir/pull/897 for a case where this pops up.

One option would be to run inline_single_instances after the wire generator is run, however this might have the side effect of inlining other modules that match the single instance pattern but perhaps the user will not expect them to be inlined.

One option would be to extend inline_single_instances to accept a module/generator name as a parameter to filter the modules to be inlined.

Alternatively, we could use API to inline the wire module at the time it's inserted (ideally just reusing the code for inline single instances, but invoking it inside the passthrough logic that inserts the mantle wire)

rdaly525 commented 4 years ago

@rsetaluri and I discussed a feature like this to extend inline_single_instances. I think a very good approach is to have a consistent way to label (instances, modules, generators) as inlineable, then run the inline pass. So in this case we would label mantle.wire generator as inlinable and run the pass.

leonardt commented 4 years ago

That makes sense, perhaps we can use a metadata field?

rdaly525 commented 4 years ago

Yeah, I detailed the full proposal in #882