TILOS-AI-Institute / MacroPlacement

Macro Placement - benchmarks, evaluators, and reproducible results from leading methods in open source
BSD 3-Clause "New" or "Revised" License
219 stars 43 forks source link

Error during LEF/DEF (Openlane) to Protobuf conversion #45

Open RustamC opened 1 year ago

RustamC commented 1 year ago

Hi! I'm trying to convert my LEF/DEF files (obtained after global placement in OpenLane) to Protobuf using new Tcl script.

I was running these commands:

set ALL_LEFS "
    ../test/ProtocolBuffer2LefDef/lefs/merged.nom.lef
"
set site "unithd"
foreach lef_file ${ALL_LEFS} {
    read_lef $lef_file
}
read_def ../test/ProtocolBuffer2LefDef/design/test_macro.def
source gen_pb_or.tcl
gen_pb_netlist ../test/ProtocolBuffer2LefDef/test_macro.pb.txt

and got this error message:

OpenROAD v2.0-5083-ga783d1b9c
This program is licensed under the BSD-3 license. See the LICENSE file for details.
Components of this program may be licensed under more restrictive licenses which must be honored.
[INFO ODB-0222] Reading LEF file: ../test/ProtocolBuffer2LefDef/lefs/merged.nom.lef
[WARNING ODB-0220] WARNING (LEFPARS-2036): SOURCE statement is obsolete in version 5.6 and later.
The LEF parser will ignore this statement.
To avoid this warning in the future, remove this statement from the LEF file with version 5.6 or later. See file ../test/ProtocolBuffer2LefDef/lefs/merged.nom.lef at line 68342.

[INFO ODB-0223]     Created 13 technology layers
[INFO ODB-0224]     Created 25 technology vias
[INFO ODB-0225]     Created 442 library cells
[INFO ODB-0226] Finished LEF file:  ../test/ProtocolBuffer2LefDef/lefs/merged.nom.lef
[INFO ODB-0127] Reading DEF file: ../test/ProtocolBuffer2LefDef/design/test_macro.def
[INFO ODB-0128] Design: test_macro
[INFO ODB-0130]     Created 299 pins.
[INFO ODB-0131]     Created 8745 components and 25114 component-terminals.
[INFO ODB-0132]     Created 2 special nets and 20886 connections.
[INFO ODB-0133]     Created 1352 nets and 4067 connections.
[INFO ODB-0134] Finished DEF file: ../test/ProtocolBuffer2LefDef/design/test_macro.def
Error: to_proto.tcl, 10 invalid command name "NULL"

Input files: test_macro.zip

What could be the problem?

RustamC commented 1 year ago

After some research I've found that the problem is in write_node_stdcell procedure during printing all sinks: https://github.com/TILOS-AI-Institute/MacroPlacement/blob/077a4f6c2c258a64c758b928aa40023f116daa0f/CodeElements/FormatTranslators/src/gen_pb_or.tcl#L303-L308

net_ptr can be "NULL" and after adding check it worked:

if {$net_ptr != "NULL"} {
    print_net $net_ptr $fp
}