diff options
| author | Jack Koenig | 2017-08-17 11:26:29 -0700 |
|---|---|---|
| committer | GitHub | 2017-08-17 11:26:29 -0700 |
| commit | 802cfc4405c28ae212a955a92c7a6ad2d2b6f0c2 (patch) | |
| tree | 23f8d8be14506cb2cfcacfd89eb4ef35cccfe925 /src/test/scala/chiselTests/FromBitsTester.scala | |
| parent | 90e775b1228765ce7f345716fa215f72b97816a9 (diff) | |
Make Reset a trait (#672)
Bool implements Reset. Compatibility package includes an implicit
conversion from Reset to Bool.
Diffstat (limited to 'src/test/scala/chiselTests/FromBitsTester.scala')
| -rw-r--r-- | src/test/scala/chiselTests/FromBitsTester.scala | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/test/scala/chiselTests/FromBitsTester.scala b/src/test/scala/chiselTests/FromBitsTester.scala deleted file mode 100644 index e916272f..00000000 --- a/src/test/scala/chiselTests/FromBitsTester.scala +++ /dev/null @@ -1,67 +0,0 @@ -// See LICENSE for license details. - -package chiselTests - -import org.scalatest._ - -import chisel3._ -import chisel3.experimental.{DataMirror, FixedPoint} -import chisel3.testers.BasicTester -import chisel3.util._ - -class FromBitsBundleTester extends BasicTester { - class MultiTypeBundle extends Bundle { - val u = UInt(4.W) - val s = SInt(4.W) - val fp = FixedPoint(4.W, 3.BP) - } - - val bun = new MultiTypeBundle - - val bunFromBits = ((4 << 8) + (15 << 4) + (12 << 0)).U.asTypeOf(bun) - - assert(bunFromBits.u === 4.U) - assert(bunFromBits.s === -1.S) - assert(bunFromBits.fp === FixedPoint.fromDouble(-0.5, 4.W, 3.BP)) - - stop() -} - -class FromBitsVecTester extends BasicTester { - val vec = ((15 << 12) + (0 << 8) + (1 << 4) + (2 << 0)).U.asTypeOf(Vec(4, SInt(4.W))) - - assert(vec(0) === 2.S) - assert(vec(1) === 1.S) - assert(vec(2) === 0.S) - assert(vec(3) === -1.S) - - stop() -} - -class FromBitsTruncationTester extends BasicTester { - val truncate = (64 + 3).U.asTypeOf(UInt(3.W)) - val expand = 1.U.asTypeOf(UInt(3.W)) - - assert( DataMirror.widthOf(truncate).get == 3 ) - assert( truncate === 3.U ) - assert( DataMirror.widthOf(expand).get == 3 ) - assert( expand === 1.U ) - - stop() -} - -class FromBitsSpec extends ChiselFlatSpec { - behavior of "fromBits" - - it should "work with Bundles containing Bits Types" in { - assertTesterPasses{ new FromBitsBundleTester } - } - - it should "work with Vecs containing Bits Types" in { - assertTesterPasses{ new FromBitsVecTester } - } - - it should "expand and truncate UInts of different width" in { - assertTesterPasses{ new FromBitsTruncationTester } - } -} |
