summaryrefslogtreecommitdiff
path: root/datamem/v0.1/test_data_memory.v
blob: e0633c11ee73564c10a6b1f06a28337a2e6d7f54 (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
`timescale 1ns/1ps

module test_data_memory;

reg clk;
reg [15:0]mem_access_addr;
reg [15:0]mem_write_data;
reg mem_write_en;
reg mem_read;
reg [15:0]mem_read_data;

data_memory uut (
    .clk(clk),
    .mem_access_addr(mem_access_addr),
    .mem_write_data(mem_write_data),
    .mem_write_en(mem_write_en),
    .mem_read(mem_read),
    .mem_read_data(mem_read_data)
);

initial begin 
    $display("Start testing data memory");
    $dumpfile("test_data_memory.vcd");
    $dumpvars(0,test_data_memory);

    clk=0;
    mem_write_en = 0;
    mem_access_addr = 0;
    mem_read = 0;

    #10 clk=0;
    mem_write_en = 0;
    mem_access_addr = 0;
    mem_read = 0;

    #10 clk=1;
    mem_access_addr = 1;
    mem_read = 1;

    #10 clk=0;
    mem_access_addr = 2;
    mem_read = 1;

    #10 clk=1;
     mem_access_addr = 3;

    #10 clk=0;
    mem_access_addr = 4;

    #10 clk=1;
    mem_access_addr = 4;
    mem_read=0;

    #10 clk=0;
    mem_write_en=1;
    mem_write_data=8'hAA;

    #10 clk=1;
    
    mem_read=0;

    #10 clk=0;
    mem_write_en=0;
    mem_read=1;


    #10 clk=1;
end


initial begin
    $monitor("At time=%t",$time);
end

endmodule