summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Bits.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
index 035ac213..a769342d 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
@@ -911,6 +911,12 @@ sealed class FixedPoint private (width: Width, val binaryPoint: BinaryPoint, lit
override def do_asUInt(implicit sourceInfo: SourceInfo): UInt = pushOp(DefPrim(sourceInfo, UInt(this.width), AsUIntOp, ref))
override def do_asSInt(implicit sourceInfo: SourceInfo): SInt = pushOp(DefPrim(sourceInfo, SInt(this.width), AsSIntOp, ref))
//TODO(chick): Consider "convert" as an arithmetic conversion to UInt/SInt
+
+ override def do_fromBits(that: Bits)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): this.type = {
+ val res = Wire(this, null).asInstanceOf[this.type]
+ res := that.asFixedPoint(this.binaryPoint)
+ res
+ }
}
/** Use PrivateObject to force users to specify width and binaryPoint by name