It would be nice to have something similar to sizeof() from C. Needless to mention I don't expect it to be synthesizeable.
sizeof()
$bits(variable) is what you want.
$bits(variable)