chipsalliance / chipsalliance/chisel

Why does FixedPoint get interpreted as Double when printing?

Open
#1,588 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

Type of issue: other enhancement

Impact: potentially changes the string width of FixedPoint prints

Why does the FixedPoint toString method try to interpret is as a Double instead of BigDecimal?

```scala
override def toString: String = {
val bindingString = litToDoubleOption match {
case Some(value) => s"($value)"
case _ => bindingToString
}
s"FixedPoint$width$binaryPoint$bindingString"
}
```

This causes the printing of any FixedPoint bigger than a Double to fail.

Perhaps instead of using litToDoubleOption, we should use litToBigDecimalOption.

https://github.com/freechipsproject/chisel3/blob/2f9f12a811bf81c37da4eaf854f71a57f46e45ff/core/src/main/scala/chisel3/Bits.scala#L1234

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.