1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // BSD 3-Clause License
4 //
5 // Copyright (c) 2019, James Cherry, Parallax Software, Inc.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are met:
10 //
11 // * Redistributions of source code must retain the above copyright notice, this
12 //   list of conditions and the following disclaimer.
13 //
14 // * Redistributions in binary form must reproduce the above copyright notice,
15 //   this list of conditions and the following disclaimer in the documentation
16 //   and/or other materials provided with the distribution.
17 //
18 // * Neither the name of the copyright holder nor the names of its
19 //   contributors may be used to endorse or promote products derived from
20 //   this software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 // POSSIBILITY OF SUCH DAMAGE.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 %{
37 
38 #include "db_sta/dbSta.hh"
39 #include "ifp/InitFloorplan.hh"
40 
41 // Defined by OpenRoad.i
42 namespace ord {
43 
44 OpenRoad *
45 getOpenRoad();
46 
47 odb::dbDatabase *
48 getDb();
49 
50 sta::dbSta *
51 getSta();
52 }
53 
54 %}
55 
56 ////////////////////////////////////////////////////////////////
57 //
58 // C++ functions visible as TCL functions.
59 //
60 ////////////////////////////////////////////////////////////////
61 
62 %include "../../Exception.i"
63 
64 %inline %{
65 
66 namespace ifp {
67 
68 void
init_floorplan_core(double die_lx,double die_ly,double die_ux,double die_uy,double core_lx,double core_ly,double core_ux,double core_uy,const char * site_name)69 init_floorplan_core(double die_lx,
70 		    double die_ly,
71 		    double die_ux,
72 		    double die_uy,
73 		    double core_lx,
74 		    double core_ly,
75 		    double core_ux,
76 		    double core_uy,
77 		    const char *site_name)
78 {
79   odb::dbDatabase *db = ord::getDb();
80   sta::dbSta *sta = ord::getSta();
81   utl::Logger *logger = ord::getOpenRoad()->getLogger();
82   ifp::initFloorplan(die_lx, die_ly, die_ux, die_uy,
83 		     core_lx, core_ly, core_ux, core_uy,
84 		     site_name, db, logger);
85 }
86 
87 void
init_floorplan_util(double util,double aspect_ratio,double core_space_bottom,double core_space_top,double core_space_left,double core_space_right,const char * site_name)88 init_floorplan_util(double util,
89                     double aspect_ratio,
90                     double core_space_bottom,
91                     double core_space_top,
92                     double core_space_left,
93                     double core_space_right,
94                     const char *site_name)
95 {
96   odb::dbDatabase *db = ord::getDb();
97   sta::dbSta *sta = ord::getSta();
98   utl::Logger *logger = ord::getOpenRoad()->getLogger();
99   ifp::initFloorplan(util, aspect_ratio,
100                      core_space_bottom, core_space_top,
101                      core_space_left, core_space_right,
102                      site_name, db, logger);
103 }
104 
105 void
auto_place_pins_cmd(const char * pin_layer)106 auto_place_pins_cmd(const char *pin_layer)
107 {
108   odb::dbDatabase *db = ord::getDb();
109   sta::dbSta *sta = ord::getSta();
110   utl::Logger *logger = ord::getOpenRoad()->getLogger();
111   ifp::autoPlacePins(pin_layer, db, logger);
112 }
113 
114 } // namespace
115 
116 %} // inline
117