Internal scriptures for building a verification environment (starting to build an environment from 0)

1. Four elements of environmental construction

Before sending the test sequence, you first need to create a structured environment, and disassemble the core elements of the environment establishment, which can be divided into four parts:

  • Self-closing properties of unit components
  • regression creation
  • Communication port connection
  • top level configuration


2. Self-closing of unit components

Self-closing means that unit components (such as uvm_agent or uvm_env) can become independent behaviors and do not depend on other parallel components. For example, between the driver and the sequencer, although the driver needs to obtain the transaction item of the sequencer, it can instantiate itself independently, and the communication between them is also realized based on the TLM end-to-end connection. The self-closing nature of this unit component provides a good foundation for subsequent component reuse, and each sub-environment can also be independently integrated into the top-level environment without requiring additional communication connections.

3. Regression Creation

In this way of regression creation, after the upper-level component instantiates itself (executes the new() function), it will execute each phase stage. Through build_phase, sub-components can be further created, and these sub-components are also created through the same process. next level components.

The reason why the regression creation can be realized depends on the build_phase of the top-down execution order. The structured execution sequence of build_phase can ensure that the parent component must be created before the child component, and the creation process also includes:

  • Assign a default value when defining a member variable, or assign an initial value in the new() function.
  • Structural configuration variables are used to determine the conditional generation of components. For example, uvm_agent relies on the is_active variable to determine whether uvm_sequencer and uvm_driver need to be instantiated.
  • Mode configuration variables are used to determine the working mode of each subcomponent.
  • Subcomponents are generated sequentially from top to bottom and from front to back.


4. Communication port connection

After the entire environment is created, each component will perform data communication through the connection of the communication port. Common port communication uses include:

  • The port of the driver is connected to the sequencer, and the transaction item is acquired in the form of blocking pull for the sequencer.
  • The port of the monitor is connected to the analysis fifo inside the scoreboard, and the monitored data is written into it.

5. Top-level configuration

Formally due to the self-closing nature of unit components, the UVM structure does not recommend referring to sub-environment handles and then indexing deeper variables for top-level configuration. This will increase the stickiness of the top-level environment and sub-environments, and cannot achieve better separation.

So a better way is to pass the configuration object to the sub-environment as a part bound to the top-level environment, and each component of the sub-environment can obtain its own configuration parameters from the structured configuration object, so as to build_phase, connect_phase and run_phase to determine their structure and mode of operation.

The top-level configuration object can be configured into the sub-environment that will be created in the future when the sub-environment is not instantiated, without considering that the top-level configuration object will be generated before the sub-environment, which also provides a safe configuration method for the UVM verification structure:

  • No matter which layer of configuration is used, you should try to place all configurations before the creation of subcomponents to ensure that the configuration has been completed.
  • The scope of the configuration should only focus on the current level and below, and not involve higher levels.
  • The configuration object structure should be as independent as possible, preferably forming a tree structure like the environment structure. Such independent configuration objects will correspond to independent sub-environments. If the independent configurations are merged into a tree-like top-level configuration structure, then the top-level configuration objects will be easier to use and maintain.
  • Due to the configuration characteristics of config_db, the high-level configuration will cover the underlying configuration, which also allows the configuration made at the uvm_test level to control the overall structure and mode.

Top-level configuration block diagram


6. Classification of environmental elements

 Draw the uvm_test layer as a higher level than uvm_env, because the uvm_test layer will have some configuration parts passed to the sub-environment. Including the component uvm_component that constitutes the environment, the environment elements can be divided into the following parts:

  • Member variables: general variables, structure variables, pattern variables.
  • Subcomponents: Fixed Components, Conditional Components, Reference Components.
  • Child objects: self-generated objects, cloned objects, and referenced objects.

Member variables

  • General variables are used for operations inside objects, or to provide state values ​​for external access.
  • Structural variables are used to determine whether internal subcomponents need to be created and connected, for example, the top-level is_active variable is used for this purpose.
  • Mode variables are used to control the behavior of components. For example, driver variables can be configured in mode to make different incentive behaviors in run_phase.
  • For structure variables and mode variables, they are generally defined by int or enum types, and can be directly set in the uvm_test layer through the configuration method of uvm_config_db, or system configuration can be performed through structured configuration objects. For complex authentication environments, the configuration object will be easy to operate and maintain.

Subassembly

  • The components that must be created in the environment are called fixed components. For example, the monitor in the agent needs to be created regardless of the active mode or the passive mode, or the scoreboard in the top-level environment also needs to be created to compare data.
  • The conditional component is determined by the configuration of the structure variable whether it needs to be created. For example, the sequencer and driver are only allowed to be created in active mode.
  • A reference component declares a type handle internally and passes it through a top-down handle so that the handle can point to an external object. For example, in the uvm_test layer, a register model rgm (fixed component) is first instantiated, and then the handle of the model is passed to the rgm handle (reference component) in the reg_env layer through configuration. By using the way of referencing components, all levels of the environment can share a component if needed.

child object

  • An object is first created in a certain layer, which can be called a self-generated object.
  • During object transfer, the object is cloned to generate an object with the same member values, which is called a cloned object.
  • If the object is passed through the port and reaches another component, and the component directly operates on it without cloning, it is called the operation of referencing the object. For example, the virtual sequence will generate transaction items sent to reg_master_agent and reg_slave_agent, which are mst_t and slv_t respectively. These continuously sent mst_t and slv_t pass through uvm_sequencer and finally reach uvm_driver. After uvm_driver gets these transaction objects, it is a way to clone them first, and then use the cloned data objects as incentives; uvm_driver can also directly operate on these objects (reference objects) without cloning the data objects.
     

Guess you like

Origin blog.csdn.net/Arvin_ing/article/details/127676326