Skip to content

ChiselTest Compatibility Layer for Chisel 7#5221

Open
EhsanKhodadad wants to merge 4 commits intochipsalliance:mainfrom
EhsanKhodadad:main
Open

ChiselTest Compatibility Layer for Chisel 7#5221
EhsanKhodadad wants to merge 4 commits intochipsalliance:mainfrom
EhsanKhodadad:main

Conversation

@EhsanKhodadad
Copy link
Copy Markdown

@EhsanKhodadad EhsanKhodadad commented Mar 3, 2026

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Feature (or new API)

Desired Merge Strategy

  • Squash: The PR will be squashed and merged (choose this if you have no preference).

Release Notes

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash) and clean up the commit message.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 3, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@jackkoenig
Copy link
Copy Markdown
Contributor

Howdy @EhsanKhodadad, thank you for the contribution! Can you sign the CLA?

@EhsanKhodadad
Copy link
Copy Markdown
Author

Howdy @EhsanKhodadad, thank you for the contribution! Can you sign the CLA?

Hi Jack, thank you for your comment.
Sure, I am looking for someone who can sign on behalf of my university.

@jackkoenig jackkoenig added the Feature New feature, will be included in release notes label Apr 13, 2026
Copy link
Copy Markdown
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.

Thank you again for doing this and for following up on the CLA. I have some comments.

I don't have a very good way to see how well this work in migrating from Chisel 6 with chiseltest to Chisel 7 with this. Do you have some example open-source code where we can see the code diff to perhaps use as a motivating example?

* This package provides example modules and utilities for testing with the
* ChiselTest compatibility layer on ChiselSim.
*/
package object examples {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think of this examples stuff should live in main, I think it should be over in test/scala/chiselTests.

* These are compatibility stubs that allow code to compile but may not provide
* full formal verification functionality.
*/
package object formal {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused by this, not only is it not supported but this doesn't work right? I think it would be better for it not to compile than to vacuously pass.

Comment on lines +194 to +200
object ChiselTestCompat {
import chisel3.simulator.EphemeralSimulator._

/**
* Implicit class to add ChiselTest-style operations to Data types
*/
implicit class testableData[T <: Data](val x: T) extends AnyVal {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should these maybe be in package object chiseltest so they're available by default when one does a wildcard import? Or is there a reason to keep them separate?

Comment on lines +23 to +26
object DecoupledDriver {
// For compatibility with imports like: import chiseltest.DecoupledDriver._
// The actual implicit classes are defined in the package object
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think DecoupledDriver was a class in chiseltest, not an object, so what does this do? import chiseltest.DecoupledDriver._ shouldn't be legal in chiseltest.


## ChiselTest Compatibility Layer

For projects with a large test suite, Chisel now includes a **ChiselTest compatibility layer** at `chiseltest.*` that provides a drop-in replacement for most ChiselTest APIs. This allows you to keep your existing test code while running on ChiselSim.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
For projects with a large test suite, Chisel now includes a **ChiselTest compatibility layer** at `chiseltest.*` that provides a drop-in replacement for most ChiselTest APIs. This allows you to keep your existing test code while running on ChiselSim.
For projects with a large test suite, Chisel now includes a **ChiselTest compatibility layer** at `chiseltest._` that provides a drop-in replacement for most ChiselTest APIs. This allows you to keep your existing test code while running on ChiselSim.

Let's keep the wildcard import suggestion Scala 2-style


Simply keep your existing imports and test structure:

```scala
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be mdoc to make sure it compiles (like the examples above)?

Suggested change
```scala
```scala mdoc

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