-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ALU.v
86 lines (62 loc) · 1.12 KB
/
test_ALU.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
82
83
84
85
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Assignment 7
//
//Group No.42
//Members: Seemant Guruprasad Achari 19CS10055
// Chappidi Yoga Satwik 19CS30013
//
// This is the testbench for the ALU
//
//////////////////////////////////////////////////////////////////////////////////
module test_ALU;
// Inputs
reg [31:0] a;
reg [31:0] b;
reg [4:0] sh_amt;
reg [2:0] op;
reg shift_src, clk;
// Outputs
wire [31:0] result;
wire neg;
wire zero;
wire carry;
// Instantiate the Unit Under Test (UUT)
ALU uut (
.result(result),
.neg_out(neg),
.zero_out(zero),
.carry_out(carry),
.a(a),
.b(b),
.sh_amt(sh_amt),
.shift_src(shift_src),
.clk(clk),
.op(op)
);
initial begin
// Initialize Inputs
a = -54;
b = 54;
sh_amt = 5;
op = 0;
shift_src = 1;
// Wait 100 ns for global reset to finish
#100;
op = 1;
#100;
op = 2;
#100;
op = 3;
#100;
op = 4;
#100;
op = 5;
#100;
op = 6;
#100;
op = 7;
// Add stimulus here
end
always #10 clk = ~clk;
endmodule