summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/RebindingSpec.scala
blob: c246d68290e1cf55da8396892eec136b21cf78bc (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
// See LICENSE for license details.

package chiselTests

import chisel3._
import chisel3.stage.ChiselStage

class RebindingSpec extends ChiselFlatSpec with Utils {
  "Rebinding a literal" should "fail" in {
    a [BindingException] should be thrownBy extractCause[BindingException] {
      ChiselStage.elaborate { new Module {
        val io = IO(new Bundle {
          val a = 4.U
        })
      } }
    }
  }

  "Rebinding a hardware type" should "fail" in {
    a [BindingException] should be thrownBy extractCause[BindingException] {
      ChiselStage.elaborate { new Module {
        val io = IO(new Bundle {
          val a = Reg(UInt(32.W))
        })
      } }
    }
  }
}