Add support for assigning references in importer API
Currently the importer API only allows building components with "regular" property values. Add support for assigning instance and property references to component properties.
Some considerations to be aware of:
- References that involve array indexes may require more complex construction, since simply providing the terminal endpoints is not enough information.
- Need an intuitive way for the user to be able to provide the lineage of array indexes as well.
- Alternatively, do not support this yet?
- ~~Will likely need to add a
parentmember to theComponentclass to facilitate construction of the internalComponentRefobject. I believe in most/all cases,parentshall never be deepcopied (copy by ref instead).~~- No longer possible to use this method. Back-end optimizations in 1.30.0 likely prevent this since identical Component instances get re-used, so they cannot have a common parent attribute.
- This will likely be implemented as
Importer.create_inst_reference()andImporter.create_prop_reference()methods.- Inputs are the source component, destination component, and source property name (for prop refs)
- Returns a
ComponentRef/PropertyRefobject respectively.
- When assigning the reference object via
Importer.assign_property(), check that a DPA is allowed.- Since prop refs imply a DPA, check that spec rules are not being violated inadvertently.
Hello @amykyta3.
This issue is blocking me right now.
I want to be able to assign a field instance to next, enable, field properties.
I know you are probably busy to implement it. If you already started working on it, or could give some more pointers, I could try to implement it.
I see for now that the assign_property() does not allow value to be a Component
https://github.com/SystemRDL/systemrdl-compiler/blob/191f4dd9bc093920720ddd47e8a15be97e6c5a25/systemrdl/importer.py#L312-L314