-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathALUbase.sv
59 lines (51 loc) · 1.29 KB
/
ALUbase.sv
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Adrian Evaraldo
//
// Create Date: 10/03/2021 01:30:07 PM
// Design Name:
// Module Name: ALUbase
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
import ALU_pkg::*;
module ALUbase(
input logic [31 : 0] SrcA, SrcB,
input ALUop_t ALUControl,
output logic [31 : 0] ALUResult
);
always_comb begin
case (ALUControl[1 : 0])
2'b00: //ADD
begin
ALUResult = SrcA + SrcB;
end
2'b01: //SUB
begin
ALUResult = SrcA - SrcB;
end
2'b10: //AND
begin
ALUResult = SrcA & SrcB;
end
2'b11: //OR
begin
ALUResult = SrcA | SrcB;
end
default:
begin
ALUResult = '0;
end
endcase
end
endmodule