Skip to content

Commit d17e67e

Browse files
committed
Improved doc-strings.
1 parent 8df01bc commit d17e67e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

pyVHDLModel/DesignUnit.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,23 @@ class Context(PrimaryUnit):
311311
"""
312312
Represents a context declaration.
313313
314+
A context contains a generic list of all its items (library clauses, use clauses and context references) in
315+
:data:`_references`.
316+
317+
Furthermore, when a context gets initialized, the item kinds get separated into individual lists:
318+
319+
* :class:`~pyVHDLModel.DesignUnit.LibraryClause` |rarr| :data:`_libraryReferences`
320+
* :class:`~pyVHDLModel.DesignUnit.UseClause` |rarr| :data:`_packageReferences`
321+
* :class:`~pyVHDLModel.DesignUnit.ContextReference` |rarr| :data:`_contextReferences`
322+
323+
When :meth:`pyVHDLModel.Design.LinkContexts` got called, these lists were processed and the fields:
324+
325+
* :data:`_referencedLibraries` (:pycode:`Dict[libName, Library]`)
326+
* :data:`_referencedPackages` (:pycode:`Dict[libName, [pkgName, Package]]`)
327+
* :data:`_referencedContexts` (:pycode:`Dict[libName, [ctxName, Context]]`)
328+
329+
are populated.
330+
314331
.. admonition:: Example
315332
316333
.. code-block:: VHDL

pyVHDLModel/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,21 @@ def _LinkItems(package: Package):
836836
_LinkItems(package)
837837

838838
def LinkContexts(self) -> None:
839+
"""
840+
Resolves and links all items (library clauses, use clauses and nested context references) in contexts.
841+
842+
It iterates all contexts in the design. Therefore, the library of the context is used as the working library. By
843+
default, the working library is implicitly referenced in :data:`_referencedLibraries`. In addition, a new empty
844+
dictionary is created in :data:`_referencedPackages` and :data:`_referencedContexts` for that working library.
845+
846+
At first, all library clauses are resolved (a library clause my have multiple library reference symbols). For each
847+
referenced library an entry in :data:`_referencedLibraries` is generated and new empty dictionaries in
848+
:data:`_referencedPackages` and :data:`_referencedContexts` for that working library. In addition, a vertex in the
849+
dependency graph is added for that relationship.
850+
851+
At second, all use clauses are resolved (a use clause my have multiple package member reference symbols). For each
852+
references package,
853+
"""
839854
for context in self.IterateDesignUnits(DesignUnitKind.Context): # type: Context
840855
# Create entries in _referenced*** for the current working library under its real name.
841856
workingLibrary: Library = context.Library

0 commit comments

Comments
 (0)