diff --git a/.gitmodules b/.gitmodules index e847b2d72f7..e12b83e126e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,7 +11,13 @@ path = src/replace url = https://github.com/The-OpenROAD-Project/RePlAce.git branch = openroad +[submodule "src/ioPlacer"] + path = src/ioPlacer + url = https://github.com/The-OpenROAD-Project/ioPlacer.git [submodule "src/opendp"] path = src/opendp url = https://github.com/The-OpenROAD-Project/OpenDP.git branch = openroad +[submodule "src/FastRoute4-lefdef"] + path = src/FastRoute4-lefdef + url = https://github.com/The-OpenROAD-Project/FastRoute4-lefdef.git diff --git a/README.md b/README.md index d88819a5d11..f8bbca433a5 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ There are a set of regression tests in `/test`. ``` test/regression fast +src/resizer/test/regression fast + ``` #### Run @@ -150,7 +152,7 @@ Place pins around core boundary. Gate resizer commands are shown below. ``` -set_wire_rc [-resistance res ] [-capacitance cap] [-corner corner_name] +set_wire_rc [-layer layer_name] [-resistance res ] [-capacitance cap] [-corner corner_name] resize [-buffer_inputs] [-buffer_outputs] [-resize] @@ -163,17 +165,21 @@ resize [-buffer_inputs] report_design_area ``` -The `set_wire_rc` command sets the resistance (liberty -resistance_unit/distance_unit) and capacitance (liberty -capacitance_unit/distance_unit) of routing wires. It adds RC -parasitics based on placed component pin locations. If there are no -component locations no parasitics are added. The resistance and -capacitance are per distance unit of a routing wire. Use the -`set_units` command to check units or `set_cmd_units` to change -units. They should represent "average" routing layer resistance and -capacitance. If the set_wire_rc command is not called before resizing, -the default_wireload model specified in the first liberty file or with -the SDC set_wire_load command is used to make parasitics. +The `set_wire_rc` command sets the resistance and capacitance used to +estimate delay of routing wires. Use `-layer` or `-resistance` and +`-capacitance`. If `-layer` is used, the LEF technology resistance +and area/edge capacitance values for the layer are used. The units +for `-resistance` and `-capacitance` are from the first liberty file +read, resistance_unit/distance_unit and liberty +capacitance_unit/distance_unit. RC parasitics are added based on +placed component pin locations. If there are no component locations no +parasitics are added. The resistance and capacitance are per distance +unit of a routing wire. Use the `set_units` command to check units or +`set_cmd_units` to change units. They should represent "average" +routing layer resistance and capacitance. If the set_wire_rc command +is not called before resizing, the default_wireload model specified in +the first liberty file or with the SDC set_wire_load command is used +to make parasitics. The `resize` command buffers inputs and outputs, resizes gates, and then uses buffer insertion to repair maximum capacitance and slew diff --git a/include/openroad/OpenRoad.hh b/include/openroad/OpenRoad.hh index 566bd898d93..3d36711dc71 100644 --- a/include/openroad/OpenRoad.hh +++ b/include/openroad/OpenRoad.hh @@ -28,6 +28,14 @@ class dbNetwork; class Resizer; } +namespace ioPlacer { +class IOPlacementKernel; +} + +namespace FastRoute { +class FastRouteKernel; +} + namespace opendp { class opendp_external; } @@ -78,7 +86,9 @@ private: dbVerilogNetwork *verilog_network_; sta::dbSta *sta_; sta::Resizer *resizer_; + ioPlacer::IOPlacementKernel *ioPlacer_; opendp::opendp_external *opendp_; + FastRoute::FastRouteKernel *fastRoute_; // Singleton used by tcl command interpreter. static OpenRoad *openroad_; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c0d5061400f..3c0e29a7180 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,6 +21,10 @@ set(OPENDB_WRAP ${CMAKE_CURRENT_BINARY_DIR}/OpenDB_wrap.cc) set(RESIZER_HOME ${PROJECT_SOURCE_DIR}/src/resizer) set(OPENDP_HOME ${PROJECT_SOURCE_DIR}/src/opendp) +set(IOPLACER_HOME ${PROJECT_SOURCE_DIR}/src/ioPlacer) + +set(FASTROUTE_HOME ${PROJECT_SOURCE_DIR}/src/FastRoute4-lefdef) + set(OPENROAD_WRAP ${CMAKE_CURRENT_BINARY_DIR}/OpenRoad_wrap.cc) set(OPENROAD_TCL_INIT ${CMAKE_CURRENT_BINARY_DIR}/OpenRoadTclInitVar.cc) @@ -68,17 +72,6 @@ add_custom_command(OUTPUT ${OPENROAD_WRAP} DEPENDS OpenRoad.i InitFloorplan.i ) -################################################################ - -add_subdirectory(OpenDB) -add_subdirectory(OpenSTA) -add_subdirectory(dbSta) -add_subdirectory(resizer) -add_subdirectory(flute3) -add_subdirectory(replace) -add_subdirectory(opendp) - -################################################################ ################################################################ # @@ -155,6 +148,23 @@ if (NOT TCL_HEADER) endif() message(STATUS "TCL header: ${TCL_HEADER}") get_filename_component(TCL_HEADER_DIR "${TCL_HEADER}" PATH) +include_directories(SYSTEM ${TCL_HEADER_DIR}) + +################################################################ + +# Disable OpenDB stand-alone executable builds. +# Simplistic findTCL fails on OSX. +set(BUILD_PYTHON false) +set(BUILD_TCL false) +add_subdirectory(OpenDB) +add_subdirectory(OpenSTA) +add_subdirectory(dbSta) +add_subdirectory(resizer) +add_subdirectory(flute3) +add_subdirectory(replace) +add_subdirectory(opendp) +add_subdirectory(ioPlacer) +add_subdirectory(FastRoute4-lefdef) ################################################################ @@ -168,6 +178,7 @@ target_include_directories(openroad ${OPENROAD_HOME}/src ${OPENDB_HOME}/include ${OPENDP_HOME}/include + ${FASTROUTE_HOME}/include flute3 ) @@ -175,10 +186,12 @@ target_link_libraries(openroad replace opendp resizer + ioPlacer flute dbSta OpenSTA opendb + FR4lefdef zutil zlib tm @@ -194,6 +207,10 @@ if (ZLIB_FOUND) target_link_libraries(openroad ${ZLIB_LIBRARIES}) endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_link_libraries(openroad -pthread) +endif() + target_compile_options(openroad PUBLIC ${COMPILE_OPTIONS}) ################################################################ @@ -203,8 +220,7 @@ target_compile_options(openroad PUBLIC ${COMPILE_OPTIONS}) # executable install(TARGETS openroad DESTINATION bin) # etc magic flute files -INSTALL( FILES ../etc/POST9.dat DESTINATION etc) -INSTALL( FILES ../etc/POWV9.dat DESTINATION etc) +install(FILES ../etc/POST9.dat ../etc/POWV9.dat DESTINATION etc) ################################################################ @@ -219,3 +235,4 @@ add_custom_target(openroad_tags etags -o TAGS WORKING_DIRECTORY ${OPENROAD_HOME}/src DEPENDS ${OPENROAD_SOURCE} ${OPENROAD_HEADERS} ${OPENROAD_TCL_FILES} ) + diff --git a/src/FastRoute4-lefdef b/src/FastRoute4-lefdef new file mode 160000 index 00000000000..a8f23f2d25e --- /dev/null +++ b/src/FastRoute4-lefdef @@ -0,0 +1 @@ +Subproject commit a8f23f2d25eacdfc21430ccc81e648f6f4492f62 diff --git a/src/OpenDB b/src/OpenDB index f24aca5dc33..06eac331fa2 160000 --- a/src/OpenDB +++ b/src/OpenDB @@ -1 +1 @@ -Subproject commit f24aca5dc33140f8736754aa1f986fd69de83a3d +Subproject commit 06eac331fa2d15b90a7745cef33daed70fff7d92 diff --git a/src/OpenRoad.cc b/src/OpenRoad.cc index 9e902c73e60..1a9a633a433 100644 --- a/src/OpenRoad.cc +++ b/src/OpenRoad.cc @@ -28,10 +28,15 @@ #include "openroad/InitOpenRoad.hh" #include "InitFlute.hh" + +#include "ioPlacer/src/MakeIoplacer.h" + #include "resizer/MakeResizer.hh" #include "opendp/MakeOpendp.h" #include "replace/src/MakeReplace.h" +#include "FastRoute4-lefdef/src/MakeFastRoute.h" + namespace sta { extern const char *openroad_tcl_inits[]; } @@ -41,6 +46,8 @@ extern "C" { extern int Openroad_Init(Tcl_Interp *interp); extern int Opendbtcl_Init(Tcl_Interp *interp); extern int Replace_Init(Tcl_Interp *interp); +extern int Ioplacer_Init(Tcl_Interp *interp); +extern int Fastroute_Init(Tcl_Interp *interp); } namespace ord { @@ -93,8 +100,10 @@ OpenRoad::init(Tcl_Interp *tcl_interp, db_ = dbDatabase::create(); sta_ = makeDbSta(); verilog_network_ = makeDbVerilogNetwork(); + ioPlacer_ = (ioPlacer::IOPlacementKernel*) makeIoplacer(); resizer_ = makeResizer(); opendp_ = makeOpendp(); + fastRoute_ = (FastRoute::FastRouteKernel*) makeFastRoute(); // Init components. Openroad_Init(tcl_interp); @@ -105,10 +114,12 @@ OpenRoad::init(Tcl_Interp *tcl_interp, initDbSta(this); initResizer(this); initDbVerilogNetwork(this); + initIoplacer(this); initFlute(prog_arg); initReplace(this); initOpendp(this); - + initFastRoute(this); + // Import exported commands to global namespace. Tcl_Eval(tcl_interp, "sta::define_sta_cmds"); Tcl_Eval(tcl_interp, "namespace import sta::*"); diff --git a/src/OpenSTA b/src/OpenSTA index 7ef710054bf..f3d987b4f89 160000 --- a/src/OpenSTA +++ b/src/OpenSTA @@ -1 +1 @@ -Subproject commit 7ef710054bfcd711a85d6189ad2e023fb10ced3d +Subproject commit f3d987b4f890f52d40a01cec38f97a1d7dc1b8d6 diff --git a/src/ioPlacer b/src/ioPlacer new file mode 160000 index 00000000000..0a3a2886b0e --- /dev/null +++ b/src/ioPlacer @@ -0,0 +1 @@ +Subproject commit 0a3a2886b0ec6876ec45a3f899c09ff647141e9a diff --git a/src/opendp b/src/opendp index 0c7fa057bd0..a431bb942aa 160000 --- a/src/opendp +++ b/src/opendp @@ -1 +1 @@ -Subproject commit 0c7fa057bd04e9e35c037bad0ec119d392a450f7 +Subproject commit a431bb942aa9ed83298f87ccf4b5e31ed49a5b0b diff --git a/src/replace b/src/replace index 7b31f8eaefe..50cba64d357 160000 --- a/src/replace +++ b/src/replace @@ -1 +1 @@ -Subproject commit 7b31f8eaefec39af6921867dd6d9b990b825bc72 +Subproject commit 50cba64d357ef92918e5112bd893b96ff0e8dff8 diff --git a/src/resizer/src/Resizer.i b/src/resizer/src/Resizer.i index 03dfecdfa34..5dbdcde77b0 100644 --- a/src/resizer/src/Resizer.i +++ b/src/resizer/src/Resizer.i @@ -130,7 +130,7 @@ wire_resistance() // farads/meter double -wire_capacitance() +wire_capacitanceb() { Resizer *resizer = getResizer(); return resizer->wireCapacitance(); diff --git a/src/resizer/src/Resizer.tcl b/src/resizer/src/Resizer.tcl index a16afa4239a..99e82165c90 100644 --- a/src/resizer/src/Resizer.tcl +++ b/src/resizer/src/Resizer.tcl @@ -19,28 +19,55 @@ namespace eval sta { # Defined by SWIG interface Resizer.i. define_cmd_args "set_dont_use" {cell dont_use} -define_cmd_args "set_wire_rc" {[-resistance res ][-capacitance cap]\ +define_cmd_args "set_wire_rc" {[-layer layer_name]\ + [-resistance res ][-capacitance cap]\ [-corner corner_name]} proc set_wire_rc { args } { parse_key_args "set_wire_rc" args \ - keys {-resistance -capacitance -corner} flags {} + keys {-layer -resistance -capacitance -corner} flags {} set wire_res 0.0 - if [info exists keys(-resistance)] { - set res $keys(-resistance) - check_positive_float "-resistance" $res - } set wire_cap 0.0 - if [info exists keys(-capacitance)] { - set cap $keys(-capacitance) - check_positive_float "-capacitance" $cap + + if { [info exists keys(-layer)] } { + if { [info exists keys(-resistance)] \ + || [info exists keys(-capacitance)] } { + sta_error "Use -layer or -resistance/-capacitance but not both." + } + set layer_name $keys(-layer) + set layer [[[ord::get_db] getTech] findLayer $layer_name] + if { $layer == "NULL" } { + sta_error "layer $layer_name not found." + } + set layer_width [ord::dbu_to_microns [$layer getWidth]] + set res_ohm_per_micron [expr [$layer getResistance] / $layer_width] + set cap_pf_per_micron [expr [ord::dbu_to_microns 1] * $layer_width \ + * [$layer getCapacitance] \ + + [$layer getEdgeCapacitance] * 2] + # ohms/sq + set wire_res [expr $res_ohm_per_micron * 1e+6] + # F/m^2 + set wire_cap [expr $cap_pf_per_micron * 1e-12 * 1e+6] + puts "$wire_res $wire_cap" + } else { + if { [info exists keys(-resistance)] } { + set res $keys(-resistance) + check_positive_float "-resistance" $res + set wire_res [expr [resistance_ui_sta $res] / [distance_ui_sta 1.0]] + } + + if { [info exists keys(-capacitance)] } { + set cap $keys(-capacitance) + check_positive_float "-capacitance" $cap + set wire_cap [expr [capacitance_ui_sta $cap] / [distance_ui_sta 1.0]] + } } + set corner [parse_corner keys] check_argc_eq0 "set_wire_rc" $args - set r [expr [resistance_ui_sta $res] / [distance_ui_sta 1.0]] - set c [expr [capacitance_ui_sta $cap] / [distance_ui_sta 1.0]] - set_wire_rc_cmd $r $c $corner + + set_wire_rc_cmd $wire_res $wire_cap $corner } define_cmd_args "resize" {[-buffer_inputs]\ diff --git a/src/resizer/test/liberty1.lef b/src/resizer/test/liberty1.lef index d0a116389f1..c56141f7fe8 100644 --- a/src/resizer/test/liberty1.lef +++ b/src/resizer/test/liberty1.lef @@ -15,6 +15,9 @@ LAYER M1 WIDTH 0.1 ; OFFSET 0.1 ; AREA 0.042 ; + RESISTANCE RPERSQ 0.38 ; + CAPACITANCE CPERSQDIST 7.7161e-05 ; + EDGECAPACITANCE 2.7365e-05 ; END M1 LAYER M2 @@ -24,6 +27,9 @@ LAYER M2 WIDTH 0.1 ; OFFSET 0.1 ; AREA 0.052 ; + RESISTANCE RPERSQ 0.25 ; + CAPACITANCE CPERSQDIST 4.0896e-05 ; + EDGECAPACITANCE 2.5157e-05 ; END M2 SITE site1 diff --git a/src/resizer/test/make_parasitics1.ok b/src/resizer/test/make_parasitics1.ok index 11ce82855c3..4233e36212c 100644 --- a/src/resizer/test/make_parasitics1.ok +++ b/src/resizer/test/make_parasitics1.ok @@ -10,35 +10,6 @@ Notice 0: Created 5 components and 24 component-terminals. Notice 0: Created 2 special nets and 10 connections. Notice 0: Created 7 nets and 14 connections. Notice 0: Finished DEF file: reg3.def -Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) -Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) -Path Group: clk -Path Type: max - - Delay Time Description ---------------------------------------------------------- - 0.00 0.00 clock clk (rise edge) - 0.00 0.00 clock network delay (ideal) - 0.00 0.00 ^ r2/CP (snl_ffqx1) - 0.23 0.23 v r2/Q (snl_ffqx1) - 0.14 0.37 v u1/Z (snl_bufx1) - 0.13 0.50 v u2/Z (snl_and02x1) - 0.00 0.50 v r3/D (snl_ffqx1) - 0.50 data arrival time - - 10.00 10.00 clock clk (rise edge) - 0.00 10.00 clock network delay (ideal) - 0.00 10.00 clock reconvergence pessimism - 10.00 ^ r3/CP (snl_ffqx1) - -0.10 9.90 library setup time - 9.90 data required time ---------------------------------------------------------- - 9.90 data required time - -0.50 data arrival time ---------------------------------------------------------- - 9.40 slack (MET) - - Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) Path Group: clk diff --git a/src/resizer/test/make_parasitics1.tcl b/src/resizer/test/make_parasitics1.tcl index cc8a242e69d..5adcd581d50 100644 --- a/src/resizer/test/make_parasitics1.tcl +++ b/src/resizer/test/make_parasitics1.tcl @@ -1,4 +1,4 @@ -# make_parasitics +# set_wire_rc read_liberty liberty1.lib read_lef liberty1.lef read_def reg3.def @@ -6,8 +6,6 @@ read_def reg3.def create_clock -period 10 clk set_input_delay -clock clk 0 in1 -report_checks - # microns set lambda .12 # kohm/Square. diff --git a/src/resizer/test/make_parasitics2.ok b/src/resizer/test/make_parasitics2.ok new file mode 100644 index 00000000000..225374733ce --- /dev/null +++ b/src/resizer/test/make_parasitics2.ok @@ -0,0 +1,42 @@ +Notice 0: Reading LEF file: liberty1.lef +Notice 0: Created 2 technology layers +Notice 0: Created 6 library cells +Notice 0: Finished LEF file: liberty1.lef +Notice 0: +Reading DEF file: reg3.def +Notice 0: Design: reg1 +Notice 0: Created 3 pins. +Notice 0: Created 5 components and 24 component-terminals. +Notice 0: Created 2 special nets and 10 connections. +Notice 0: Created 7 nets and 14 connections. +Notice 0: Finished DEF file: reg3.def +2500000.0 5.03180896e-11 +Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) +Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) +Path Group: clk +Path Type: max + + Delay Time Description +--------------------------------------------------------- + 0.00 0.00 clock clk (rise edge) + 0.00 0.00 clock network delay (ideal) + 0.00 0.00 ^ r2/CP (snl_ffqx1) + 0.29 0.29 v r2/Q (snl_ffqx1) + 0.22 0.51 v u1/Z (snl_bufx1) + 0.22 0.73 v u2/Z (snl_and02x1) + 0.01 0.73 v r3/D (snl_ffqx1) + 0.73 data arrival time + + 10.00 10.00 clock clk (rise edge) + 0.00 10.00 clock network delay (ideal) + 0.00 10.00 clock reconvergence pessimism + 10.00 ^ r3/CP (snl_ffqx1) + -0.12 9.88 library setup time + 9.88 data required time +--------------------------------------------------------- + 9.88 data required time + -0.73 data arrival time +--------------------------------------------------------- + 9.14 slack (MET) + + diff --git a/src/resizer/test/make_parasitics2.tcl b/src/resizer/test/make_parasitics2.tcl new file mode 100644 index 00000000000..a9fb06f00d6 --- /dev/null +++ b/src/resizer/test/make_parasitics2.tcl @@ -0,0 +1,10 @@ +# set_wire_rc -layer +read_liberty liberty1.lib +read_lef liberty1.lef +read_def reg3.def + +create_clock -period 10 clk +set_input_delay -clock clk 0 in1 + +set_wire_rc -layer M2 +report_checks diff --git a/src/resizer/test/regression_vars.tcl b/src/resizer/test/regression_vars.tcl index bc6d4a9428d..95bb57f5419 100644 --- a/src/resizer/test/regression_vars.tcl +++ b/src/resizer/test/regression_vars.tcl @@ -122,6 +122,7 @@ proc list_delete { list delete } { # Record tests in resizer/test record_resizer_tests { make_parasitics1 + make_parasitics2 rebuffer1 rebuffer2 rebuffer3