diff options
| author | Jim Lawson | 2016-10-24 10:54:14 -0700 |
|---|---|---|
| committer | GitHub | 2016-10-24 10:54:14 -0700 |
| commit | ae62ebe5e826c55eacaeaa83a4e6db975ab5d8a1 (patch) | |
| tree | 1393bbb14303af86aeb5e5ed0375f302864b8307 /src/test/scala/chiselTests/BundleWire.scala | |
| parent | 5df30b390ae5817c4793c6d4e0c5466d96d241f1 (diff) | |
| parent | b0b5fd3140186651eb558bd6f4ca51c618deacc9 (diff) | |
Merge pull request #212 from ucb-bar/tobits-deprecation
Tobits deprecation
Diffstat (limited to 'src/test/scala/chiselTests/BundleWire.scala')
| -rw-r--r-- | src/test/scala/chiselTests/BundleWire.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/BundleWire.scala b/src/test/scala/chiselTests/BundleWire.scala index 53d46e93..5b38ff6e 100644 --- a/src/test/scala/chiselTests/BundleWire.scala +++ b/src/test/scala/chiselTests/BundleWire.scala @@ -24,6 +24,27 @@ class BundleWire(n: Int) extends Module { } } +class BundleToUnitTester extends BasicTester { + val bundle1 = Wire(new Bundle { + val a = UInt(width = 4) + val b = UInt(width = 4) + }) + val bundle2 = Wire(new Bundle { + val a = UInt(width = 2) + val b = UInt(width = 6) + }) + + // 0b00011011 split as 0001 1011 and as 00 011011 + bundle1.a := 1.U + bundle1.b := 11.U + bundle2.a := 0.U + bundle2.b := 27.U + + assert(bundle1.asUInt() === bundle2.asUInt()) + + stop() +} + class BundleWireTester(n: Int, x: Int, y: Int) extends BasicTester { val dut = Module(new BundleWire(n)) dut.io.in.x := UInt(x) @@ -43,3 +64,10 @@ class BundleWireSpec extends ChiselPropSpec { } } } + +class BundleToUIntSpec extends ChiselPropSpec { + property("Bundles with same data but different, underlying elements should compare as UInt") { + assertTesterPasses( new BundleToUnitTester ) + } +} + |
