Skip to content

Conversation

seldridge
Copy link
Member

Add a new simulator, DefaultSimulator, to Chiselsim. This fills a major, long-standing hole in this API by adding a simulator that does not delete all the files that it creates after a test runs.

This uses a type class, HasTestingDirectory, to allow for control over where the directory is created. A default implementation is provided which uses a nanosecond resolution timestamp to differentiate the tests. E.g., example output from running the new test included in this commit multiple times is:

test_run_dir/
└── DefaultSimulator
    ├── 2025-02-05T16-58-02.175175
    ├── 2025-02-05T16-58-11.941263
    └── 2025-02-05T16-58-17.721776

Note: a Scalatest-based type class implementation is intentionally not provided as part of this PR. This will be provided in a follow-on in such a way that Chiselsim does not inherit a dependency on Scalatest. Ideally, users of Scalatest will use the future Scalatest-based type class implementation to get a subdirectory which is not a timestamp, but derived from the name of that part of the test. I.e., a directory like:

test_run_dir/
└── DefaultSimulator
    ├── writes_files_to_a_permanent_directory_on_disk
    └── doesnt_delete_the_root_directory

Release Notes

Add DefaultSimulator to Chiselsim to provide a simulator which doesn't delete its build directory. This fills a long-standing hole where only the EphemeralSimulator was provided which will delete the build directory. The current directory structure is timestamp-based.

Add a new simulator, DefaultSimulator, to Chiselsim.  This fills a major,
long-standing hole in this API by adding a simulator that does not delete
all the files that it creates after a test runs.

This uses a type class, `HasTestingDirectory`, to allow for control over
where the directory is created.  A default implementation is provided
which uses a nanosecond resolution timestamp to differentiate the tests.
E.g., example output from running the new test included in this commit
multiple times is:

    test_run_dir/
    └── DefaultSimulator
        ├── 2025-02-05T16-58-02.175175
        ├── 2025-02-05T16-58-11.941263
        └── 2025-02-05T16-58-17.721776

Note: a Scalatest-based type class implementation is intentionally _not_
provided as part of this PR.  This will be provided in a follow-on in such
a way that Chiselsim does not inherit a dependency on Scalatest.  Ideally,
users of Scalatest will use the future Scalatest-based type class
implementation to get a subdirectory which is not a timestamp, but derived
from the name of that part of the test.  I.e., a directory like:

    test_run_dir/
    └── DefaultSimulator
        ├── writes_files_to_a_permanent_directory_on_disk
        └── doesnt_delete_the_root_directory

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
@seldridge seldridge added the Feature New feature, will be included in release notes label Feb 5, 2025
@seldridge seldridge requested a review from jackkoenig February 5, 2025 23:15
Copy link
Contributor

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

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

LGTM! Glad to see progress here

@seldridge seldridge merged commit f9f6d59 into main Feb 6, 2025
15 checks passed
@seldridge seldridge deleted the dev/seldridge/default-simulator branch February 6, 2025 00:41
@seldridge seldridge added No Release Notes Exclude from release notes, consider using Internal instead and removed No Release Notes Exclude from release notes, consider using Internal instead labels Mar 3, 2025
@seldridge
Copy link
Member Author

This was changed to "no release notes" since this API was removed before ever being released (even in a milestone release) with: #4763

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature, will be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants