Hi Matthias,
We tried to merge multiple gds/oasis files which have similar cell name hierarchy,
with the following two ways the result is not what we want, could you please help to
give some hints to merge files with skip/overwrite cell when the same cell name is encountered ?
1. Declare one layout object and layout.read() more than two files, however the layout pattern and
instance in the same cell name would be repeat counted. If merge more than 10 files the display speed
of result file would be horrible slow.
2. Decalre three layout object, layout.read() two files into two objects, use copy_tree to copy topcell
of two objects to new_top objects, but this function would rename the same cell name to xxx$.
Best Regards,
--
chhung
Comments
Hi chhung,
What exactly do you want to achieve?
Method 1 is useful if you want to merge layouts by "adding information" to an existing layout. You can use this approach for example, if you have split a layout into several layouts containing the same hierarchy but different layers each. This approach is fast but dumb.
Method 2 will build separate hierarchy trees. Since cell names need to be unique, they have to be made unique by adding a suffix.
I guess your requirement is somewhat between both approaches. There a manifold ways to merge layouts, so you need to be specific about the actual requirement you have.
Regards,
Matthias
Hi Matthias,
We are trying the fast and dumb way for our approach. XD
For example:
We have two files(file1 / file2) and want to merge it to a new file(file3)
The cell hierarchy like
All the subcells are the same and only the topcell of file1 and file2 are different,
we hope to merge these files to new file3
If we use method 1, the new file3 would contain file1 and file2 ok,
however the file1 => cellA and file2 => cellA would have cellA1 * 2,
the new file3 would show cellA1 for four times, Once we merge more than
30~50 these kind of files, although the result file is still small but the
display speed would become too slow.
Best Regards,
chhung
Hi chhung,
I understand you basically want a smart way to detect that cells are identical and not copy over the contents. Right?
That's a feature not provided by the copy_... methods. But if you know that only the top cells differ, you can basically create an empty file2 cell in the target layout, copy over the shapes and the instances one by one, mapping the child cells to the corresponding ones in the target layout.
Matthias
It would be a wonderful world if the copy_tree() could support
an option to choose rename/overwrite/skip the same cell name. :P
I tried to do the steps(create target layout with file1/file2 topcell name),
however jammed on (copy source file1/file2 shapes and mapping instance to target).
May I ask help for some sample codes about this? @_@a
Best Regards,
--
chhung
Hi chhung,
I'm sorry, but I still don't get your problem. And I don't see any code I could help with.
In you sample, the hierarchies of file1 and file2 are identical. Will it be a solution then to copy over the objects of file2's top cell only? I mean, reproducing the instances within file2's top cell with the cells from file1?
Matthias
Hi Matthias,
Sorry to reply so late, I've learned about how to merge two db with the same hierarchy and only have different shapes in topcell. However I have no idea if the following line should be executed, is it used to refresh the prop id in the same db?
The codes:
Best Regards,
chhung
Hi chhung,
this script looks quite good already. I admit it could be easier, but lacking the right functions currently, it's the best way to emulate it.
The function you are looking for is:
Layout#properties_id
and the reverseLayout#properties
:Basically instances can have properties too, so you might need to apply the same to instances.
BTW: I assume that "db1" is the top cell of layout1. In that case you can write
new_layout1.cell_index
instead ofnewdb.cell_by_name("db1")
and the same for the second layout. That makes the script work even if the top cell name of layout1 or layout2 changes.Kind regards,
Matthias
Hi Matthias,
About the instance properties, the code is modified from
to
Is it correct ?
To write new_layout1.cell_index instead of newdb.cell_by_name("db1") is ok, however write new_layout2.cell_index instead of newdb.cell_by_name("db2") would get error, it said "undefined method `cell_index' for 13:Fixnum, is it because the new_layout1 was made by newdb.create_cell, and new_layout2 was made by newdb.add_cell ?
Best Regards,
chhung
Hi chhung,
the code looks correct. It's a bit bloated - you can probably simplify it a little exploiting the fact that a property id of "0" means "no property" and using the
RBA::CellInstArray
taken from theRBA::Instance
object (not tested):Regarding your second question: if you consistently use
create_cell
,new_layout2
will also be aRBA::Cell' object and the suggested code works. The older
add_cell` will basically do the same but already return a cell index which is less convenient to work with.Regards,
Matthias