################################################################################################################################## Bitvis VIP Clock Generator ################################################################################################################################## **Quick Access** * `VVC`_ * :ref:`clock_generator_start_clock` * :ref:`clock_generator_stop_clock` * :ref:`clock_generator_set_clock_period` * :ref:`clock_generator_set_clock_high_time` ********************************************************************************************************************************** VVC ********************************************************************************************************************************** * VVC functionality is implemented in clock_generator_vvc.vhd * For general information see :ref:`vvc_framework_vvc_mechanisms_and_features`. Entity ================================================================================================================================== Generics ---------------------------------------------------------------------------------------------------------------------------------- +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | Name | Type | Default | Description | +==============================+==============================+=================+=================================================+ | GC_INSTANCE_IDX | natural | 1 | Instance number to assign the VVC. Maximum value| | | | | is defined by C_CLOCK_GEN_VVC_MAX_INSTANCE_NUM | | | | | in adaptations_pkg. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_CLOCK_NAME | string | "clk" | Name to assign the VVC | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_CLOCK_PERIOD | time | 10 ns | Clock period to assign the VVC | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_CLOCK_HIGH_TIME | time | 5 ns | Time of the clock cycle that is '1'. Value must | | | | | be less than GC_CLOCK_PERIOD | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_CMD_QUEUE_COUNT_MAX | natural | C_CMD_QUEUE_COU\| Absolute maximum number of commands in the VVC | | | | NT_MAX | command queue | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_CMD_QUEUE_COUNT_THRESHOLD | natural | C_CMD_QUEUE_COU\| An alert will be generated when reaching this | | | | NT_THRESHOLD | threshold to indicate that the command queue is | | | | | almost full. The queue will still accept new co\| | | | | mmands until it reaches GC_CMD_QUEUE_COUNT_MAX. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_CMD_QUEUE_COUNT_THRESHOLD\| :ref:`t_alert_level` | C_CMD_QUEUE_COU\| Alert severity which will be used when command | | _SEVERITY | | NT_THRESHOLD_SE\| queue reaches GC_CMD_QUEUE_COUNT_THRESHOLD | | | | VERITY | | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_RESULT_QUEUE_COUNT_MAX | natural | C_RESULT_QUEUE\ | Maximum number of unfetched results before | | | | _COUNT_MAX | result_queue is full | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_RESULT_QUEUE_COUNT_THRESH\| natural | C_RESULT_QUEUE\ | An alert will be issued if result queue exceeds | | OLD | | _COUNT_THRESHOLD| this count. Used for early warning if result | | | | | queue is almost full. Will be ignored if set to | | | | | 0. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | GC_RESULT_QUEUE_COUNT_THRESH\| :ref:`t_alert_level` | C_RESULT_QUEUE \| Severity of alert to be initiated if exceeding | | OLD_SEVERITY | | _COUNT_THRESHOL\| GC_RESULT_QUEUE_COUNT_THRESHOLD | | | | D_SEVERITY | | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ .. note:: Default values for the cmd/result queue generics are defined in adaptations_pkg. Signals ---------------------------------------------------------------------------------------------------------------------------------- +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | Object | Name | Dir. | Type | Description | +==========+====================+========+==============================+=========================================================+ | signal | clk | out | std_logic | VVC Clock signal | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ Configuration Record ================================================================================================================================== **vvc_config** accessible via **shared_clock_generator_vvc_config** +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | Record element | Type | Default | Description | +==============================+==============================+=================+=================================================+ | inter_bfm_delay | :ref:`t_inter_bfm_delay` | C_CLOCK_GENERAT\| Record parameter required by the VVC Framework, | | | | OR_INTER_BFM_DE\| not applicable for this VVC | | | | LAY_DEFAULT | | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | cmd_queue_count_max | natural | C_CMD_QUEUE_COU\| Maximum pending number in command queue before | | | | NT_MAX | queue is full. Adding additional commands will | | | | | result in an ERROR. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | cmd_queue_count_threshold | natural | C_CMD_QUEUE_COU\| An alert will be issued if command queue exceeds| | | | NT_THRESHOLD | this count. Used for early warning if command | | | | | queue is almost full. Will be ignored if set to | | | | | 0. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | cmd_queue_count_threshold_se\| :ref:`t_alert_level` | C_CMD_QUEUE_COU\| Severity of alert to be initiated if exceeding | | verity | | NT_THRESHOLD_SE\| cmd_queue_count_threshold | | | | ERITY | | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | result_queue_count_max | natural | C_RESULT_QUEUE\ | Maximum number of unfetched results before | | | | _COUNT_MAX | result_queue is full | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | result_queue_count_threshold | natural | C_RESULT_QUEUE\ | An alert will be issued if result queue exceeds | | | | _COUNT_THRESHOLD| this count. Used for early warning if result | | | | | queue is almost full. Will be ignored if set to | | | | | 0. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | result_queue_count_threshold\| :ref:`t_alert_level` | C_RESULT_QUEUE\ | Severity of alert to be initiated if exceeding | | _severity | | _COUNT_THRESHOL\| result_queue_count_threshold | | | | D_SEVERITY | | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | bfm_config | t_bfm_config | C_VOID_BFM_CONF\| Record parameter required by the VVC Framework, | | | | IG | not applicable for this VVC | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | msg_id_panel | t_msg_id_panel | C_VVC_MSG_ID_PA\| VVC dedicated message ID panel. See | | | | NEL_DEFAULT | :ref:`vvc_framework_verbosity_ctrl` for how to | | | | | use verbosity control. | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | clock_name | string | "Set clock name"| Name of the VVC | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | clock_period | time | 10 ns | Clock period | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ | clock_high_time | time | 5 ns | Time of the clock cycle that is '1'. Value must | | | | | be less than clock_period | +------------------------------+------------------------------+-----------------+-------------------------------------------------+ .. note:: cmd/result queue parameters in the configuration record are unused and will be removed in v3.0, use instead the entity generic constants. The configuration record can be accessed from the Central Testbench Sequencer through the shared variable array, e.g. :: shared_clock_generator_vvc_config(C_VVC_IDX).clock_period := 50 ns; Status Record ================================================================================================================================== **vvc_status** accessible via **shared_clock_generator_vvc_status** .. include:: rst_snippets/vip_vvc_status.rst Methods ================================================================================================================================== * All VVC procedures are defined in vvc_methods_pkg.vhd (dedicated to this VVC). * See :ref:`vvc_framework_methods` for procedures which are common to all VVCs. * It is also possible to send a multicast to all instances of a VVC with ALL_INSTANCES as parameter for vvc_instance_idx. * All parameters in brackets are optional. .. note:: Some parameters in the VVC procedures are unconstrained for flexibility. However, the maximum sizes of such parameters need to be defined for the VVC framework. For this VVC, the following maximum values can be configured from adaptations_pkg: +--------------------------------------------+--------------------------------------+ | C_CLOCK_GEN_VVC_CMD_STRING_MAX_LENGTH | Maximum **msg** length | +--------------------------------------------+--------------------------------------+ .. _clock_generator_start_clock: start_clock() ---------------------------------------------------------------------------------------------------------------------------------- Adds a start_clock command to the Clock Generator VVC executor queue, which will run as soon as all preceding commands have completed. When the command is scheduled to run, the executor activates the clock generator process in the VVC. .. code-block:: start_clock(VVCT, vvc_instance_idx, msg, [scope]) +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | Object | Name | Dir. | Type | Description | +==========+====================+========+==============================+=========================================================+ | signal | VVCT | inout | t_vvc_target_record | VVC target type compiled into each VVC in order to | | | | | | differentiate between VVCs | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | vvc_instance_idx | in | integer | Instance number of the VVC | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | msg | in | string | A custom message to be appended in the log/alert | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | scope | in | string | Describes the scope from which the log/alert originates.| | | | | | Default value is C_VVC_CMD_SCOPE_DEFAULT defined in | | | | | | adaptations_pkg. | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ .. code-block:: -- Examples: start_clock(CLOCK_GENERATOR_VVCT, 1, "Start clock generator", C_SCOPE); .. _clock_generator_stop_clock: stop_clock() ---------------------------------------------------------------------------------------------------------------------------------- Adds a stop_clock command to the Clock Generator VVC executor queue, which will run as soon as all preceding commands have completed. When the command is scheduled to run, the executor deactivates the clock generator process in the VVC after finishing the current clock cycle. .. code-block:: stop_clock(VVCT, vvc_instance_idx, msg, [scope]) +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | Object | Name | Dir. | Type | Description | +==========+====================+========+==============================+=========================================================+ | signal | VVCT | inout | t_vvc_target_record | VVC target type compiled into each VVC in order to | | | | | | differentiate between VVCs | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | vvc_instance_idx | in | integer | Instance number of the VVC | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | msg | in | string | A custom message to be appended in the log/alert | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | scope | in | string | Describes the scope from which the log/alert originates.| | | | | | Default value is C_VVC_CMD_SCOPE_DEFAULT defined in | | | | | | adaptations_pkg. | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ .. code-block:: -- Examples: stop_clock(CLOCK_GENERATOR_VVCT, 1, "Stop clock generator", C_SCOPE); .. _clock_generator_set_clock_period: set_clock_period() ---------------------------------------------------------------------------------------------------------------------------------- Adds a set_clock_period command to the Clock Generator VVC executor queue, which will run as soon as all preceding commands have completed. When the command is scheduled to run, the executor updates the clock period and the change takes effect on the following rising clock edge. .. note:: * The clock high time will have to be set using the :ref:`clock_generator_set_clock_high_time` after setting a new clock period. * If the period is changed to a smaller value than the current high time, the :ref:`clock_generator_set_clock_high_time` must be called first to avoid a TB_ERROR. .. code-block:: set_clock_period(VVCT, vvc_instance_idx, clock_period, msg, [scope]) +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | Object | Name | Dir. | Type | Description | +==========+====================+========+==============================+=========================================================+ | signal | VVCT | inout | t_vvc_target_record | VVC target type compiled into each VVC in order to | | | | | | differentiate between VVCs | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | vvc_instance_idx | in | integer | Instance number of the VVC | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | clock_period | in | time | Clock period | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | msg | in | string | A custom message to be appended in the log/alert | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | scope | in | string | Describes the scope from which the log/alert originates.| | | | | | Default value is C_VVC_CMD_SCOPE_DEFAULT defined in | | | | | | adaptations_pkg. | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ .. code-block:: -- Examples: set_clock_period(CLOCK_GENERATOR_VVCT, 1, 10 ns, "Change clock period to 10 ns", C_SCOPE); .. _clock_generator_set_clock_high_time: set_clock_high_time() ---------------------------------------------------------------------------------------------------------------------------------- Adds a set_clock_high_time command to the Clock Generator VVC executor queue, which will run as soon as all preceding commands have completed. When the command is scheduled to run, the executor updates the clock high time and the change takes effect on the following rising clock edge. .. note:: If the high time is changed to a bigger value than the current clock period, the :ref:`clock_generator_set_clock_period` must be called first to avoid a TB_ERROR. .. code-block:: set_clock_high_time(VVCT, vvc_instance_idx, clock_high_time, msg, [scope]) +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | Object | Name | Dir. | Type | Description | +==========+====================+========+==============================+=========================================================+ | signal | VVCT | inout | t_vvc_target_record | VVC target type compiled into each VVC in order to | | | | | | differentiate between VVCs | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | vvc_instance_idx | in | integer | Instance number of the VVC | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | clock_high_time | in | time | Time of the clock cycle that is '1'. Value must be less | | | | | | than clock_period | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | msg | in | string | A custom message to be appended in the log/alert | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ | constant | scope | in | string | Describes the scope from which the log/alert originates.| | | | | | Default value is C_VVC_CMD_SCOPE_DEFAULT defined in | | | | | | adaptations_pkg. | +----------+--------------------+--------+------------------------------+---------------------------------------------------------+ .. code-block:: -- Examples: set_clock_high_time(CLOCK_GENERATOR_VVCT, 1, 6 ns, "Change the duty cycle to 60%", C_SCOPE); Compilation ================================================================================================================================== The Clock Generator VVC must be compiled with VHDL-2008 or newer. It is dependent on the following libraries: * UVVM Utility Library (UVVM-Util) * UVVM VVC Framework Before compiling the Clock Generator VVC, assure that uvvm_util and uvvm_vvc_framework have been compiled. See :ref:`Essential Mechanisms - Compile Scripts ` for information about compile scripts. .. table:: Compile order for the Clock Generator VVC +------------------------------+------------------------------------------------+-------------------------------------------------+ | Compile to library | File | Comment | +==============================+================================================+=================================================+ | bitvis_vip_clock_generator | vvc_cmd_pkg.vhd | Clock Generator VVC command types and operations| +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | ../uvvm_vvc_framework/src_target_dependent/td\ | UVVM VVC target support package, compiled into | | | _target_support_pkg.vhd | this VVC library | +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | ../uvvm_vvc_framework/src_target_dependent/td\ | Common UVVM framework methods compiled into the | | | _vvc_framework_common_methods_pkg.vhd | this VVC library | +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | vvc_methods_pkg.vhd | Clock Generator VVC methods | +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | ../uvvm_vvc_framework/src_target_dependent/td\ | UVVM queue package for this VVC | | | _queue_pkg.vhd | | +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | ../uvvm_vvc_framework/src_target_dependent/td\ | UVVM VVC entity support compiled into this | | | _vvc_entity_support_pkg.vhd | VVC library | +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | clock_generator_vvc.vhd | Clock Generator VVC | +------------------------------+------------------------------------------------+-------------------------------------------------+ | bitvis_vip_clock_generator | vvc_context.vhd | Clock Generator VVC context file | +------------------------------+------------------------------------------------+-------------------------------------------------+ Simulator compatibility and setup ---------------------------------------------------------------------------------------------------------------------------------- .. include:: rst_snippets/simulator_compatibility.rst .. include:: rst_snippets/ip_disclaimer.rst