www.pudn.com > x86.rar > shift_32_Logical.v, change:2007-12-05,size:5318b


module shift_32_Logical(shiftOut, shiftIn, Count, direction); 
 
input [31:0] shiftIn; 
input [63:0] Count; 
input direction;//  shiftBitIn; 
 
output [31:0]shiftOut; 
 
reg [31:0] shiftOut; 
 
 
always@(shiftIn or Count or direction) 
 begin 
  
  case(Count) 
   64'd1: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[30:0], 1'b0}; 
      1: shiftOut = {1'b0, shiftIn[31:1]}; 
     endcase 
    end 
    
   64'd2: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[29:0], 2'd0}; 
      1: shiftOut = {2'b0, shiftIn[31:2]}; 
     endcase 
    end 
 
   64'd3: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[28:0], 3'd0}; 
      1: shiftOut = {3'b0, shiftIn[31:3]}; 
     endcase 
    end 
 
   64'd4: 
    begin 
      case(direction) 
      0: shiftOut = {shiftIn[27:0], 4'b0000}; 
      1: shiftOut = {4'b0000, shiftIn[31:4]}; 
     endcase 
    end 
 
   64'd5: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[26:0], 5'd0}; 
      1: shiftOut = {5'd0, shiftIn[31:5]}; 
     endcase 
    end 
 
   64'd6: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[25:0], 6'd0}; 
      1: shiftOut = {6'd0, shiftIn[31:6]}; 
     endcase 
    end 
 
 
   64'd7: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[24:0], 7'd0}; 
      1: shiftOut = {7'd0, shiftIn[31:7]}; 
     endcase 
    end 
 
   64'd8: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[23:0], 8'd0}; 
      1: shiftOut = {8'd0, shiftIn[31:8]}; 
     endcase 
    end 
 
 
 
   64'd9: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[22:0], 9'd0}; 
      1: shiftOut = {9'd0, shiftIn[31:9]}; 
     endcase 
    end 
 
   64'd10: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[21:0], 10'd0}; 
      1: shiftOut = {10'd0, shiftIn[31:10]}; 
     endcase 
    end 
 
 
   64'd11: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[20:0], 11'd0}; 
      1: shiftOut = {11'd0, shiftIn[31:11]}; 
     endcase 
    end 
 
   64'd12: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[19:0], 12'd0}; 
      1: shiftOut = {12'd0, shiftIn[31:12]}; 
     endcase 
    end 
 
 
   64'd13: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[18:0], 13'd0}; 
      1: shiftOut = {13'd0, shiftIn[31:13]}; 
     endcase 
    end 
 
   64'd14: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[17:0], 14'd0}; 
      1: shiftOut = {14'd0, shiftIn[31:14]}; 
     endcase 
    end 
 
   64'd15: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[16:0], 15'd0}; 
      1: shiftOut = {15'd0, shiftIn[31:15]}; 
     endcase 
    end 
 
 
   64'd16: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[15:0], 16'd0}; 
      1: shiftOut = {16'd0, shiftIn[31:16]}; 
     endcase 
    end 
 
 
 
   64'd17: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[14:0], 17'd0}; 
      1: shiftOut = {17'd0, shiftIn[31:17]}; 
     endcase 
    end 
 
 
 
   64'd18: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[13:0], 18'd0}; 
      1: shiftOut = {18'd0, shiftIn[31:18]}; 
     endcase 
    end 
 
 
   64'd19: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[12:0], 19'd0}; 
      1: shiftOut = {19'd0, shiftIn[31:19]}; 
     endcase 
    end 
 
 
   64'd20: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[11:0], 20'd0}; 
      1: shiftOut = {20'd0, shiftIn[31:20]}; 
     endcase 
    end 
 
 
   64'd21: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[10:0], 21'd0}; 
      1: shiftOut = {21'd0, shiftIn[31:21]}; 
     endcase 
    end 
 
 
   64'd22: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[9:0], 22'd0}; 
      1: shiftOut = {22'd0, shiftIn[31:22]}; 
     endcase 
    end 
 
   64'd23: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[8:0], 23'd0}; 
      1: shiftOut = {23'd0, shiftIn[31:23]}; 
     endcase 
    end 
 
   64'd24: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[7:0], 24'd0}; 
      1: shiftOut = {24'd0, shiftIn[31:24]}; 
     endcase 
    end 
 
   64'd25: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[6:0], 25'd0}; 
      1: shiftOut = {25'd0, shiftIn[31:25]}; 
     endcase 
    end 
 
   64'd26: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[5:0], 26'd0}; 
      1: shiftOut = {26'd0, shiftIn[31:26]}; 
     endcase 
    end 
 
   64'd27: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[4:0], 27'd0}; 
      1: shiftOut = {27'd0, shiftIn[31:27]}; 
     endcase 
    end 
 
   64'd28: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[3:0], 28'd0}; 
      1: shiftOut = {28'd0, shiftIn[31:28]}; 
     endcase 
    end 
 
   64'd29: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[2:0], 29'd0}; 
      1: shiftOut = {29'd0, shiftIn[31:29]}; 
     endcase 
    end 
 
   64'd30: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[1:0], 30'd0}; 
      1: shiftOut = {30'd0, shiftIn[31:30]}; 
     endcase 
    end 
 
   64'd31: 
    begin 
     case(direction) 
      0: shiftOut = {shiftIn[0], 31'd0}; 
      1: shiftOut = {31'd0, shiftIn[31]}; 
     endcase 
    end 
 
 
   default: 
        shiftOut = 32'd0; 
  endcase 
  
end 
 
 
endmodule