migen icon indicating copy to clipboard operation
migen copied to clipboard

export as hierarchy (verilog modules)

Open jordens opened this issue 7 years ago • 6 comments

I'd like to be able to translate the migen Module hierarchy into the exported HDL hierarchy at least to some extent.

  • This would allow estimating resource usage at some useful granularity.
  • It would allow easier exporting and re-use of migen gateware in verilog/vhdl projects.
  • This would help with floor planning if one wants to do that.
  • Vivado at least seems to have some options that allow some synthesis to be hierarchy-constrained and therefore potentially scaling better.
  • I don't expect this to be able to map any of the metaprogramming and parametrization in migen to parametrization in verilog. That won't work. I am fine with exporting module parametrizations as separate and fully specialized modules.

Implementation idea:

  • Module would receive a list of ios
  • There would need to be some way to check/enforce/verify the interface, i.e. ensure that module inputs are not also assigned to from within a module and that internal Signals within a module are not accessed from the outside.
  • Some way to substitute a Module by an Instance.
  • build() would export specialized modules.

jordens avatar Jun 19 '17 15:06 jordens

i.e. ensure that module inputs are not also assigned to from within a module and that internal Signals within a module are not accessed from the outside.

Right now I see the fact that I can manipulate signals without regard to module boundaries as a major feature of Migen (and I believe it's used in ARTIQ quite a bit, too). Do you suggest blanket prohibiting this, or just when exporting? In any case, splitting the Migen language into two like that seems troublesome...

whitequark avatar Jun 19 '17 15:06 whitequark

No. This shouldn't touch existing code style or features at all. It's just an trade-off that one has to accept and deal with when exporting hierarchy. This will only give you the tools to do so.

jordens avatar Jun 19 '17 15:06 jordens

@jordens Are you actively working on this at the moment or is this something you would just like to see in the future?

mithro avatar Oct 08 '17 07:10 mithro

I would like to see it and don't have substantial progress.

jordens avatar Oct 08 '17 07:10 jordens

I think this can/should be done without requiring the user to specify a list of ios.

Just automatically infer them from how the module is used.

phire avatar Dec 11 '18 13:12 phire

Triage: fixed in nMigen.

whitequark avatar Jul 05 '19 14:07 whitequark