log2Up

chisel3.util.log2Up
object log2Up

Compute the log2 of a Scala integer, rounded up, with min value of 1. 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 log2Up(n + 1). with the minimum value preventing the creation of currently-unsupported zero-width wires.

Note: prefer to use log2Ceil when in is known to be > 1 (where log2Ceil(in) > 0). This will be deprecated when zero-width wires is supported.

Attributes

Example
log2Up(1)  // returns 1
log2Up(2)  // returns 1
log2Up(3)  // returns 2
log2Up(4)  // returns 2
Source
Math.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
log2Up.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