summaryrefslogtreecommitdiff
path: root/src/main/scala/Chisel/util/Math.scala
diff options
context:
space:
mode:
authorJim Lawson2016-07-19 13:43:48 -0700
committerJim Lawson2016-07-19 13:43:48 -0700
commitb27f29902d9f1d886e8edf1fc5e960cf9a634184 (patch)
treec6f3e27e46e5ed9c3cc62f2c368c766cdded74c6 /src/main/scala/Chisel/util/Math.scala
parent083610b2faa456dfccc4365dd115565d36e522fa (diff)
parent12810b5efe6a8f872fbc1c63cdfb835ca354624f (diff)
Merge branch 'sdtwigg_rebase_renamechisel3' into sdtwigg_wrap_renamechisel3
Diffstat (limited to 'src/main/scala/Chisel/util/Math.scala')
-rw-r--r--src/main/scala/Chisel/util/Math.scala42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/main/scala/Chisel/util/Math.scala b/src/main/scala/Chisel/util/Math.scala
deleted file mode 100644
index 5f8212d8..00000000
--- a/src/main/scala/Chisel/util/Math.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-// See LICENSE for license details.
-
-/** Scala-land math helper functions, like logs.
- */
-
-package Chisel
-
-/** Compute the log2 rounded up with min value of 1 */
-object log2Up {
- def apply(in: BigInt): Int = {
- require(in >= 0)
- 1 max (in-1).bitLength
- }
- def apply(in: Int): Int = apply(BigInt(in))
-}
-
-/** Compute the log2 rounded up */
-object log2Ceil {
- def apply(in: BigInt): Int = {
- require(in > 0)
- (in-1).bitLength
- }
- def apply(in: Int): Int = apply(BigInt(in))
-}
-
-/** Compute the log2 rounded down with min value of 1 */
-object log2Down {
- def apply(in: BigInt): Int = log2Up(in) - (if (isPow2(in)) 0 else 1)
- def apply(in: Int): Int = apply(BigInt(in))
-}
-
-/** Compute the log2 rounded down */
-object log2Floor {
- def apply(in: BigInt): Int = log2Ceil(in) - (if (isPow2(in)) 0 else 1)
- def apply(in: Int): Int = apply(BigInt(in))
-}
-
-/** Check if an Integer is a power of 2 */
-object isPow2 {
- def apply(in: BigInt): Boolean = in > 0 && ((in & (in-1)) == 0)
- def apply(in: Int): Boolean = apply(BigInt(in))
-}