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


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