Commit 3deeedd
authored
Initial implementation of
* Initial implementation of `GateGraph`, an alternative PyRTL logic representation:
`GateGraph` attempts to address several issues with PyRTL's standard
`WireVector` and `LogicNet` representation:
1. A `GateGraph` can be directly traversed, without the help of side data
structures like the `wire_src_dict` and `wire_sink_dict` returned by
`net_connections`.
2. `GateGraph` builds a graph where each node is a `Gate`, and the edges are
all references to other `Gates`. By using only one node type, rather than
two (`WireVector`, `LogicNet`), it becomes easier to work with the nodes in
a `GateGraph`, because every node is the same type, with the same interface.
3. `GateGraph` decouples the user interface and the internal representation.
Users directly instantiate `WireVectors` as they build circuits. A user that
is only building circuits should never interact with a `GateGraph` or a
`Gate`. Users should only interact with `GateGraph` when they need
reflection, which typically happens when writing an analysis or optimization
pass.
Another advantage of this decoupling is that `Gate` does not need to support
`WireVector`'s quality-of-life features for users, like inferring bitwidth
from assignment.GateGraph, an alternative PyRTL logic representation (#470)1 parent 370aa4b commit 3deeedd
File tree
6 files changed
+1461
-3
lines changed- docs
- pyrtl
- tests
6 files changed
+1461
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
163 | 168 | | |
164 | 169 | | |
165 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
584 | 588 | | |
585 | 589 | | |
586 | 590 | | |
| |||
0 commit comments