8. Code Documentation

8.1. Test_Generator

uatg.test_generator.clean_dirs(work_dir, modules_dir)[source]

This function cleans the files generated by UATG. Presently it removes __pycache__, work_dir directory and also removes the ‘.yapsy plugins’ files in the module’s directories.

uatg.test_generator.generate_sv(work_dir, config_dict, modules, modules_dir, alias_dict)[source]

The generate_sv function dumps the covergroups written by the user into a ‘coverpoints.sv’ file present within the ‘sv_top’ directory within the work directory. This function dumps into an SV file only if the test_class contains the generate_covergroups method. This function, like generate_asm also allows to select the modules for which covergroups are to be generated. In addition, the method also takes in an alias_dict which can be used to alias the BSV signal names to something even more comprehensible.

uatg.test_generator.generate_tests(work_dir, linker_dir, modules, config_dict, test_list, modules_dir)[source]

The function generates ASM files for all the test classes specified within the module_dir. The user can also select the modules for which he would want the tests to be generated for. The YAPSY plugins for the tests are generated by the function automatically.

The tests are created within the work directory passed by the user. A test_list is also created in the yaml format by the function. The test generator also creates a linker file as well as the header files for running the ASM files on the DUT, when required. Finally, the test generator only generates the tests whose targets are implemented in the DUT.

uatg.test_generator.validate_tests(modules, config_dict, work_dir, modules_dir)[source]

Parses the log returned from the DUT for finding if the tests were successful. The user should have created regular expressions for the patterns he’s expecting to be seen in the log generated by the DUT. In addition to just the checking, it can also be set up to provide a report for every test for which the user tries to validate.

8.2. Utils

uatg.utils.clean_modules(module_dir, modules)[source]

Function to read the modules specified by the user, check if they exist or raise an error. Returns a list of the modules for which tests will be generated.

uatg.utils.create_alias_file(alias_path)[source]

Creates a template aliasing.yaml file at the alias_path directory. Invoked by running uatg setup

uatg.utils.create_config_file(config_path)[source]

Creates a template config.ini file at the config_path directory. Invoked by running uatg setup.

uatg.utils.create_dut_config(dut_config_path)[source]

Creates a template dut_config.yaml (based on Chromite’s default configuration at the dut_config_path. Invoked by running the uatg setup command

uatg.utils.create_linker(target_dir)[source]

Creates a template linker file in the target_directory specified by the user.

uatg.utils.create_model_test_h(target_dir)[source]

Creates a model_test.h file in the target directory specified by the user.

uatg.utils.create_plugins(plugins_path)[source]

This function is used to create Yapsy Plugin files. The YAPSY plugins are required to be in a certain pattern. This function will read the test classes and create files complying to the pattern. Yapsy will ignore all other python file which does not have a .yapsy-plugin file associated with it.

uatg.utils.generate_sv_components(sv_dir, alias_file)[source]

invokes the methods within the sv_components class and creates the sv files. tb_top.sv, interface.sv and Defines.sv are created. The coverpoints.sv file will be generated by the test_generator

uatg.utils.generate_test_list(asm_dir, uarch_dir, test_list)[source]

updates the test_list.yaml file with the location of the tests generated by test_generator as well the directory to dump the logs. Check the test_list format documentation present. The test list generation is an optional feature which the user may choose to use.

uatg.utils.info(version)[source]

The function prints the Information about UATG.

uatg.utils.join_yaml_reports(work_dir='abs_path_here/', module='branch_predictor')[source]

Function that combines all the verification report yaml files into one. This function is used as a part of the Check_logs/validate option present in UATG.

uatg.utils.list_of_modules(module_dir)[source]

lists the tests modules available by reading the index.yaml file present in the modules directory.

uatg.utils.load_yaml(file)[source]

Common function to load YAML Files. The function checks if the file is of YAML format else exits. If the file is in YAML, it reads the file and returns the data from the file as a dictionary.

uatg.utils.rvtest_data(bit_width=0, num_vals=20, random=True, signed=False, align=4)[source]

Used to specify the data to be loaded into the test_data section of the DUT memory. The user will specify the data he wants in this section of the DUT memory.

class uatg.utils.sv_components(config_file)[source]

This class contains the methods which will return the tb_top and interface system verilog tests. This text will be written into SV files.

__init__(config_file)[source]

Initialize self. See help(type(self)) for accurate signature.

__weakref__

list of weak references to the object (if defined)

generate_defines()[source]

creates the syntax for the defines file which will be used to select tests.

generate_interface()[source]

returns interface SV syntax.

generate_tb_top()[source]

returns tb_top Sv syntax

8.3. Tests

The tests are a part of another repository. Hence, refer to the Tests in the UTG Framework section of this documentation for some information about the test format.