-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathALU_tb.v
81 lines (49 loc) · 1.39 KB
/
ALU_tb.v
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Zuhair Shaikh and Brant Lan Li
// ALU Testbench File
// ELEC374 - Digital Systems Engineering
// Department of Electrical and Computer Engineering
// Queen's University
`timescale 1ns/10ps
module ALU_tb;
reg clk;
reg [31:0] input_a;
reg [31:0] input_b;
reg [4:0] opcode;
wire [63:0] ALU_result;
ALU ALU_instance (input_a, input_b, opcode, ALU_result);
initial
begin
clk = 0;
forever #10 clk = ~ clk;
end
initial
begin
input_a <= 32'b0100;
input_b <= 32'b0010;
opcode <= 5'b00000; // check AND operation
# 10
opcode <= 5'b00001; // check OR operation
# 10
opcode <= 5'b00010; // check NOT operation
# 10
opcode <= 5'b00011; // check NEG operation
# 10
opcode <= 5'b00100; // check ADD operation
# 10
opcode <= 5'b00101; // check SUB operation
# 10
opcode <= 5'b00110; // check MUL operation
# 10
opcode <= 5'b00111; // check DIV operation
# 10
opcode <= 5'b01000; // check SHR operation
# 10
opcode <= 5'b01001; // check SHRA operation
# 10
opcode <= 5'b01010; // check SHL operation
# 10
opcode <= 5'b01011; // check ROR operation
# 10
opcode <= 5'b01100; // check ROL operation
end
endmodule