-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb.v
114 lines (99 loc) · 1.76 KB
/
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
module counter0 (
input wire clkin
, input wire rst
, output [31:0] pc
);
logic [31:0] f_pc ;
always @(posedge clkin or negedge rst) begin
if (rst) begin
f_pc <= 0;
end else begin
f_pc <= f_pc + 1'b1;
end
end
assign pc = f_pc;
endmodule
module counter1 #(
parameter X=0
)(
input wire clkin
, input wire rst
, output [31:0] pc
);
generate
if (X == 0) begin: g_x01
counter0 i_counter0 (
.clkin (clkin)
,.rst(rst)
,.pc (pc)
);
end else begin: g_x02
counter0 i_counter0 (
.clkin (clkin)
,.rst(rst)
,.pc (pc)
);
end
endgenerate
endmodule
// module counter2 (
// input wire clkin
// , input wire rst
// , output [31:0] pc
// );
//
//
// counter1 i_counter1 (
// .clkin (clkin)
// ,.rst(rst)
// ,.pc (pc)
// );
//
//
// endmodule
//
// module counter3 (
// input wire clkin
// , input wire rst
// , output [31:0] pc
// );
//
//
// counter2 i_counter2 (
// .clkin (clkin)
// ,.rst(rst)
// ,.pc (pc)
// );
//
//
// endmodule
module tb (
input wire clkin
, input wire rst
);
logic [31:0] w_pc0 ;
logic [31:0] w_pc1 ;
logic [31:0] w_pc2 ;
logic [31:0] w_pc3 ;
counter0 i_counter0 (
.clkin (clkin)
,.rst(rst)
,.pc (w_pc0)
);
counter1 i_counter1 (
.clkin (clkin)
,.rst(rst)
,.pc (w_pc1)
);
// counter2 i_counter2 (
// .clkin (clkin)
// ,.rst(rst)
// ,.pc (w_pc2)
// );
//
// counter3 i_counter3 (
// .clkin (clkin)
// ,.rst(rst)
// ,.pc (w_pc3)
// );
endmodule