@@ -90,3 +90,115 @@ A VC typically has an associated package defining procedures for sending to and
9090Each VC instance is associated with a handle that is created in the test bench and set as a generic on the VC
9191instantiation.
9292The 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,
99+ reusability, interoperability, and future-proofing of VCs and VCIs.
100+
101+ Rule 1
102+ ------
103+
104+ The file containing the VC entity shall contain only that entity, and the file containing the VCI package shall
105+ contain only that package.
106+
107+ **Rationale **: This structure simplifies compliance testing, as each VC or VCI can be directly referenced by its
108+ file name.
109+
110+ Rule 2
111+ ------
112+
113+ A VC shall have only **one ** generic, the *handle *, and it shall be of a record type containing **private ** fields.
114+
115+ **Rationale **: Using a record allows future updates to add and/or remove fields in the record without breaking
116+ backward compatibility.
117+
118+ **Recommendation **: Mark the fields as private by using a naming convention and/or including comments. This minimizes
119+ the risk of users accessing fields directly.
120+
121+ Rule 3
122+ ------
123+
124+ The VC handle shall be created by a function, the *constructor *, which shall have a name beginning with ``new ``.
125+
126+ **Rationale **: Using a constructor removes the need for users to directly access the private fields of the handle
127+ record. The naming convention also enables compliance tests to easily locate the constructor and verify it against
128+ other applicable rules.
129+
130+ Rule 4
131+ ------
132+
133+ The VC constructor shall include an ``id `` parameter of type ``id_t `` to enable the user to specify the VC's identity.
134+
135+ **Rationale **: This gives users control over the namespace assigned to the VC.
136+
137+ Rule 5
138+ ------
139+
140+ The ``id `` parameter shall default to ``null_id ``. If not overridden, ``id `` shall be assigned a value on the format
141+ ``<provider>:<VC name>:<n> ``, where ``<n> `` starts at 1 for the first instance of the VC and increments with each
142+ additional instance.
143+
144+ **Rationale **: This format ensures clear identification while preventing naming collisions when VCs from different
145+ providers are combined.
146+
147+ Rule 6
148+ ------
149+
150+ All identity-supporting objects associated with the VC (such as loggers, actors, and events) shall be assigned an
151+ identity within the namespace defined by the constructor’s ``id `` parameter.
152+
153+ **Rationale **: This gives users control over these objects and simplifies the association of log messages with a
154+ specific VC instance.
155+
156+ Rule 7
157+ ------
158+
159+ All logging performed by the VC, including indirect logging (such that error logs from checkers), shall use the
160+ VUnit logging mechanism.
161+
162+ **Rationale **: Using a unified logging mechanism ensures consistency and compatibility across logging outputs
163+ from different VCs.
164+
165+ Rule 8
166+ ------
167+
168+ Communication with the VC shall be based on VUnit message passing, and the VC actor’s identity shall match the
169+ ``id `` parameter provided to the constructor.
170+
171+ **Rationale **: This ensures a consistent communication framework and enables the reuse of VCIs across multiple VCs.
172+
173+ Rule 9
174+ ------
175+
176+ All VCs shall support the sync interface.
177+
178+ **Rationale **: The ability to verify if a VC is idle and to introduce delays between transactions are frequently
179+ needed features for VC users.
180+
181+ Rule 10
182+ -------
183+
184+ The VC constructor shall include an ``unexpected_msg_type_policy `` parameter, allowing users to specify the action
185+ taken when the VC receives an unexpected message type.
186+
187+ **Rationale **: This policy enables flexibility in handling situations where a VC actor, subscribed to another actor,
188+ might receive unsupported messages, while VCs addressed directly should only receive supported messages.
189+
190+ Rule 11
191+ -------
192+
193+ The standard configuration (of type ``std_cfg_t ``), which includes the required parameters for the constructor, shall
194+ be accessible by calling ``get_std_cfg `` with the VC handle.
195+
196+ **Rationale **: This enables reuse of common functions across multiple VCs.
197+
198+ Rule 12
199+ -------
200+
201+ A VC shall keep the ``test_runner_cleanup `` phase entry gate locked as long as there are pending operations.
202+
203+ **Rationale **: Locking the gate ensures that the simulation does not terminate prematurely before all operations have
204+ completed.
0 commit comments