Remove Cells (Structures)
A user may want to remove one or more cells from a GDSII file. The command line option, -remove filename, deletes cell definitions listed in the file. If the number of cells to remove is large and they all share some common string, one can also use a regular expression in place of the list.
Command Line Syntax
gdsfilt input_file output_file structure -remove filename where input_file gdsii input file output_file gdsii file to create structure input file structure to process -remove filename remove structures with names matching those in the text file.
Remove File Contents
The rename file has two entries per line. The first entry must match (exactly - case sensitive) the name of a structure in the input file. The second entry will be the new name in the output file.
CELL_1 CELL_A CELL_2 CELL_B
If for some reason (since it is really not supposed to happen) you have structure names with spaces in them then you must use quotes to delimit input and output names.
"CELL 1"CELL A" "CELL 2"CELL B"
There must be unique relationship between input and output names. Two input names must not be mapped to a single output name (even inadvertently). Doing so will completely garble the resulting output file.
As an example we will use our very small file demo1.gds. Below you can see a screen shot of demo 1 along with the structure list (using Qckvu).
Now we will produce three different output files using the following command line and rename files:
This first example shows how to handle spaces in the structure names.
gdsfilt demo1.gds demo1_ex1.gds = -rename example1.lst
The second example changes the names from upper case to lower case.
gdsfilt demo1.gds demo1_ex2.gds = -rename example2.lst
The third example only changes some of the names.
gdsfilt demo1.gds demo1_ex3.gds = -rename example3.lst
Using a Regular Expression to Remove Structures
We recently wanted to remove dummy metal from a large GDSII file as it slowed down the processing of the file (for net tracing) and we knew that that the dummy metal was not part of any net we wanted to trace.
Unlike some designs, where a separate data type is used to delineate dummy metal fill, in this design there were numerous structures that had been inserted at many different levels of the hierarchy that contained dummy metal fill on the same layer as metal we wanted to analyze. So we could not use layer filtering.
Dummy metal file we want to remove
We examined the GDSII file and noticed that all of the structures that held the dummy fill had the string: _DMx in them.
STRUCTURE_LIST 1) DM7_L_DMx 2) RF1SHD_64X28DECODER_DMx 3) RF1SHD_64X28CK2_DMx 4) RF1SHD_64X28HXPS_DMx 5) RF1SHD_64X28M24BOT_DMx 6) RF1SHD_64X28_DMx 7) RF2SH_128X20CTRL_SA_R_DMx 8) RF2SH_128X20_DMx 9) RF2SH_32X22CTRL_SA_R_DMx 10) RF2SH_32X22_DMx 11) RF2SH_256X19BCOL_M_DNMY_DMx 12) RF2SH_256X19CTRL_SA_R_DMx 13) RF2SH_256X19HXP24_DMx 14) RF2SH_256X19HXP24R_DMx 15) RF2SH_256X19HYP24_DMx 16) DM2_S_DMx 17) DM1_S_DMx 18) RF2SH_256X19_DMx 19) RF2SH_512X18BCOL_M_DNMY_DMx 20) RF2SH_512X18CTRL_SA_R_DMx 21) RF2SH_512X18_DMx 22) RA1SHDbit_1024X32HBFX_DMx . . . 2366) RA1SHD_800X28VIANOMX32B 2367) RA1SHD_800X28VIA_CD_DRSTUB 2368) RA1SHD_800X28VIA_CD_DWSTUB 2369) RA1SHD_800X28CDXX 2370) RA1SHD_800X28CDX 2371) RA1SHD_800X28MUX_CD_ODD 2372) RA1SHD_800X28SA8 2373) RA1SHD_800X28VIAIOSG 2374) RA1SHD_800X28IO8 2375) RA1SHD_800X28VIA_IO_WESTUB
This means that we can use a "regular expression" to match all those structure names and remove them. This would be much easier than actually creating the list.
Regular ExpressionThe regular expression that would match our dummy fill cells is:
Short Explanation of this Regular Expression
"^" indicates the beginning the string to be matched ".*" matches zero or more occurrences of any character basically we don't care what happens in the front of the structure name string. "DMx$" the last three characters of the string must match DMx. this does our filtering work for us.
Running GDSFILT with the regular expression
We now run the file, caw_test1.gds through GDSFILT using the -remove command line argument which will remove any cells in the resulting output file that match our regular expression. The output file should be a lot smaller and easier to handle.
$ gdsfilte caw_test1.gds caw_test1b.gds = -remove remove_list.txt where gdsfilte name of the gdsfilt executable engine caw_test1.gds our input file caw_test1b.gds the output file to create = use the top structure of the input file -remove remove_list.txt the remove argument referencing the file remove_list.txt The file remove_list.txt contains a single line: ^.*DMx$
Here's a snapshot of the same layer/location after filtering:
Example 2 - Removing Vias using Regular Expression
Let's look at another example of removing a large number of cells based on name. Our large file had a lot of vias; most of them arrayed. Assuming we want to remove these without affect the rest of the layout how can we do it?
An inspection of the structure names quickly showed that these via arrays all started with
$$via. So a regular expression can be used to identify and remove them.