package std
- Alphabetic
- Public
- Protected
Value Members
- object BarrelShifter
A Barrel Shifter implementation for Vec type.
A Barrel Shifter implementation for Vec type.
val input = 0xAABBCCDD.U(32.W) val bytes = VecInit(input.asBools.grouped(8).map(VecInit(_).asUInt).toSeq) val shamt = 1.U(2.W) val output = BarrelShifter.leftRotate(bytes, shamt).asUInt // big endian // output = 0xDDAABBCC.U(32.W) // The depth of Mux is 2, whereas originally // the depth of Mux is log(32) = 5 val output = BarrelShifter.leftRotate(bytes, shamt, 2).asUInt // depth is 1 now
Example: