-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb_alu.sv
44 lines (37 loc) · 1.02 KB
/
tb_alu.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
/* ***********************************************
* COSE222 Lab #1
*
* Module: testbench including clock and reset_b signals (tb_.sv)
* -
*
* Author: Gunjae Koo (gunjaekoo@korea.ac.kr)
*
**************************************************
*/
`timescale 1ns/1ps
`define CLK_T 10
module tb_alu ();
logic clk, reset_b;
logic zero;
logic [3:0] alu_control;
logic [63:0] in1, in2, result;
initial clk = 1'b1;
always #(`CLK_T/2) clk = ~clk;
initial begin
clk = 1'b1;
reset_b = 1'b0;
repeat (2) @ (posedge clk);
#(1) reset_b = 1'b1;
end
// change needed
initial begin
in1 = 64'hffffffffffffffff; in2 = 64'h0000000000000000;
#(3) repeat (100) begin
#(5) alu_control = 4'b0000;
#(5) alu_control = 4'b0001;
#(5) alu_control = 4'b0010;
#(5) alu_control = 4'b0110; in1 -= 500; in2 += 300;
end
end
alu dut (in1, in2, alu_control, result, zero);
endmodule