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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
# Graphical User Interface

The graphical user interface can be access by launching OpenROAD with ``-gui`` or 
by opening it from the command-line with ``gui::show``.

## Commands

```{note}
- Parameters in square brackets `[-param param]` are optional.
- Parameters without square brackets `-param2 param2` are required.
```

### Add Buttons to the Toolbar

This command creates toolbar button with name set using the
`-text` flag and accompanying logic in the `-script` flag.

Returns: name of the new button, either ``name`` or ``buttonX``.

```tcl
create_toolbar_button 
    [-name name]
    -text button_text
    -script tcl_script 
    [-echo]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `-name` | The name of the button, used when deleting the button. |
| `-text` | The text to put on the button. |
| `-script` | The tcl script to evaluate when the button is pressed. |
| `-echo` | This indicate that the commands in the ``tcl_script`` should be echoed in the log. |

### Remove Toolbar Button

To remove toolbar button: 

```tcl
gui::remove_toolbar_button 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `-name` | The name of the button, used when deleting the button. |

### Add items to the Menubar

This command add items to the menubar.
Returns: name of the new item, either ``name`` or ``actionX``.


```tcl
create_menu_item 
    [-name name]
    [-path menu_path]
    -text item_text
    -script tcl_script
    [-shortcut key_shortcut] 
    [-echo]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `-name` | (optional) name of the item, used when deleting the item.|
| `-path`|  (optional) Menu path to place the new item in (hierarchy is separated by /), defaults to "Custom Scripts", but this can also be "Tools" or "New menu/New submenu".|
| `-text` | The text to put on the item.|
| `-script` | The tcl script to evaluate when the button is pressed.|
| `-shortcut`| (optional) key shortcut to trigger this item.|
| `-echo` | (optional) indicate that the commands in the ``tcl_script`` should be echoed in the log. |

### Remove items from the Menubar

To remove menu item: 

```tcl
gui::remove_menu_item 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `-name` | name of the item, used when deleting the item.|

### Save Image

This command can be both be used when the GUI is active and not active
to save a screenshot with various options.

```tcl
save_image 
    [-resolution microns_per_pixel]
    [-area {x0 y0 x1 y1}]
    [-width width]
    [-display_option {option value}]
    filename
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `filename` | path to save the image to. |
| `-area` | x0, y0 - first corner of the layout area (in microns) to be saved, default is to save what is visible on the screen unless called when gui is not active and then it selected the whole block. x1, y1 - second corner of the layout area (in microns) to be saved, default is to save what is visible on the screen unless called when gui is not active and then it selected the whole block.|
| `-resolution`| resolution in microns per pixel to use when saving the image, default will match what the GUI has selected.|
| `-width`| width of the output image in pixels, default will be computed from the resolution. Cannot be used with ``-resolution``.|
| `-display_option`| specific setting for a display option to show or hide specific elements. For example, to hide metal1 ``-display_option {Layers/metal1 false}``, to show routing tracks ``-display_option {Tracks/Pref true}``, or to show everthing ``-display_option {* true}``.|

### Save Clocktree Image

This command saves the screenshot of clocktree given options 
to `filename`.

```tcl
save_clocktree_image 
    filename
    -clock clock_name
    [-width width]
    [-height height]
    [-corner corner]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
|`filename`| path to save the image to. |
|`-clock`| name of the clock to save the clocktree for. |
|`-corner`| name of the timing corner to save the clocktree for, default to the first corner defined. |
|`-height`| height of the image in pixels, defaults to the height of the GUI widget. |
|`-width`| width of the image in pixels, defaults to the width of the GUI widget. |

### Select Objects

This command selects object based on options.
Returns: number of objects selected.

```tcl
select 
    -type object_type
    [-name glob_pattern]
    [-filter attribute=value]
    [-case_insensitive]
    [-highlight group]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
|`-type`| name of the object type. For example, ``Inst`` for instances, ``Net`` for nets, and ``DRC`` for DRC violations.|
|`-name`| (optional) filter selection by the specified name. For example, to only select clk nets ``*clk*``. Use ``-case_insensitive`` to filter based on case insensitive instead of case sensitive.|
|`-filter`| (optional) filter selection based on the objects' properties. ``attribute`` represents the property's name and ``value`` the property's value. In case the property holds a collection (e. g. BTerms in a Net) or a table (e. g. Layers in a Generate Via Rule) ``value`` can be any element within those. A special case exists for checking whether a collection is empty or not by using the value ``CONNECTED``. This can be useful to select a specific group of elements (e. g. BTerms=CONNECTED will select only Nets connected to Input/Output Pins).|
|`-highlight`| (optional) add the selection to the specific highlighting group. Values can be 0 to 7. |

### Display Timing Cones

This command displays timing cones for a pin given options.

```tcl
display_timing_cone 
    pin
    [-fanin]
    [-fanout]
    [-off]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
|`pin` | name of the instance or block pin. |
|`-fanin`| (optional) display the fanin timing cone. |
|`-fanout`| (optional) display the fanout timing cone. |
|`-off`| (optional) remove the timing cone. |

### Focus Net

This command limits the drawing to specified net.

```tcl
focus_net 
    net
    [-remove]
    [-clear]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `pin` | name of the net. |
| `-remove` | (optional) removes the net from from the focus. |
| `-clear` | (optional) clears all nets from focus. |

## TCL functions

### Is GUI Enabled

Determine is the GUI is active:

```tcl
gui::enabled
```

### Trigger GUI to Load Design

Announce to the GUI that a design was loaded 
(note: this is only needed when the design was loaded through the odb API and not via ``read_def`` or ``read_db``):

```tcl
gui::design_created
```

### Load DRC Result

To load the results of a DRC report:

```tcl
gui::load_drc 
    filename
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `filename` | Filename for DRC report. |

### Show GUI

To open the GUI from the command-line (this command does not return until the GUI is closed):

```tcl
gui::show 
    script
    interactive
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `script` | TCL script to evaluate in the GUI. |
| `interactive` | Boolean if true, the GUI should open in an interactive session (default), or if false that the GUI would execute the script and return to the terminal.|

### Hide GUI

To close the GUI and return to the command-line:

```tcl
gui::hide
```

### Layout Fit

To fit the whole layout in the window:

```tcl
gui::fit
```

### Zoom to a specific region

To zoom in our out to a specific region:

```tcl
gui::zoom_to 
    x0 y0 x1 y1
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `x0, y0, x1, y1`| first and second corner of the layout area in microns.|

### Zoom In

To zoom in the layout:

```tcl
gui::zoom_in 
    x y
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `x, y` | new center of layout in microns.|

### Zoom Out

To zoom out the layout:

```tcl
gui::zoom_out 
    x y
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `x, y` |  new center of layout in microns.|

### Center At

To move the layout to new area:

```tcl
gui::center_at 
    x y
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `x, y` | new center of layout in microns.|

### Set Resolution

To change the resolution to a specific value:

```tcl
gui::set_resolution
    resolution
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `resolution` | database units per pixel. |

### Add a single net to selection

To add a single net to the selected items:

```tcl
gui::selection_add_net 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | name of the net to add.|

### Add multiple nets to selection

To add several nets to the selected items using a regex:

```tcl
gui::selection_add_nets 
    name_regex
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name_regex`| regular expression of the net names to add.| 

### Add a single inst to selection

To add a single instance to the selected items:

```tcl
gui::selection_add_inst 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | name of the instance to add. |

### Add multiple insts to selection

To add several instances to the selected items using a regex:

```tcl
gui::selection_add_insts 
    name_regex
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name_regex` | regular expression of the instance names to add. |

### Select at point or area

To add items at a specific point or in an area:

Example usage:
```
gui::select_at x y
gui::select_at x y append
gui::select_at x0 y0 x1 y1
gui::select_at x0 y0 x1 y1 append
```

```tcl
gui::select_at 
    x0 y0 x1 y1
    [append]

Or

gui::select_at
    x y 
    [append]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `x, y` | point in the layout area in microns. |
| `x0, y0, x1, y1`| first and second corner of the layout area in microns. |
| `append`| if ``true`` (the default value) append the new selections to the current selection list, else replace the selection list with the new selections. |

### Select next item from selection

To navigate through multiple selected items:
Returns: current index of the selected item.

```tcl
gui::select_next
```

### Select previous item from selection

To navigate through multiple selected items:
Returns: current index of the selected item.

```tcl
gui::select_previous 
```

### Clear Selection

To clear the current set of selected items:

```tcl
gui::clear_selections
```

### Get Selection Property

To get the properties for the current selection in the Inspector:

```tcl
gui::get_selection_property 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | name of the property. For example, ``Type`` for object type or ``bbox`` for the bounding box of the object. |

### Animate Selection

To animate the current selection in the Inspector:

```tcl
gui::selection_animate 
    [repeat]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `repeat` | indicate how many times the animation should repeat, default value is 0 repeats. If the value is 0, the animation will repeat indefinitely.|

### Highlight Net

To highlight a net:

```tcl
gui::highlight_net 
    name
    [highlight_group]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` |  name of the net to highlight.|
| `highlight_group` | group to add the highlighted net to, defaults to ``0``, valid groups are ``0 - 7``. |

### Highlight Instance

To highlight an instance:

```tcl
gui::highlight_inst 
    name
    [highlight_group]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | name of the instance to highlight. |
| `highlight_group` | group to add the highlighted instance to, defaults to ``0``, valid groups are ``0 - 7``. |

### Clear Highlight Groups

To clear the highlight groups:

```tcl
gui::clear_highlights
    [highlight_group]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `highlight_group` | group to clear, defaults to ``0``, valid groups are ``-1 - 7``. Use ``-1`` to clear all groups. |

### Add Ruler to Layout

To add a ruler to the layout:

1. either press ``k`` and use the mouse to place it visually.
To disable snapping for the ruler when adding, hold the ``Ctrl`` key, and to allow non-horizontal or vertical snapping when completing the ruler hold the ``Shift`` key.

2. or use the command:

Returns: name of the newly created ruler.

```tcl
gui::add_ruler 
    x0 y0 x1 y1
    [label]
    [name]
    [euclidian]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `x0, y0, x1, y1` | first and second end point of the ruler in microns. |
| `label` | text label for the ruler. |
| `name` | name of the ruler. |
| `euclidian` | ``1`` for euclidian ruler, and ``0`` for regular ruler. |

### Delete a single ruler

To remove a single ruler:

```tcl
gui::delete_ruler 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | name of the ruler. |

### Clear All Rulers

To remove all the rulers:

```tcl
gui::clear_rulers
```

### Set Heatmap

To control the settings in the heat maps:

The currently availble heat maps are:
- ``Power``
- ``Routing``
- ``Placement``
- ``IRDrop``
- ``RUDY`` [^RUDY]

These options can also be modified in the GUI by double-clicking the underlined display control for the heat map.

```tcl
gui::set_heatmap 
    name
    [option]
    [value]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | is the name of the heatmap. |
| `option` | is the name of the option to modify. If option is ``rebuild`` the map will be destroyed and rebuilt. |
| `value` | is the new value for the specified option. This is not used when rebuilding map. |

### Dump Heatmap to file

To save the raw data from the heat maps ins a comma separated value (CSV) format:

```tcl
gui::dump_heatmap 
    name 
    filename
```

#### Options

| Switch Name | Description |
| ---- | ---- |
|`name` | is the name of the heatmap. |
|`filename` | path to the file to write the data to. |

[^RUDY]: RUDY means Rectangular Uniform wire DensitY, which can predict the routing density very rough and quickly. You can see this notion in [this paper](https://past.date-conference.com/proceedings-archive/2007/DATE07/PDFFILES/08.7_1.PDF) 


### GUI Display Controls

Control the visible and selected elements in the layout:

```tcl
gui::set_display_controls 
    name 
    [display_type] 
    [value]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` |  is the name of the control. For example, for the power nets option this would be ``Signals/Power`` or could be ``Layers/*`` to set the option for all the layers. |
| `display_type` | is either ``visible`` or ``selectable`` |
| `value` |is either ``true`` or ``false`` |

### Check Display Controls

To check the visibility or selectability of elements in the layout:

```tcl
gui::check_display_controls 
    name 
    display_type 
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | is the name of the control. For example, for the power nets option this would be ``Signals/Power`` or could be ``Layers/*`` to set the option for all the layers. |
| `display_type` | is either ``visible`` or ``selectable`` |

### Save Display Controls

When performing a batch operation changing the display controls settings, 
the following command can be used to save the current state of the display controls.

```tcl
gui::save_display_controls
```

### Restore Display Controls

This command restores display controls.

```tcl
gui::restore_display_controls
```

### Input Dialog

To request user input via the GUI:
Returns: a string with the input, or empty string if canceled.

```tcl
gui::input_dialog 
    title
    question
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `title` | is the title of the input message box. |
| `question` | is the text for the message box. |

### Pause script execution

Pause the execution of the script:

```tcl
gui::pause 
    [timeout]
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `timeout` | is specified in milliseconds, if it is not provided the pause will last until the user presses the Continue button.|

### Show widget

To open a specific layout widget:

```tcl
gui::show_widget 
       name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | of the widget. For example, the display controls would be "Display Control". |

### Hide widget

To close a specific layout widget:

```tcl
gui::hide_widget 
    name
```

#### Options

| Switch Name | Description |
| ---- | ---- |
| `name` | of the widget. For example, the display controls would be "Display Control". |


## License

BSD 3-Clause License. See [LICENSE](../../LICENSE) file.