Implement LOG2

This is a bit funky: I don't have a clean way to compute log2 in the
way that Chisel does (or even at all!).