aboutsummaryrefslogtreecommitdiff
path: root/src/shift_unit.v
blob: ae1d6650e7ab2539b8d5d8c56061a63b8eded216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module shift_unit (
  input signed [31:0] a,
  input  [4:0] b,

  input [1:0] op,
  
  output reg [31:0] result
);

always @ (*) begin
  case (op)
    2'b00: result <= a << b;   // SLL
    2'b01: result <= a >> b;   // SRL
    2'b11: result <= a >>> b;  // SRA
    default: result <= 32'b0;
  endcase
end

endmodule