diff options
| author | Chick Markley | 2016-10-25 08:59:15 -0700 |
|---|---|---|
| committer | GitHub | 2016-10-25 08:59:15 -0700 |
| commit | e00ae6ff3518d517733f5cfe3959e8b31c5876b5 (patch) | |
| tree | 93063422d03f13c6585b7a582dcf24c1f27b0b6a /src/main | |
| parent | a44c7aede6902533ea79fcf6a3fbed234b4456c0 (diff) | |
FixedPoint number support for chisel3 (#328)
* FixedPoint number support for chisel3
FixedPoint numbers have a width and a binary position
Either, neither or both maybe inferred.
Firrtl will convert these to SInts during lowering passes
* Fixes based on Jack's comments on PR #328
* Add experimental warning to FixedPoint class and object
* Fixed comment per Adam's comment on PR #328
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/chisel3/package.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/package.scala b/src/main/scala/chisel3/package.scala index d0808980..e0364868 100644 --- a/src/main/scala/chisel3/package.scala +++ b/src/main/scala/chisel3/package.scala @@ -37,6 +37,8 @@ package object chisel3 { // scalastyle:ignore package.object.name val UInt = chisel3.core.UInt type SInt = chisel3.core.SInt val SInt = chisel3.core.SInt + type FixedPoint = chisel3.core.FixedPoint + val FixedPoint = chisel3.core.FixedPoint type Bool = chisel3.core.Bool val Bool = chisel3.core.Bool val Mux = chisel3.core.Mux @@ -150,6 +152,10 @@ package object chisel3 { // scalastyle:ignore package.object.name def B: Bool = Bool(x) // scalastyle:ignore method.name } + implicit class fromDoubleToLiteral(val x: Double) extends AnyVal { + def F(binaryPoint: Int): FixedPoint = FixedPoint.fromDouble(x, binaryPoint = binaryPoint) + } + implicit class fromUIntToBitPatComparable(val x: UInt) extends AnyVal { final def === (that: BitPat): Bool = macro SourceInfoTransform.thatArg @deprecated("Use '=/=', which avoids potential precedence problems", "chisel3") |
