Cross-referencing, source links & intersphinx¶

Roles¶

Reference any documented object with an sv role:

:sv:class:`my_pkg::my_transaction`
:sv:func:`parity`
:sv:mod:`counter`

Role

Targets

:sv:class: / :sv:type:

classes, typedefs

:sv:mod:

modules

:sv:func: / :sv:task:

functions / tasks

:sv:prop:

class properties

:sv:port: / :sv:param:

ports / parameters

:sv:obj:

any object (also the target of NaturalDocs <x> / Doxygen #x)

Both qualified (pkg::name) and unambiguous bare names resolve. An ambiguous bare name (e.g. new, which many classes define) does not resolve — qualify it. Unresolved explicit roles emit a build warning; references inferred from comment markup (<x>, #x) degrade silently to text.

Source links (viewcode)¶

When sv_viewcode = True (the default), every documented object gets a [source] link to a generated, syntax-highlighted listing of its source file, anchored at the declaration line. Disable with:

sv_viewcode = False

Intersphinx¶

The extension exports all documented objects to objects.inv, so other Sphinx projects can reference your SystemVerilog API via intersphinx:

intersphinx_mapping = {
    "mylib": ("https://example.com/mylib/docs/", None),
}
:sv:class:`mylib:my_pkg::my_transaction`

Logo of sphinx-systemverilog

sphinx-systemverilog

Sphinx autodoc for SystemVerilog, powered by pyslang

Navigation

Usage

  • Getting started
  • Directives & roles
  • The native comment style
  • The NaturalDocs comment style
  • The Doxygen comment style
  • Documenting modules & interfaces
  • Inheritance diagrams
  • Whole-tree documentation
  • Cross-referencing, source links & intersphinx
    • Roles
    • Source links (viewcode)
    • Intersphinx
  • Advanced constructs & performance

Examples

  • Example: the sample package
  • Example: NaturalDocs, modules & diagrams
  • Example: documenting UVM

Related Topics

  • Documentation overview
    • Previous: Whole-tree documentation
    • Next: Advanced constructs & performance
©2026, Matthew Ballance. | Powered by Sphinx 9.1.0 & Alabaster 1.0.0 | Page source