~ruther/verilog-riscv-semestral-project

ref: 79c7be5c1c8ae2aea07f48d32abca650d24e8045 verilog-riscv-semestral-project/testbench/tb_ram.sv -rw-r--r-- 818 bytes
79c7be5c — Rutherther chore: remove unnecessary executable flags 1 year, 3 months ago
                                                                                
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
import cpu_types::*;

module tb_ram();
  reg clk;

  reg [31:0] a;

  wire [31:0] rd;

  reg [3:0]  write_byte_enable;
  reg         we;
  reg [31:0]  wd;

  reg         dump;


  ram uut(
    .clk(clk),
    .a(a),
    .rd(rd),
    .we(we),
    .wd(wd),
    .dump(dump),
    .write_byte_enable(write_byte_enable)
  );

  initial begin
    clk = 0;
    forever #5 clk = ~clk;
  end

  initial begin
    $dumpfile("waves/tb_ram.vcd");
    $dumpvars;

    write_byte_enable = 4'b1111;


    #10
    a = 32'd103;
    we = 1;
    wd = 32'h5;

    #10
    a = 32'd107;
    we = 1;
    wd = 32'h1;

    #10
    wd = 32'h0;
    we = 0;
    a = 32'd103;

    #10
    we = 0;
    a = 32'd107;

    #10
    we = 1;
    write_byte_enable = 4'b1100;

    wd = 32'hFFFFFFFF;

    #10
    we = 0;

    #10 $finish;
  end


endmodule
Do not follow this link