Save different instances of subcircuits separately #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
while keeping the format backward compatible.
Although different instances of subcircuits starts identical,
they corresponds to distinct runtime object and their internal
may deviate from each other due to edits done on each subcircuits.
The current format discard all the changes except for the first subcircuit
and apply the edit on the first subcircuit to all instances during loading.
This change modifies the saving format while keeping the file backward compatible
so that the new file can still be opened by old code, with only minor display differences.
This is done by automatically generate new celltype for each instances of the subcircuit
on saving and saving the old value that is only useful for display in a separate attribute
disp_celltype
. This automatic name generation is also only done when there aremultiple instances of the same cell type so that we can keep generating names shorter
and the file as closed to the old format as possible.
Make this a draft currently since there are a few things that can are up to debate.
If backward compatibility should be maintained. Personally I think it should be as much as possible. If backward compatibility is not to be maintained, this info can simply be saved into the devices and/or a diff version could be computed to save space, though I really don't think that's really necessary....
If I should try harder to not clone the subcircuits.
This can be done either by saving a flag marking whether anything has changed since the loading, or to simply detect if the resulting object matches (or both). The marker could potentially be separate for layout vs not, and it'll almost certainly have false positives due to no-op/reverted changes. It's much more difficult to track changes accurately and it doesn't save any saving time to detect the differences after serialization so I'm not doing either right now....