snarled/README.md

114 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2022-03-31 00:43:54 -07:00
snarled README
2022-03-31 00:05:50 -07:00
============
2022-03-27 23:44:46 -07:00
Layout connectivity checker.
2022-03-31 00:43:54 -07:00
`snarled` is a python package for checking electrical connectivity in multi-layer layouts.
2022-03-31 00:05:50 -07:00
It is intended to be "poor-man's LVS" (layout-versus-schematic), for when poverty
has deprived the man of both a schematic and a better connectivity tool.
2022-03-31 00:43:54 -07:00
- [Source repository](https://mpxd.net/code/jan/snarled)
- [PyPI](https://pypi.org/project/snarled)
2022-03-31 00:05:50 -07:00
## Installation
Requirements:
* python >= 3.10 (written and tested with 3.11)
2022-03-31 00:05:50 -07:00
* numpy
2023-06-21 19:44:38 -07:00
* klayout (python package only)
2022-03-31 00:05:50 -07:00
Install with pip:
```bash
2023-06-21 19:44:38 -07:00
pip install snarled
2022-03-31 00:05:50 -07:00
```
Alternatively, install from git
```bash
2023-06-21 19:44:38 -07:00
pip install git+https://mpxd.net/code/jan/snarled.git@release
2022-03-31 00:08:35 -07:00
```
2022-03-31 00:05:50 -07:00
## Example
2023-06-21 19:44:38 -07:00
See `examples/check.py` (python interface) or `examples/run.sh` (command-line interface).
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
Command line:
```bash
snarled connectivity.oas connectivity.txt -m layermap.txt
```
Python interface:
2022-03-31 00:05:50 -07:00
```python3
from pprint import pformat
2023-06-21 19:44:38 -07:00
import logging
2022-03-31 00:43:54 -07:00
import snarled
2023-06-21 19:44:38 -07:00
from snarled.types import layer_t
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
logging.basicConfig()
logging.getLogger('snarled').setLevel(logging.INFO)
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
connectivity = [
((1, 0), (1, 2), (2, 0)), # M1 to M2 (via V12)
((1, 0), (1, 3), (3, 0)), # M1 to M3 (via V13)
((2, 0), (2, 3), (3, 0)), # M2 to M3 (via V23)
]
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
labels_map: dict[layer_t, layer_t] = {
(1, 0): (1, 0),
(2, 0): (2, 0),
(3, 0): (3, 0),
}
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
filename = 'connectivity.oas'
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
nets = snarled.trace_layout(filename, connectivity, topcell='top', labels_map=labels_map)
result = snarled.TraceAnalysis(nets)
2022-03-31 00:05:50 -07:00
2023-06-21 19:44:38 -07:00
print('\n')
print(result)
2022-03-31 00:05:50 -07:00
```
this prints the following:
```
2023-06-21 19:44:38 -07:00
INFO:snarled.trace:Adding layer (3, 0)
INFO:snarled.trace:Adding layer (2, 3)
INFO:snarled.trace:Adding layer (1, 3)
INFO:snarled.trace:Adding layer (1, 2)
INFO:snarled.trace:Adding layer (1, 0)
INFO:snarled.trace:Adding layer (2, 0)
Trace analysis
=============
Nets
(groups of electrically connected labels)
SignalA,SignalB
SignalC,SignalD,SignalI
SignalE,SignalF
SignalG,SignalH
SignalK
SignalK
SignalL
Opens
(2+ nets containing the same name)
SignalK : 2 nets
Shorts
(2+ unique names for the same net)
SignalA,SignalB
SignalC,SignalD,SignalI
SignalE,SignalF
SignalG,SignalH
=============
2022-03-31 00:05:50 -07:00
```
## Code organization
2023-06-21 19:44:38 -07:00
- The primary functionality is in `trace`; specifically `trace.trace_layout()`.
- `main` provides a command-line interface, supported by the functions in `utils`.