diff options
| author | Edward Wang | 2018-07-08 02:36:18 -0700 |
|---|---|---|
| committer | edwardcwang | 2018-08-22 11:55:38 -0700 |
| commit | 02d6fbbacaf5da2080dd406b98cddbdab2ab5cb1 (patch) | |
| tree | 096fad5b80f2f7f8cd2e79526cd37111e326942b /src | |
| parent | 3679e80c72e67c7c1b09a8f3f5315bc4d3e8d9ab (diff) | |
Warn user that using Seq for hardware construction in Bundle is not supported
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/BundleSpec.scala | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/BundleSpec.scala b/src/test/scala/chiselTests/BundleSpec.scala index bb1393bc..b248f7b5 100644 --- a/src/test/scala/chiselTests/BundleSpec.scala +++ b/src/test/scala/chiselTests/BundleSpec.scala @@ -25,6 +25,11 @@ trait BundleSpecUtils { override def cloneType = (new BundleBar).asInstanceOf[this.type] } + class BadSeqBundle extends Bundle { + val bar = Seq(UInt(16.W), UInt(8.W), UInt(4.W)) + override def cloneType = (new BadSeqBundle).asInstanceOf[this.type] + } + class MyModule(output: Bundle, input: Bundle) extends Module { val io = IO(new Bundle { val in = Input(input) @@ -68,4 +73,47 @@ class BundleSpec extends ChiselFlatSpec with BundleSpecUtils { elaborate { new MyModule(new BundleFoo, new BundleFooBar) } }).getMessage should include ("Left Record missing field") } + + "Bundles" should "not be able to use Seq for constructing hardware" in { + (the[ChiselException] thrownBy { + elaborate { + new Module { + val io = IO(new Bundle { + val b = new BadSeqBundle + }) + } + } + }).getMessage should include("Public Seq members cannot be used to define Bundle elements") + } + + "Bundles" should "be allowed to have Seq if need be" in { + assertTesterPasses { + new BasicTester { + val m = Module(new Module { + val io = IO(new Bundle { + val b = new BadSeqBundle { + override def ignoreSeq = true + } + }) + }) + stop() + } + } + } + + "Bundles" should "be allowed to have non-Chisel Seqs" in { + assertTesterPasses { + new BasicTester { + val m = Module(new Module { + val io = IO(new Bundle { + val f = Output(UInt(8.W)) + val unrelated = (0 to 10).toSeq + val unrelated2 = Seq("Hello", "World", "Chisel") + }) + io.f := 0.U + }) + stop() + } + } + } } |
