summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/FixedPointSpec.scala
diff options
context:
space:
mode:
authorgrebe2017-01-13 09:51:18 -0800
committerChick Markley2017-01-13 09:51:18 -0800
commitf19653fbe9d2e1b49c49c31ddb98a758c390ba94 (patch)
treecd295142ab5a0040c4beb5606fc1c2cdc2901e28 /src/test/scala/chiselTests/FixedPointSpec.scala
parent3215df07a97b58babb1deb3fab0928198b1daad2 (diff)
Make fromBits work with types other than UInt (#424)
* Make fromBits work with types other than UInt * Oops, left in a println * Add test for truncation/expansion * Fix stuff that broke when FixedPoint fromBits PR was merged. * Use .BP shorthand added in previous PR
Diffstat (limited to 'src/test/scala/chiselTests/FixedPointSpec.scala')
-rw-r--r--src/test/scala/chiselTests/FixedPointSpec.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/FixedPointSpec.scala b/src/test/scala/chiselTests/FixedPointSpec.scala
index a08de073..4e6af33b 100644
--- a/src/test/scala/chiselTests/FixedPointSpec.scala
+++ b/src/test/scala/chiselTests/FixedPointSpec.scala
@@ -22,15 +22,19 @@ class FixedPointLiteralSpec extends FlatSpec with Matchers {
class FixedPointFromBitsTester extends BasicTester {
val uint = 3.U(4.W)
val sint = -3.S
+ val fp = FixedPoint.fromDouble(3.0, width = 4, binaryPoint = 0)
val fp_tpe = FixedPoint(4.W, 1.BP)
val uint_result = FixedPoint.fromDouble(1.5, width = 4, binaryPoint = 1)
val sint_result = FixedPoint.fromDouble(-1.5, width = 4, binaryPoint = 1)
+ val fp_result = FixedPoint.fromDouble(1.5, width = 4, binaryPoint = 1)
val uint2fp = fp_tpe.fromBits(uint)
val sint2fp = fp_tpe.fromBits(sint)
+ val fp2fp = fp_tpe.fromBits(fp)
assert(uint2fp === uint_result)
assert(sint2fp === sint_result)
+ assert(fp2fp === fp_result)
stop()
}