I have a working code generator, that on top-level, just instantiates modules and takes care of all the connectivty – that one is proven to be working.
I would like now to partition some of the instances into a seperate module, basically adding a hierarchy to the generated code. The top-level should now instantiate the new module (with the internal instantiation) and hook up the new signals. The module also needs to be generated automatically.
The question to me is now how to design that. On the one hand, I already have a working code generator but it needs changes.
- Rewrite the code generator to support partitions/hierarchies
- Perform a post-process step, that introduces the hierarchies
I am not sure if the second approach could be implemenented by parsing the generated RTL code into an AST, introduce the new hierarchy there, and then re-generate the RTL code.
Of couse, I am open for other design decisisons as well.