-
Notifications
You must be signed in to change notification settings - Fork 0
/
dut.v
103 lines (83 loc) · 1.62 KB
/
dut.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
//
// Created by : Harris Zhu
// Filename : dut.v
// Author : Harris Zhu
// Created On : 2016-11-15 20:38
// Last Modified :
// Update Count : 2016-11-15 20:38
// Tags :
// Description :
// Conclusion :
//
//=======================================================================
module dut;
parameter DWIDTH0 = 32;
parameter DWIDTH1 = 16;
parameter DWIDTH2 = 64;
parameter AWIDTH0 = 10;
parameter AWIDTH1 = 14;
parameter AWIDTH2 = 16;
reg [AWIDTH0-1:0] addr0;
reg [AWIDTH1-1:0] addr1;
reg [AWIDTH2-1:0] addr2;
wire [DWIDTH0-1:0] dout0;
wire [DWIDTH1-1:0] dout1;
wire [DWIDTH2-1:0] dout2;
reg [DWIDTH0-1:0] din0;
reg [DWIDTH1-1:0] din1;
reg [DWIDTH2-1:0] din2;
wire clk0;
wire clk1;
wire clk2;
reg rstn=0;
reg ce0=1;
reg ce1=1;
reg ce2=1;
reg we0=0;
reg we1=0;
reg we2=0;
reg [31:0] cnt0=0;
reg [27:0] cnt1=0;
reg [15:0] cnt2=0;
dutmem0 #(DWIDTH0, AWIDTH0) u_mem0(clk0, rstn, ce0, we0, addr0, din0, dout0);
dutmem1 #(DWIDTH1, AWIDTH1) u_mem1(clk1, rstn, ce1, we1, addr1, din1, dout1);
dutmem2 #(DWIDTH2, AWIDTH2) u_mem2(clk2, rstn, ce2, we2, addr2, din2, dout2);
initial
begin
#10;
rstn=1;
end
always @(posedge clk0)
begin
cnt0 <= cnt0 + 1;
if(cnt0 % 17 == 0)
begin
we0 <= 1;
end else if(cnt0 % 33 == 0)
begin
we0 <= 0;
end
end
always @(posedge clk1)
begin
cnt1 <= cnt1 + 1;
if(cnt1 % 19 == 0)
begin
we1 <= 1;
end else if(cnt1 % 37 == 0)
begin
we1 <= 0;
end
end
always @(posedge clk2)
begin
cnt2 <= cnt2 + 1;
if(cnt2 % 23 == 0)
begin
we2 <= 1;
end else if(cnt2 % 47 == 0)
begin
we2 <= 0;
end
end
endmodule