This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChiselBridge: filter out chisel options (#685)
Showing
3 changed files
with
58 additions
and
45 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
36 changes: 36 additions & 0 deletions
36
src/test/scala/chiseltest/tests/ChiselAnnotationTests.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,36 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package chiseltest.tests | ||
|
||
import chisel3._ | ||
import chisel3.stage.{PrintFullStackTraceAnnotation, ThrowOnFirstErrorAnnotation} | ||
import chiseltest._ | ||
import org.scalatest.freespec.AnyFreeSpec | ||
|
||
class FaultyModule extends Module { | ||
val in = IO(Input(UInt())) | ||
// this will cause an exception | ||
val inWidth = in.getWidth | ||
} | ||
|
||
class ChiselAnnotationTests extends AnyFreeSpec with ChiselScalatestTester { | ||
"PrintFullStackTraceAnnotation should be accepted" in { | ||
val e1 = intercept[ChiselException] { | ||
test(new FaultyModule) { dut => } | ||
} | ||
assert(e1.getStackTrace.length == 5) | ||
|
||
val e2 = intercept[ChiselException] { | ||
test(new FaultyModule).withChiselAnnotations(Seq(PrintFullStackTraceAnnotation)) { dut => } | ||
} | ||
assert(e2.getStackTrace.length > 50) | ||
} | ||
|
||
"PrintFullStackTraceAnnotation should be accepted even for a working design" in { | ||
test(new PassthroughModule(UInt(4.W))).withChiselAnnotations(Seq(PrintFullStackTraceAnnotation)) { dut => } | ||
} | ||
|
||
"ThrowOnFirstErrorAnnotation should be accepted even for a working design" in { | ||
test(new PassthroughModule(UInt(4.W))).withChiselAnnotations(Seq(ThrowOnFirstErrorAnnotation)) { dut => } | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
src/test/scala/chiseltest/tests/ShowFullStacktraceTest.scala
This file was deleted.
Oops, something went wrong.