summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util
diff options
context:
space:
mode:
authorAndrew Waterman2017-02-24 00:34:04 -0800
committerJack Koenig2017-03-08 11:27:04 -0600
commit09e95c484e145e2a1b2f0a1aacf549c7354a1eca (patch)
tree8154279b25708c4faa91444db88a70763b966cd6 /src/main/scala/chisel3/util
parent5f846792824cdb467691d929d64de117bb3cffcb (diff)
Move log2Up and log2Down to compatibility wrapper
Diffstat (limited to 'src/main/scala/chisel3/util')
-rw-r--r--src/main/scala/chisel3/util/Math.scala11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/scala/chisel3/util/Math.scala b/src/main/scala/chisel3/util/Math.scala
index 73665f0f..cf75e756 100644
--- a/src/main/scala/chisel3/util/Math.scala
+++ b/src/main/scala/chisel3/util/Math.scala
@@ -8,12 +8,9 @@ package chisel3.util
import chisel3._
/** Compute the log2 rounded up with min value of 1 */
+@deprecated("Use log2Ceil instead", "chisel3")
object log2Up {
- def apply(in: BigInt): Int = {
- require(in >= 0)
- 1 max (in-1).bitLength
- }
- def apply(in: Int): Int = apply(BigInt(in))
+ def apply(in: BigInt): Int = Chisel.log2Up(in)
}
/** Compute the log2 rounded up */
@@ -26,9 +23,9 @@ object log2Ceil {
}
/** Compute the log2 rounded down with min value of 1 */
+@deprecated("Use log2Floor instead", "chisel3")
object log2Down {
- def apply(in: BigInt): Int = log2Up(in) - (if (isPow2(in)) 0 else 1)
- def apply(in: Int): Int = apply(BigInt(in))
+ def apply(in: BigInt): Int = Chisel.log2Down(in)
}
/** Compute the log2 rounded down */