Example: the sample package

The page below is generated by running the extension over tests/fixtures/sv/sample_pkg.sv — a small package that exercises classes, inheritance, documented and inline-documented members, functions with parameters, and tasks. The source of this page is just:

```{eval-rst}
.. autosvpackage:: sample_pkg

.. autosvclass:: sample_pkg::sample_base
   :members:

.. autosvclass:: sample_pkg::sample_txn
   :members:
```

Rendered output

package sample_pkg[source]

sample_pkg: a small package exercising the Phase-1 feature set.

It contains a base class, a derived class with documented and undocumented members, a function with parameters, a task, and a typedef.

class sample_base[source]

Base class for all sample objects.

property string name[source]

Human-readable name of this object.

function get_name()[source]

Returns the object name. See set_name.

class sample_txn  extends sample_base[source]

A bus transaction.

Models a single read or write transfer on the sample bus, carrying an address and a data payload.

rand property bit[31:0] addr[source]

The target address.

rand property bit[31:0] data[source]

The data payload.

local property int m_count[source]

Internal running count of transactions.

function parity(bit[31:0] mask)[source]

Compute the parity of the data payload.

Param mask:

bits to include in the parity calculation

Returns:

the computed parity bit

task drive(int cycles)[source]

Drive the transaction onto the bus.

Param cycles:

number of clock cycles to hold the data