From 1d5b067ee8f025b4eddb5a293be0a2d624610056 Mon Sep 17 00:00:00 2001 From: chick Date: Wed, 11 Dec 2019 12:51:25 -0800 Subject: - Change getPossibleValues of Interval to return a NumericRange former Seq materialized all values - Fixed computation in getHighestPossibleValue, erroneously was using lower intead of upper --- chiselFrontend/src/main/scala/chisel3/internal/firrtl/IR.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chiselFrontend/src/main/scala/chisel3/internal/firrtl/IR.scala b/chiselFrontend/src/main/scala/chisel3/internal/firrtl/IR.scala index bc662ddb..e76a8d60 100644 --- a/chiselFrontend/src/main/scala/chisel3/internal/firrtl/IR.scala +++ b/chiselFrontend/src/main/scala/chisel3/internal/firrtl/IR.scala @@ -9,6 +9,7 @@ import chisel3.experimental._ import _root_.firrtl.{ir => firrtlir} import _root_.firrtl.PrimOps +import scala.collection.immutable.NumericRange import scala.math.BigDecimal.RoundingMode // scalastyle:off number.of.types @@ -432,7 +433,7 @@ sealed class IntervalRange( val getHighestPossibleValue: Option[BigDecimal] = { increment match { case Some(inc) => - lower match { + upper match { case firrtlir.Closed(n) => Some(n) case firrtlir.Open(n) => Some(n - inc) case _ => None @@ -446,7 +447,7 @@ sealed class IntervalRange( * Mostly to be used for testing * @return */ - def getPossibleValues: Seq[BigDecimal] = { + def getPossibleValues: NumericRange[BigDecimal] = { (getLowestPossibleValue, getHighestPossibleValue, increment) match { case (Some(low), Some(high), Some(inc)) => (low to high by inc) case (_, _, None) => -- cgit v1.2.3