How to calculate register size in bits N
import chisel3.util.log2Ceil
val Nsize = log2Ceil(N)
parameter NSIZE = $clog2(N);
use IEEE.math_real."ceil";
use IEEE.math_real."log2";
Nsize := integer(ceil(log2(real(N))));
Python: math.ceil(math.log(N+1, 2))
import math
Nsize = math.ceil(math.log(N, 2))
CλaSH: ?
SystemC/C++: ceil(log2())
#include <math.h> /* ceil and log */
Nsize = ceil(log2(N));