@@ -191,136 +191,138 @@ proc set_unit_values { unit key suffix key_var } {
191191
192192# ###############################################################
193193
194- define_cmd_args " delete_from_list" {list objs }
194+ define_cmd_args " delete_from_list" {list delete }
195195
196- proc delete_from_list { list objects } {
197- delete_objects_from_list_cmd $list $objects
196+ proc delete_from_list { list delete } {
197+ delete_objects_from_list_cmd $list $delete
198198}
199199
200- proc delete_objects_from_list_cmd { list objects } {
201- set list0 [lindex $list 0]
202- set list_is_object [is_object $list0 ]
203- set list_type [object_type $list0 ]
204- foreach obj $objects {
205- # If the list is a collection of tcl objects (returned by get_*),
206- # convert the obj to be removed from a name to an object of the same
207- # type.
208- if {$list_is_object && ![is_object $obj ]} {
209- if {$list_type == " Clock" } {
210- set obj [find_clock $obj ]
211- } elseif {$list_type == " Port" } {
212- set top_instance [top_instance]
213- set top_cell [$top_instance cell]
214- set obj [$top_cell find_port $obj ]
215- } elseif {$list_type == " Pin" } {
216- set obj [find_pin $obj ]
217- } elseif {$list_type == " Instance" } {
218- set obj [find_instance $obj ]
219- } elseif {$list_type == " Net" } {
220- set obj [find_net $obj ]
221- } elseif {$list_type == " LibertyLibrary" } {
222- set obj [find_liberty $obj ]
223- } elseif {$list_type == " LibertyCell" } {
224- set obj [find_liberty_cell $obj ]
225- } elseif {$list_type == " LibertyPort" } {
226- set obj [get_lib_pins $obj ]
227- } else {
228- sta_error 164 " unsupported object type $list_type ."
200+ proc delete_objects_from_list_cmd { list delete } {
201+ if { $list != {} } {
202+ set list0 [lindex $list 0]
203+ set list_is_objects [is_object $list0 ]
204+ foreach obj $delete {
205+ # If the list is a collection of tcl objects (returned by get_*),
206+ # convert the obj to be removed from a name to an object of the same
207+ # type.
208+ if {$list_is_objects && ![is_object $obj ]} {
209+ set list_type [object_type $list0 ]
210+ if {$list_type == " Clock" } {
211+ set obj [find_clock $obj ]
212+ } elseif {$list_type == " Port" } {
213+ set top_instance [top_instance]
214+ set top_cell [$top_instance cell]
215+ set obj [$top_cell find_port $obj ]
216+ } elseif {$list_type == " Pin" } {
217+ set obj [find_pin $obj ]
218+ } elseif {$list_type == " Instance" } {
219+ set obj [find_instance $obj ]
220+ } elseif {$list_type == " Net" } {
221+ set obj [find_net $obj ]
222+ } elseif {$list_type == " LibertyLibrary" } {
223+ set obj [find_liberty $obj ]
224+ } elseif {$list_type == " LibertyCell" } {
225+ set obj [find_liberty_cell $obj ]
226+ } elseif {$list_type == " LibertyPort" } {
227+ set obj [get_lib_pins $obj ]
228+ } else {
229+ sta_error 164 " unsupported object type $list_type ."
230+ }
231+ }
232+ set index [lsearch $list $obj ]
233+ if { $index != -1 } {
234+ set list [lreplace $list $index $index ]
229235 }
230- }
231- set index [lsearch $list $obj ]
232- if { $index != -1 } {
233- set list [lreplace $list $index $index ]
234236 }
235237 }
236238 return $list
237239}
238-
239- # ###############################################################
240-
241- proc set_cmd_namespace { namespc } {
242- if { $namespc == " sdc" || $namespc == " sta" } {
243- set_cmd_namespace_cmd $namespc
244- } else {
245- sta_error 165 " unknown namespace $namespc ."
240+
241+ # ###############################################################
242+
243+ proc set_cmd_namespace { namespc } {
244+ if { $namespc == " sdc" || $namespc == " sta" } {
245+ set_cmd_namespace_cmd $namespc
246+ } else {
247+ sta_error 165 " unknown namespace $namespc ."
248+ }
246249 }
247- }
248-
249- # ###############################################################
250-
251- define_cmd_args " report_object_full_names " {objects}
252-
253- proc report_object_full_names { objects } {
254- foreach obj [sort_by_full_name $objects ] {
255- report_line [get_full_name $obj ]
250+
251+ # ###############################################################
252+
253+ define_cmd_args " report_object_full_names " {objects}
254+
255+ proc report_object_full_names { objects } {
256+ foreach obj [sort_by_full_name $objects ] {
257+ report_line [get_full_name $obj ]
258+ }
256259 }
257- }
258-
259- define_cmd_args " report_object_names " {objects}
260-
261- proc report_object_names { objects } {
262- foreach obj [sort_by_name $objects ] {
263- report_line [get_name $obj ]
260+
261+ define_cmd_args " report_object_names " {objects}
262+
263+ proc report_object_names { objects } {
264+ foreach obj [sort_by_name $objects ] {
265+ report_line [get_name $obj ]
266+ }
264267 }
265- }
266-
267- # ###############################################################
268-
269- define_cmd_args " get_name" {object}
270- define_cmd_args " get_full_name" {object}
271-
272- # ###############################################################
273-
274- proc get_name { object } {
275- return [get_object_property $object " name" ]
276- }
277-
278- proc get_full_name { object } {
279- return [get_object_property $object " full_name" ]
280- }
281-
282- proc sort_by_name { objects } {
283- return [lsort -command name_cmp $objects ]
284- }
285-
286- proc name_cmp { obj1 obj2 } {
287- return [string compare [get_name $obj1 ] [get_name $obj2 ]]
288- }
289-
290- proc sort_by_full_name { objects } {
291- return [lsort -command full_name_cmp $objects ]
292- }
293-
294- proc full_name_cmp { obj1 obj2 } {
295- return [string compare [get_full_name $obj1 ] [get_full_name $obj2 ]]
296- }
297-
298- proc get_object_type { obj } {
299- set object_type [object_type $obj ]
300- if { $object_type == " Clock" } {
301- return " clock"
302- } elseif { $object_type == " LibertyCell" } {
303- return " lib_cell"
304- } elseif { $object_type == " LibertyPort" } {
305- return " lib_pin"
306- } elseif { $object_type == " Cell" } {
307- return " cell"
308- } elseif { $object_type == " Instance" } {
309- return " instance"
310- } elseif { $object_type == " Port" } {
311- return " port"
312- } elseif { $object_type == " Pin" } {
313- return " pin"
314- } elseif { $object_type == " Net" } {
315- return " net"
316- } elseif { $object_type == " Edge" } {
317- return " timing_arc"
318- } elseif { $object_type == " TimingArcSet" } {
319- return " timing_arc"
320- } else {
321- return " ?"
268+
269+ # ###############################################################
270+
271+ define_cmd_args " get_name" {object}
272+ define_cmd_args " get_full_name" {object}
273+
274+ # ###############################################################
275+
276+ proc get_name { object } {
277+ return [get_object_property $object " name" ]
322278 }
323- }
324-
325- # sta namespace end.
279+
280+ proc get_full_name { object } {
281+ return [get_object_property $object " full_name" ]
282+ }
283+
284+ proc sort_by_name { objects } {
285+ return [lsort -command name_cmp $objects ]
286+ }
287+
288+ proc name_cmp { obj1 obj2 } {
289+ return [string compare [get_name $obj1 ] [get_name $obj2 ]]
290+ }
291+
292+ proc sort_by_full_name { objects } {
293+ return [lsort -command full_name_cmp $objects ]
294+ }
295+
296+ proc full_name_cmp { obj1 obj2 } {
297+ return [string compare [get_full_name $obj1 ] [get_full_name $obj2 ]]
298+ }
299+
300+ proc get_object_type { obj } {
301+ set object_type [object_type $obj ]
302+ if { $object_type == " Clock" } {
303+ return " clock"
304+ } elseif { $object_type == " LibertyCell" } {
305+ return " lib_cell"
306+ } elseif { $object_type == " LibertyPort" } {
307+ return " lib_pin"
308+ } elseif { $object_type == " Cell" } {
309+ return " cell"
310+ } elseif { $object_type == " Instance" } {
311+ return " instance"
312+ } elseif { $object_type == " Port" } {
313+ return " port"
314+ } elseif { $object_type == " Pin" } {
315+ return " pin"
316+ } elseif { $object_type == " Net" } {
317+ return " net"
318+ } elseif { $object_type == " Edge" } {
319+ return " timing_arc"
320+ } elseif { $object_type == " TimingArcSet" } {
321+ return " timing_arc"
322+ } else {
323+ return " ?"
324+ }
325+ }
326+
327+ # sta namespace end.
326328}
0 commit comments