How do you plan to solve it?
/*Write your code here*/
module univ_barrel8(
input [7:0]x,
input [2:0]mode,sh,
output reg [7:0]y
);
integer i;
reg[7:0]temp,temp1;
//assign temp = x;
always@(*)begin
case(mode)
3'b000 : y = x;
3'b001 : y = x << sh;
3'b010 : y = x >> sh;
3'b011 : begin
temp = x;
for(i=0;i<sh;i=i+1)begin
temp = {temp[7],temp[7:1]};
end
y = temp;
end
3'b100 : begin
temp = x;
for(i=0;i < sh;i = i +1)
temp = {temp[6:0],temp[7]};
y = temp;
end
3'b101 :begin
temp = x;
for(i=0; i <sh;i=i+1)
temp = {temp[0],temp[7:1]};
y = temp;
end
3'b110,3'b111 : y = x;
default : y = x;
endcase
end
endmodule