-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory_tb.v
66 lines (50 loc) · 1.18 KB
/
memory_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
`timescale 1ns / 100ps // time-unit = 1 ns, precision = 100 ps
module memory_tb;
reg [15:0] DATA_IN;
reg [11:0] ADDRESS;
reg WRITE_ENABLE;
reg CLOCK;
wire [15:0] DATA_OUT;
localparam delay = 500;
localparam period = 10;
memory MEM(CLOCK, WRITE_ENABLE, ADDRESS, DATA_IN, DATA_OUT);
initial begin
CLOCK = 0;
DATA_IN = 16'b0000000000000001;
ADDRESS = 12'b000000000000;
WRITE_ENABLE = 1'b0;
#delay
DATA_IN = 16'b0000000000000001;
ADDRESS = 12'b000000000001;
WRITE_ENABLE = 1'b0;
#delay
DATA_IN = 16'b0000000000000001;
ADDRESS = 12'b000000000010;
WRITE_ENABLE = 1'b0;
#delay
DATA_IN = 16'b0000000000000011;
ADDRESS = 12'b000000000010;
WRITE_ENABLE = 1'b0;
#delay
DATA_IN = 16'b0000000000000100;
ADDRESS = 12'b000000000010;
WRITE_ENABLE = 1'b0;
#delay
DATA_IN = 16'b0000000000000100;
ADDRESS = 12'b000000001111;
WRITE_ENABLE = 1'b0;
#delay
DATA_IN = 16'b0011110000000100;
ADDRESS = 12'b000000001111;
WRITE_ENABLE = 1'b1;
#delay
DATA_IN = 16'b0000000000000100;
ADDRESS = 12'b000000001111;
WRITE_ENABLE = 1'b0;
end
always
begin
#period
CLOCK = !CLOCK;
end
endmodule