I think that a fix is needed in OpenLane during GD...
# openlane
I think that a fix is needed in OpenLane during GDS merge to prevent name conflicts in macros. (Or is this an OpenRoad problem?) This came up with OpenRAM memories, but it is a larger concern for any hardened macro. If a user duplicates any module name anywhere in the hierarchy, only the last design is kept. Obviously, this is wanted in some cases, eg standard cells, for reuse but not in other designs. I propose that we have a premerge processing where we add a unique suffix to any module, except the top one and if it is a standard cell. Comments?
gds unique
should do this, but has the inefficiency that all cells will get unique names, even those that really are reused.
So basically that does what you were suggesting except for the part about excluding cells like standard cells.
Ok, OpenLane should add this for macros then? I can see a user having a conflict in their own designs...
First it occurs to me to ask if you intended that this would be done on a GDS read or a GDS write.
I see; it would be done during GDS write. That would be a new feature that needs to be implemented.
I'm not clear how gds unique works. Is that during a read?
Yes, that's for GDS read.
That code reads in all the GDS files and then writes them, so it could be used there, right?
I'm not sure it's implementing the behavior you want. In general, I'd say that it's not the responsibility of the library to produce unique names, it's the responsibility of whatever is reading cells from the library to ensure that they are properly handled if the names collide.
Yes, I think that is why it should be there. This is what puts together the multiple macros/libraries. (Maybe we are talking around eachother?) Are EXTRA_GDS_FILES just the macros or libraries+macros?
I don't know what EXTRA_GDS_FILES is. The script was written by the OpenLane developers, and they use way too many environment variables instead of making script arguments and options.
I agree. I believe it is what you specify in your config.tcl for an openlane project.
Copy code
`::env(EXTRA_GDS_FILES)` To point at the GDS files of the hardened macros.
but I don't see where they read the libraries, so that makes me believe they might append those there.
I think I see. Since we are reading in the def/lef and replacing with GDS, it seems like we cannot use gds unique because the names are already defined in the def/lef.
Or something... magic is just telling me that gds unique isn't an option when it is in the merge GDS script.
That's odd. It works for me.
In their script?
It works for me outside of their script too
What version of magic is the script running? It shouldn't simply not recognize a command option.
If I run magic in the docker, it is using 8.3.180. I'm not sure if they override that somehow
Copy code
"unique" isn't a valid gds option.                                                                                                                                                           
GDS commands have the form ":gds option", where option is one of:                                                                                                                            
    help                print this help information                                                                                                                                          
    addendum [yes|no]   output only cells that are not type "readonly"                                                                                                                       
    arrays [yes|no]     output arrays as individual subuses (like in CIF)                                                                                                                    
    contacts [yes|no]   optimize output by arraying contacts as subcells                                                                                                                     
    drccheck [yes|no]   mark all cells as needing DRC checking                                                                                                                               
    flatten [yes|no|limit]      flatten simple cells (e.g., contacts) on input                                                                                                               
    flatglob [<name>|none]      flatten cells by name with glob patterning                                                                                                                   
    ordering [on|off]   cause cells to be read in post-order                                                                                                                                 
    labels [yes|no]     cause labels to be output when writing GDS-II                                                                                                                        
    library [yes|no]    do not output the top level, only subcells                                                                                                                           
    lower [yes|no]              allow both upper and lower case in labels                                                                                                                    
    merge [yes|no]              merge tiles into polygons in the output                                                                                                                      
    nodatestamp [yes|no]        write a zero value creation date stamp                                                                                                                       
    noduplicates [yes|no]       do not read cells that exist before reading GDS                                                                                                              
    read file           read Calma GDS-II format from "file"                                                                                                                                 
                into edit cell                                                                                                                                                               
    readonly [yes|no]   set cell as read-only and generate output from GDS file                                                                                                              
    rescale [yes|no]    allow or disallow internal grid subdivision                                                                                                                          
    warning [option]    set warning information level                                                                                                                                        
    write file          output Calma GDS-II format to "file"                                                                                                                                 
                for the window's root cell                                                                                                                                                   
    polygon subcells [yes|no]                                                                                                                                                                
                put non-Manhattan polygons into subcells                                                                                                                                     
    path subcells [yes|no]                                                                                                                                                                   
                put wire paths into individual subcells                                                                                                                                      
    undefined [allow|disallow]                                                                                                                                                               
                [dis]allow writing of GDS with calls to undefined cells                                                                                                                      
If no option is given, a CALMA GDS-II stream file is                                                                                                                                         
    produced for the root cell.                                                                                                                                                              
The current CIF output style ("cif ostyle") is used                                                                                                                                          
    to select the mask layers output by :gds write.                                                                                                                                          
The current CIF input style ("cif istyle") is used                                                                                                                                           
    to select the mask layers read by :gds read.                                                                                                                                             
[INFO]: Merging GDS /project/openlane/user_project_wrapper/../../gds/user_proj_example.gds
It must be using magic predating 8.3.160, then, which was April 28, so not all that long ago.
Hm. This is the challenge with this flow, it isn't clear what it does behind the scenes in most cases 😞
I had upgraded it in the Docker image, but evidently it isn't found by the scripts.
$ more build/version/magic.version Build Timestamp: 2021-06-18_17-37-00 f001502a1868977a4d9c9fc5a27c09b2589d744c