summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/RebindingSpec.scala
blob: 808b11370b690abe406e4f12e15c077e1b0fbe85 (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
// SPDX-License-Identifier: Apache-2.0

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))
        })
      } }
    }
  }
}