Skip to content

Commit 27c2784

Browse files
committed
Added VC standard rules
1 parent 80bba05 commit 27c2784

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

docs/verification_components/user_guide.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,96 @@ A VC typically has an associated package defining procedures for sending to and
9090
Each VC instance is associated with a handle that is created in the test bench and set as a generic on the VC
9191
instantiation.
9292
The handle is given as an argument to the procedure calls to direct messages to the specific VC instance.
93+
94+
95+
VC and VCI Compliance Testing
96+
=============================
97+
98+
VUnit establishes a standard for VCs and VCIs, designed around a set of rules that promote flexibility, reusability, interoperability,
99+
and future-proofing of VCs and VCIs.
100+
101+
Rule 1
102+
------
103+
104+
The file containing a VC entity shall include only one entity, and the file containing a VCI package shall include only one package.
105+
106+
**Rationale**: This simplifies compliance testing, as the VC/VCI can be referenced by file name.
107+
108+
Rule 2
109+
------
110+
111+
The function used to create a new instance of a VC (the constructor) shall have a name starting with ``new_``.
112+
113+
**Rationale**: This naming convention allows the compliance test to easily identify the constructor and evaluate it against other applicable rules.
114+
115+
Rule 3
116+
------
117+
118+
A VC constructor shall include an ``id`` parameter, allowing the user to specify the VC's identity.
119+
120+
**Rationale**: This provides users control over the namespace assigned to the VC.
121+
122+
Rule 4
123+
------
124+
125+
The ``id`` parameter shall default to ``null_id``. If not overridden, the ``id`` shall follow the format ``<provider>:<VC name>:<n>``, where
126+
``<n>`` starts at 1 for the first instance of the VC and increments with each subsequent instance.
127+
128+
**Rationale**: This structured format ensures clear identification while preventing name collisions when combining VCs from different providers.
129+
130+
Rule 5
131+
------
132+
133+
All identity-supporting objects associated with the VC (such as loggers, actors, and events) shall be assigned an identity within the namespace
134+
defined by the constructor’s ``id`` parameter.
135+
136+
**Rationale**: This gives users control over these objects and allows for easy association of log messages with a specific VC instance.
137+
138+
Rule 6
139+
------
140+
141+
All checkers used by the VC shall report to the VC’s loggers.
142+
143+
**Rationale**: This ensures that error messages are clearly linked to a specific VC instance.
144+
145+
Rule 7
146+
------
147+
148+
A VC constructor shall include an ``unexpected_msg_type_policy`` parameter, allowing users to define the action taken when the VC receives an unexpected message type.
149+
150+
**Rationale**: A VC actor subscribing to another actor may receive irrelevant messages, while VCs addressed directly should only receive messages they can process.
151+
152+
Rule 10
153+
-------
154+
155+
A VC shall keep the ``test_runner_cleanup`` entry gate locked while it has unfinished work, and must unlock the gate at all other times.
156+
157+
**Rationale**: This prevents premature termination of the testbench.
158+
159+
Rule 11
160+
-------
161+
162+
All fields in the handle returned by the constructor shall begin with the prefix ``p_``.
163+
164+
**Rationale**: This emphasizes that all fields are private, which simplifies future updates without breaking backward compatibility.
165+
166+
Rule 12
167+
-------
168+
169+
The standard configuration, ``std_cfg_t``, consisting of the required parameters for the constructor, shall be accessible through the handle via a ``get_std_cfg`` call.
170+
171+
**Rationale**: This enables reuse of common operations across multiple VCs.
172+
173+
Rule 13
174+
-------
175+
176+
A VC shall only have one generic.
177+
178+
**Rationale**: Representing a VC with a single object simplifies code management. Since all handle fields are private, future updates are less likely to break backward compatibility.
179+
180+
Rule 14
181+
-------
182+
183+
All VCs shall support the sync interface.
184+
185+
**Rationale**: Being able to verify whether a VC is idle and introduce delays between transactions is a common and useful feature for VC users.

0 commit comments

Comments
 (0)