log2Ceil

chisel3.util.log2Ceil
object log2Ceil

Compute the log2 of a Scala integer, rounded up. Useful for getting the number of bits needed to represent some number of states (in - 1). To get the number of bits needed to represent some number n, use log2Ceil(n + 1).

Note: can return zero, and should not be used in cases where it may generate unsupported zero-width wires.

Attributes

Example
log2Ceil(1)  // returns 0
log2Ceil(2)  // returns 1
log2Ceil(3)  // returns 2
log2Ceil(4)  // returns 2
Source
Math.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
log2Ceil.type

Members list

Value members

Concrete methods

def apply(in: BigInt): Int

Attributes

Source
Math.scala
def apply(in: Int): Int

Attributes

Source
Math.scala