/*Write your code here*/
module univ_barrel8 (
input [7:0] x,
input [2:0] sh,
input [2:0] mode,
output reg [7:0] y
);
// mode encodings
always @* begin
case (mode)
1 : y = (x << sh);
2 : y = (x >> sh);
3 : y = $signed(x) >>> sh;
4 : y = ((x << sh) | (x >> (8 - sh)));
5 : y = ((x >> sh) | (x << (8 - sh)));
default: y = x;
endcase
end
endmodule