-
Notifications
You must be signed in to change notification settings - Fork 0
/
ALU_tb.v
67 lines (47 loc) · 824 Bytes
/
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
`timescale 1ns / 1ps
module ALU_tb;
// Inputs
reg [3:0] ALUCnt;
reg [31:0] input1;
reg [31:0] input2;
reg [4:0] Shamt;
// Outputs
wire [31:0] result;
wire Zero;
// Instantiate the Unit Under Test (UUT)
ALU uut (
.ALUCnt(ALUCnt),
.input1(input1),
.input2(input2),
.Shamt(Shamt),
.result(result),
.Zero(Zero)
);
initial begin
// Initialize Inputs
ALUCnt = 0;
input1 = 4;
input2 = 5;
Shamt = 2;
// Wait 100 ns for global reset to finish
#100;
ALUCnt = 0;
#100;
ALUCnt = 1;
#100;
ALUCnt = 2;
#100;
ALUCnt = 3;
#100;
Shamt = 4;
#100;
ALUCnt = 4;
#100;
ALUCnt = 5;
#100;
ALUCnt = 6;
#100;
ALUCnt =7;
// Add stimulus here
end
endmodule