summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/UIntFactory.scala
diff options
context:
space:
mode:
authorAditya Naik2024-05-03 10:59:45 -0700
committerAditya Naik2024-05-03 10:59:45 -0700
commit878d488a7c8e0d6973de58b3164022c6a102e449 (patch)
treecd081bbcbe3f797f80b10c2d8153da0069750e51 /core/src/main/scala/chisel3/UIntFactory.scala
parent8200c0cdf1d471453946d5ae24bc99757b2ef02d (diff)
Get cleanup to compile
Diffstat (limited to 'core/src/main/scala/chisel3/UIntFactory.scala')
-rw-r--r--core/src/main/scala/chisel3/UIntFactory.scala24
1 files changed, 1 insertions, 23 deletions
diff --git a/core/src/main/scala/chisel3/UIntFactory.scala b/core/src/main/scala/chisel3/UIntFactory.scala
index 64127991..66c6f9c8 100644
--- a/core/src/main/scala/chisel3/UIntFactory.scala
+++ b/core/src/main/scala/chisel3/UIntFactory.scala
@@ -2,7 +2,7 @@
package chisel3
-import chisel3.internal.firrtl.{IntervalRange, KnownWidth, ULit, UnknownWidth, Width}
+import chisel3.internal.firrtl.{KnownWidth, ULit, UnknownWidth, Width}
import firrtl.Utils
import firrtl.constraint.IsKnown
import firrtl.ir.{Closed, IntWidth, Open}
@@ -23,26 +23,4 @@ trait UIntFactory {
// Bind result to being an Literal
lit.bindLitArg(result)
}
-
- /** Create a UInt with the specified range, validate that range is effectively > 0
- */
- def apply(range: IntervalRange): UInt = {
- // Check is only done against lower bound because range will already insist that range high >= low
- range.lowerBound match {
- case Closed(bound) if bound < 0 =>
- throw new ChiselException(s"Attempt to create UInt with closed lower bound of $bound, must be > 0")
- case Open(bound) if bound < -1 =>
- throw new ChiselException(s"Attempt to create UInt with open lower bound of $bound, must be > -1")
- case _ =>
- }
-
- // because this is a UInt we don't have to take into account the lower bound
- val newWidth = if (range.upperBound.isInstanceOf[IsKnown]) {
- KnownWidth(Utils.getUIntWidth(range.maxAdjusted.get).max(1)) // max(1) handles range"[0,0]"
- } else {
- UnknownWidth()
- }
-
- apply(newWidth)
- }
}