blob: bad146b4f839e2a1a94f4f16a3ae8154c16d30ec (
plain) (
blame)
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
86
87
88
89
|
`timescale 1ns/1ps
module test_gpr_register;
reg clk;
reg reg_write_en;
reg [2:0]reg_write_dest;
reg [15:0]reg_write_data;
reg [2:0]reg_read_addr_1;
reg [15:0]reg_read_data_1;
reg [2:0]reg_read_addr_2;
reg [15:0]reg_read_data_2;
gpr_register gpr(
.clk(clk),
.reg_write_en(reg_write_en),
.reg_write_dest(reg_write_dest),
.reg_write_data(reg_write_data),
.reg_read_addr_1(reg_read_addr_1),
.reg_read_data_1(reg_read_data_1),
.reg_read_addr_2(reg_read_addr_2),
.reg_read_data_2(reg_read_data_2)
);
initial begin
$display("Start testing register");
$dumpfile("test_gpr_register.vcd");
$dumpvars(0,test_gpr_register);
clk=0;
reg_read_addr_1=0;
reg_read_addr_2=0;
reg_write_dest=0;
reg_write_en=0;
#10
clk=1;
reg_write_dest=1;
reg_write_data=16'hAA;
reg_write_en=1;
#10
clk=1;
#10
clk=0;
reg_write_dest=2;
reg_write_data=16'hBB;
reg_write_en=1;
#10
clk=1;
#10
clk=0;
reg_write_en=0;
reg_read_addr_1=0;
reg_read_addr_2=1;
//#10
//clk = 1;
//#10
//clk = 0;
#10
clk=1;
reg_read_addr_1=1;
reg_read_addr_2=2;
#10
clk = 0;
#10
clk = 1;
#10
clk = 0;
end
initial begin
$monitor("At time=%t",$time);
end
endmodule
|