summaryrefslogtreecommitdiff
path: root/lab_2/SRC/duv.sv
blob: 0829654e13950c9f6c33d7c316fdea7dc5048a42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module duv (
input logic clk,
input logic op_start,
input logic  [1:0] operation,
input  logic [7:0] operand_a,
input  logic [7:0] operand_b,
output logic [15:0] result
);

logic [15:0] result_tmp;

always_ff @(posedge clk) 
begin
if( op_start == 1'b1)
begin
case (operation)
      0:             result_tmp = operand_a + operand_b;
      1:             result_tmp = operand_a * operand_b;
      2:             result_tmp = operand_a | operand_b;
      3:             result_tmp = operand_a & operand_b;
    endcase
  end

	result <= result_tmp;
end

endmodule : duv