summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/MissingCloneBindingExceptionSpec.scala
blob: c2c69bbff52846f13fa72f9cc5a0abe867b5791c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// See LICENSE for license details.

package chiselTests
import Chisel.ChiselException
import org.scalatest._

class MissingCloneBindingExceptionSpec extends ChiselFlatSpec with Matchers {
  behavior of "missing cloneType in Chisel3"
  ( the[ChiselException] thrownBy {
    import chisel3._

    class Test extends Module {
      class TestIO(w: Int) extends Bundle {
        val a = Input(Vec(4, UInt(w.W)))
      }

      val io = IO(new TestIO(32))
    }

    class TestTop extends Module {
      val io = IO(new Bundle {})

      val subs = VecInit(Seq.fill(2) {
        Module(new Test).io
      })
    }

    elaborate(new TestTop)
  }).getMessage should include("make all parameters immutable")

  behavior of "missing cloneType in Chisel2"
  ( the[ChiselException] thrownBy {
    import Chisel._

    class Test extends Module {
      class TestIO(w: Int) extends Bundle {
        val a = Vec(4, UInt(width = w)).asInput
      }

      val io = IO(new TestIO(32))
    }

    class TestTop extends Module {
      val io = IO(new Bundle {})

      val subs = Vec.fill(2) {
        Module(new Test).io
      }
    }

    elaborate(new TestTop)
  }).getMessage should include("make all parameters immutable")
}