summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/RebindingSpec.scala
blob: 5dc0589e95887facdd9306e3025edf330ed59017 (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
// 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))
          })
        }
      }
    }
  }
}