Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for running testbenches depending on a set of user-prov… #1095

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

LarsAsplund
Copy link
Collaborator

…ided source files.

The intended use case is to feed VUnit with files that has been changed since some point in time. The changes are typically provided by the version control system.

The API is:

    def run_dependent(self, source_files: List[Union[str, Path]]) -> None:
        """
        Run testbenches depending on the provided source files.

        Test patterns on the command line will add to the depending testbenches.

        :param source_files: List of :class:`str` or :class:`pathlib.Path` items,
                             each representing the relative or absolute path to
                             the source file.
        :returns: None
        """

@LarsAsplund
Copy link
Collaborator Author

@LukasVik Is this compatible with the similar function in TSFPGA?

@LukasVik
Copy link
Contributor

LukasVik commented Jan 27, 2025 via email

@LarsAsplund
Copy link
Collaborator Author

@LukasVik

Yes, a testbench can also be passed. The testbench is dependent on itself.

Note that there are important changes that VUnit can't detect directly. Let's say you have no changes to your HDL files but there's a stimuli file to tb_x that changed. In that case tb_x should be simulated. The way to deal with that is to process the changes reported by your version control system. If the stimuli file has changed, tb_x is added to the list of files.

Preprocessing works. VUnit keeps track of both the original file name and the preprocessed file name and the user-provided files are compared with the original.

Your understanding of run_dependent is correct. Agree that the name is a bit misleading and should be changed. I'm thinking about include_dependent_in_test_pattern because it makes it easier to also add a exclude_dependent_from_test_pattern.

@LukasVik
Copy link
Contributor

Sounds great!

Note that there are important changes that VUnit can't detect directly. Let's say you have no changes to your HDL files but there's a stimuli file to tb_x that changed. In that case tb_x should be simulated. The way to deal with that is to process the changes reported by your version control system. If the stimuli file has changed, tb_x is added to the list of files.

Yes makes sense. In the tsfpga class (https://github.com/tsfpga/tsfpga/blob/main/tsfpga/git_simulation_subset.py) we detect changes in the regs_*.toml/json/yaml and trigger based on that. There are probably other cases like that but I agree that all that needs to be handled outside of VUnit.

Preprocessing works. VUnit keeps track of both the original file name and the preprocessed file name and the user-provided files are compared with the original.

Great, a lot of the complexity in the tsfpga class is the handling of original vs processed path. Nice to get rid of that.

Your understanding of run_dependent is correct. Agree that the name is a bit misleading and should be changed. I'm thinking about include_dependent_in_test_pattern because it makes it easier to also add a exclude_dependent_from_test_pattern.

Cool. I agree with the naming.

Copy link
Contributor

@LukasVik LukasVik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks overall good to me, it's a good addtion. Some minor comments.

vunit/ui/__init__.py Outdated Show resolved Hide resolved
vunit/ui/__init__.py Outdated Show resolved Hide resolved
vunit/ui/__init__.py Outdated Show resolved Hide resolved
@LarsAsplund LarsAsplund force-pushed the dependent_testbenches branch 5 times, most recently from cd1330e to 671c7f7 Compare January 30, 2025 22:10
@LarsAsplund LarsAsplund force-pushed the dependent_testbenches branch from 671c7f7 to 7645976 Compare January 31, 2025 06:32
@LarsAsplund LarsAsplund merged commit 74dc4ba into master Jan 31, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants