diff options
| author | Schuyler Eldridge | 2019-07-31 13:11:44 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2019-07-31 15:53:26 -0400 |
| commit | 182e8781473b72e3a086dbf806081639d52aac06 (patch) | |
| tree | d57146f1da89e0c5b2d3a20424cb22e7c14dbf76 /src/test | |
| parent | 09f7aa03e1e729ad9e6eb97ab08419d0b95c8703 (diff) | |
Add Enum deprecated compatibility tests
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/chiselTests/CompatibilitySpec.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/CompatibilitySpec.scala b/src/test/scala/chiselTests/CompatibilitySpec.scala index eece45e2..9a00ac0f 100644 --- a/src/test/scala/chiselTests/CompatibilitySpec.scala +++ b/src/test/scala/chiselTests/CompatibilitySpec.scala @@ -358,4 +358,28 @@ class CompatibiltySpec extends ChiselFlatSpec with GeneratorDrivenPropertyChecks elaborate(new Foo) } + + behavior of "Enum" + + it should "support apply[T <: Bits](nodeType: T, n: Int): List[T]" in { + class Foo extends Module { + val io = IO(new Bundle{}) + + info("works for a UInt") + Enum(UInt(), 4) shouldBe a [List[UInt]] + + info("throw an exception for non-UInt types") + intercept [IllegalArgumentException] { + Enum(SInt(), 4) + }.getMessage should include ("Only UInt supported for enums") + + info("throw an exception if the bit width is specified") + intercept [IllegalArgumentException] { + Enum(UInt(width = 8), 4) + }.getMessage should include ("Bit width may no longer be specified for enums") + } + + elaborate(new Foo) + } + } |
