-
Notifications
You must be signed in to change notification settings - Fork 614
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add no-plugin-tests for testing Chisel without the compiler plugin
This is a new SBT build unit that symlinks in some files from the normal chisel project tests, but builds them without the compiler plugin.
- Loading branch information
1 parent
2ed343e
commit 53b6204
Showing
7 changed files
with
70 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../../src/test/scala/chisel3/testers/TestUtils.scala |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../src/test/scala/chiselTests/ChiselSpec.scala |
1 change: 1 addition & 0 deletions
1
no-plugin-tests/src/test/scala/chiselTests/InstanceNameSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../src/test/scala/chiselTests/InstanceNameSpec.scala |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package chiselTests | ||
|
||
import chisel3._ | ||
import org.scalatest.exceptions.TestFailedException | ||
|
||
class ChiselTestUtilitiesSpec extends ChiselFlatSpec { | ||
// Who tests the testers? | ||
"assertKnownWidth" should "error when the expected width is wrong" in { | ||
val caught = intercept[ChiselException] { | ||
assertKnownWidth(7) { | ||
Wire(UInt(8.W)) | ||
} | ||
} | ||
assert(caught.getCause.isInstanceOf[TestFailedException]) | ||
} | ||
|
||
it should "error when the width is unknown" in { | ||
a [ChiselException] shouldBe thrownBy { | ||
assertKnownWidth(7) { | ||
Wire(UInt()) | ||
} | ||
} | ||
} | ||
|
||
it should "work if the width is correct" in { | ||
assertKnownWidth(8) { | ||
Wire(UInt(8.W)) | ||
} | ||
} | ||
|
||
"assertInferredWidth" should "error if the width is known" in { | ||
val caught = intercept[ChiselException] { | ||
assertInferredWidth(8) { | ||
Wire(UInt(8.W)) | ||
} | ||
} | ||
assert(caught.getCause.isInstanceOf[TestFailedException]) | ||
} | ||
|
||
it should "error if the expected width is wrong" in { | ||
a [TestFailedException] shouldBe thrownBy { | ||
assertInferredWidth(8) { | ||
val w = Wire(UInt()) | ||
w := 2.U(2.W) | ||
w | ||
} | ||
} | ||
} | ||
|
||
it should "pass if the width is correct" in { | ||
assertInferredWidth(4) { | ||
val w = Wire(UInt()) | ||
w := 2.U(4.W) | ||
w | ||
} | ||
} | ||
} | ||
|