aboutsummaryrefslogtreecommitdiffstats
path: root/docs/netlist.md
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-12-27 10:44:20 +0000
committerDavid Shah <dave@ds0.me>2019-12-27 10:44:30 +0000
commit5774b13984bb151909b90ee2c668bdfb08387a2b (patch)
tree7dd586694d7c3bca458502f3e6d677da1a6954b3 /docs/netlist.md
parent0ea7f153a1f14ac6af079b5660afe1981e5f8b51 (diff)
downloadnextpnr-5774b13984bb151909b90ee2c668bdfb08387a2b.tar.gz
nextpnr-5774b13984bb151909b90ee2c668bdfb08387a2b.tar.bz2
nextpnr-5774b13984bb151909b90ee2c668bdfb08387a2b.zip
Document hierarchy structures
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'docs/netlist.md')
-rw-r--r--docs/netlist.md16
1 files changed, 15 insertions, 1 deletions
diff --git a/docs/netlist.md b/docs/netlist.md
index 8886e4f8..3953241e 100644
--- a/docs/netlist.md
+++ b/docs/netlist.md
@@ -72,4 +72,18 @@ The second is `ArchCellInfo` and `ArchNetInfo`. These are provided by architectu
- `getNetinfoSourceWire` gets the physical wire `WireId` associated with the source of a net
- `getNetinfoSinkWire` gets the physical wire `WireId` associated with a given sink (specified by `PortRef`)
- `getNetinfoRouteDelay` gets the routing delay - actual if the net is fully routed, estimated otherwise - between the source and a given sink of a net
- - `getNetByAlias` returns the pointer to a net given any of its aliases - this should be used in preference to a direct lookup in `nets` whenever a net name is provided by the user \ No newline at end of file
+ - `getNetByAlias` returns the pointer to a net given any of its aliases - this should be used in preference to a direct lookup in `nets` whenever a net name is provided by the user
+
+## Hierarchy
+
+As most place and route algorithms require a flattened netlist to work with (consider - each leaf cell instance must have its own bel), the primary netlist structures are flattened. However, some tasks such as floorplanning require an understanding of hierarchy.
+
+`HierarchicalCell` is the main data structure for storing hierarchy. This represents an instance of a hierarchical, rather than leaf cell (leaf cells are represented by a `CellInfo`).
+
+ - `name` and `type` are the instance name and cell type
+ - `parent` is the hierarchical path of the parent cell, and `fullpath` is the hierarchical path of this cell
+ - `leaf_cells`, `nets` map from a name inside the hierarchical cell to a 'global' name in the flattened netlist (i.e. one that indexes into `ctx->{cells,nets}`)
+ - `leaf_cells_by_gname`, `nets_by_gname` are the inverse of the above maps; going from `{CellInfo,NetInfo}::name` to an instance name inside the cell
+ - `hier_cells` maps instance names of sub-hierarchical (non-leaf) cells to global names (indexing into `ctx->hierarchy`)
+
+To preserve hierarchy during passes such as packing, ensure that `hierpath` is set on new cells derived from existing ones, and call `fixupHierarchy()` at the end to rebuild `HierarchicalCell` structures.