File size: 6,810 Bytes
d59bb1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Read UPF Utility

This module contains functionality to read, and modify information
from Unified Power Format (UPF) files. 

## Commands

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

### Read UPF

Sources the UPF file. 

```tcl
read_upf
    -file file
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-file` | Path to `.upf` file. |

### Write UPF

Writes the UPF file.

```tcl
write_upf file_name
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `file_name` | Filename argument. |

### Create Power Domain

This command creates power domain for a group of modules.

```tcl
create_power_domain
    [-elements elements]
    name 
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-elements` | List of module paths that belong this this domain OR `*` for top domain. |
| `name` | Domain name. |

### Create Logic Port

This command creates logic port. Direction must be specified from:
`in`, `out`, `inout`.

```tcl
create_logic_port
    [-direction direction]
    port_name
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-direction` | Direction of the port (`in`, `out`, `inout`). |
| `port_name` | Port name. |

### Create Power Switch

This command creates power switch.

```tcl
create_power_switch
    [-domain domain]
    [-output_supply_port output_supply_port]
    [-input_supply_port input_supply_port]
    [-control_port control_port]
    [-on_state on_state]
    name
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-domain` | Power domain name. |
| `-output_supply_port` | Output supply port of the switch. |
| `-input_supply_port` | Input supply port of the switch. |
| `-control_port` | Control port on the switch. |
| `-on_state` | One of {`state_name`, `input_supply_port`, `boolean_expression`}. |
| `name` | Power switch name. |

### Create or Update Isolation Strategy 

This command creates or update isolation strategy.

```tcl 
set_isolation
    [-domain domain]
    [-applies_to applies_to]
    [-clamp_value clamp_value]
    [-isolation_signal isolation_signal]
    [-isolation_sense isolation_sense]
    [-location location]
    [-update]
    name
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-domain` | Power domain |
| `-applies_to` | Restricts the strategy to apply one of these (`inputs`, `outputs`, `both`). |
| `-clamp_value` | Value the isolation can drive (`0`, `1`). |
| `-isolation_signal` | The control signal for this strategy. |
| `-isolation_sense` | The active level of isolation control signal. |
| `-location` | Domain in which isolation cells are placed (`parent`, `self`, `fanout`). |
| `-update` | Only available if using existing strategy, will error if the strategy doesn't exist. |
| `name` | Isolation strategy name. |

### Set Interface cell

This command sets the interface cell.

```tcl 
use_interface_cell
    [-domain domain]
    [-strategy strategy]
    [-lib_cells lib_cells]
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-domain` | Power domain name. |
| `-strategy` | Isolation strategy name. |
| `-lib_cells` | List of lib cells that could be used. |

### Set Domain Area

This command sets the power domain area.

```tcl
set_domain_area
    domain_name
    -area {llx lly urx ury}
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `domain_name` | Power domain name. |
| `-area` | x-/y- coordinates in microns for the lower left and upper right corners of the power domain area. |


### Map existing power switch

This command maps existing power switch.

```tcl 
map_power_switch
    [-switch_name_list switch_name_list]
    [-lib_cells lib_cells]
    [-port_map port_map]
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-switch_name_list` |  A list of switches (as defined by create_power_switch) to map. |
| `-lib_cells` | A list of library cells that could be mapped to the power switch |
| `-port_map` | A map that associates model ports defined by create_power_switch to logical ports |

### Set Level Shifter

This command sets level shifter.
Options coming soon.

```tcl
set_level_shifter
    [-domain domain] \
    [-elements elements] \
    [-exclude_elements exclude_elements] \
    [-source source] \
    [-sink sink] \
    [-use_functional_equivalence use_functional_equivalence] \
    [-applies_to applies_to] \
    [-applies_to_boundary applies_to_boundary] \
    [-rule rule] \
    [-threshold threshold] \
    [-no_shift] \
    [-force_shift] \
    [-location location] \
    [-input_supply input_supply] \
    [-output_supply output_supply] \
    [-internal_supply internal_supply] \
    [-name_prefix name_prefix] \
    [-name_suffix name_suffix] \
    [-instance instance] \
    [-update] \
    [-use_equivalence use_equivalence] \
    name 
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-domain` | |
| `-elements` | |
| `-exclude_elements` | |
| `-source` | |
| `-sink` | |
| `-use_functional_equivalence` | |
| `-applies_to` | |
| `-applies_to_boundary` | |
| `-rule` | |
| `-threshold` | |
| `-no_shift` | |
| `-force_shift` | |
| `-location` | |
| `-input_supply` | |
| `-output_supply` | |
| `-internal_supply` | |
| `-name_prefix` | |
| `-name_suffix` | |
| `-instance` | |
| `-update` | |
| `-use_equivalence` | |
| `name` | |

### Set Domain Voltage

This command sets the voltage of a power domain.

```tcl
set_domain_voltage
    [-domain domain] \
    [-voltage voltage] 
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-domain` | Power domain name. |
| `-voltage` | Power domain voltage. The allowed values are `float`, default value is `0.0`. |

### Set Level Shifter Cell

This command sets the library cell used for level shifter.

```tcl
set_level_shifter_cell
    [-level_shifter level_shifter] \
    [-cell_name cell_name] \
    [-input_port input_port] \
    [-output_port output_port] 
```

#### Options

| Switch Name | Description | 
| ----- | ----- |
| `-level_shifter` | KIV. |
| `-cell_name` | KIV. |
| `-input_port` | KIV. |
| `-output_port` | KIV. |

## Example scripts

Example script demonstrating how to run `upf` related commands can be found here:

```
./test/upf_test.tcl
```

## Regression tests

There are a set of regression tests in `./test`. For more information, refer to this [section](../../README.md#regression-tests). 

Simply run the following script: 

```shell
./test/regression
```

## Limitations

## FAQs

Check out [GitHub discussion](https://github.com/The-OpenROAD-Project/OpenROAD/discussions/categories/q-a?discussions_q=category%3AQ%26A+upf)
about this tool.

## License

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