-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can you store an instance's information in an HRef object? #155
Comments
Hello Jacob, thank you for your reply. The method you proposed above still saves parameters for each Parameters like Height and Width happens to be the same for |
I was thinking more about it, mainly to categorize different parameters expected on each hObject, but I couldn't think of anything other than |
I guess I managed to add this functionality in the exiting structure itself My idea here is while creating the This is how I extract methods to copy in HRef object This is how it is extended and this is the body of the copied method which can perform different functions based on who called it (its own object or HRef) Let me know your comments, I will clean up and create PR for this as well |
There is more going on with this issue than we have considered. As @jacobdbrown4 mentions above, the current convention for storing properties is to store them with the instance or definition of the netlist. As @ganeshgore mentions, this is problematic for giving different hierarchical instances of the same instance different property values. In netlist viewer like Vivado, only the hierarchical view of the netlist is accessible to the user, all of the underlying data structures are hidden from the user. I am not sure how Vivado handles the case of where different instances of the same hierarchical instances are placed. In our use of SpyDrNet in the past, we have made a copy of all non-leaf definitions so that each definition is only instanced once. This uniquification has allowed us to apply techniques like TMR and DWC, changing property values, on specific hierarchical instances without affecting other instances. What @ganeshgore is proposing may also be accomplished by adding a dictionary to the slots collection of the href class, but there are some complications that must be considered, like what happens when the path changes, how would these properties get stored out to disk (EDIF or verilog would require uniquification of hierarchical instances), etc. HRef was originally designed to be a lite unique reference to the actual netlist data. I am not sure what adding heavy data objects to the href will do to the design approach in SpyDrNet. All hrefs are unique, and all exist virtually whether they are instanced in memory or not. Outdated hrefs can exist that are no longer valid. Garbage collection will remove any href that is not reference explicitly somewhere in your code. What happens now when properties are stored with hrefs? We can't let them be garbage collected because we will lose the associated properties. We could consider maintaining a complete collection of hrefs that follow the netlist, or just work with hierarchical instances. But the issues mentioned above are still there. A principle that SpyDrNet tries to follow is "cause the least amount of change as needed." If we went all hierarchical instances, then we may lose some of the structure on the netlist brought in (unique copies of non-leaf definitions vs multiple instances of the same non-leaf definition). There is definitely a need for what is being described, and I like the ideas that are being discussed. What are some additional ideas of how we can approach this? |
Is the uniquify function available in the spydrnet? or is is only in spydrnet-shrec right now? |
Hello @andrewmkeller Thanks for your review I thought about the type of properties we HRef objects can have, and I came up with the following categories. 1] Instance Specific: This property is like name, width, and height; irrespective of what is HRef of this instance, it will be the same
"... accomplished by adding a dictionary to the slots collection of the Href class ... "
"... We can't let them be garbage collected because we will lose the associated properties. ..." Let me know if I am missing out on something |
The uniquify function is available in spydrnet. See https://github.com/byuccl/spydrnet/blob/master/spydrnet/uniquify.py. This operation on the netlist makes a copy of all non-leaf definitions until each non-leaf definition is only ever instanced once in the netlist at most. This operation is different than flattening the netlist. It preserves the hierarchy of the netlist while also making it so that each instance of a definition is unique. There may be multiple copies of the same non-leaf definition, but each copy is only ever instanced once. This function is documented https://byuccl.github.io/spydrnet/docs/stable/reference/uniquify.html, but the documentation could be improved.
The function is easy function to use:
It looks like we don't have any examples that use this function in the spydrnet repository. We should add some examples.
Below is an example of uniquify. Before
After
Hierarchy is preserved, but now the properties of the LUT instances can be changed without affecting multiple areas of the netlist. If you run uniqueify on your netlist first, then you can change the properties of href.item without changing the properties of different instances of the same item (since the item referenced is now only instanced once). |
In response to #155 (comment) from @ganeshgore. While we don't know exactly how top EDAs associate properties with specific hierarchical instances, it is clear that they sometimes use a type of href in constraint files to store property values out to disk. For example, when storing locations of cell instances, they might have a file that contains them like this:
In this way, the property can be stored without necessarily storing it with the netlist. This approach can also help when you want to store a single property to the lots of items in the netlist. I would l like to look at what happens to the netlist with the example in the scenario above #155 (comment). |
@ganeshgore @andrewmkeller is this issue still relevant or can I close it? |
HRef objects are meant to reference netlist objects (such as instances, ports, wires) by giving the hierarchical sequence to the object. This enables one to ensure they are accessing the correct object when modifying a netlist.
If one wanted to store information about an hinstance, a suggested and more correct way would be to actually store the information in the instance object itself, not the hinstance. Doing this is pretty simple. The following is an example of getting hinstances, using '.item' to access the instance object, assigning them lengths and widths (as an example of storing extra information), and then re-accessing the information later.
Hopefully this helps!
The text was updated successfully, but these errors were encountered: