chisel2-deprecated
chisel2-deprecated copied to clipboard
Allow for users to attach metadata to module
It would be beneficial for the purposes of writing frontend libraries that wish to reflect on Chisel modules and nodes over multiple passes or functions to be able to store information somewhere between passes.
Since storing it outside the graph in some mutable global area is generally bad, having some sort of key-value store in each Module to hold the information would be ideal. (At the moment, giving individual nodes a key-value store is likely too heavy at the moment. Note that Nodes belong to a Module and thus such passes could just use the Module's key-value store.)
The key-value store should have some sort of mechanism to ensure that the type information of items stored and retrieved is retained (perhaps by associating the expected value with the declaration of the key). Also, the key should not merely be strings (as collisions could easily occur) and leverage Scala features to ensure each key-value store client can isolate their values from other clients.
Sounds good. Not quite sure how to do the type information in a portable way though.
But how about this:
val userdata = ArrayBuffer[Map[Any, Any]]()
Each 'client' can then create their own Map and remember their index.