OpenCores
URL https://opencores.org/ocsvn/srdydrdy_lib/srdydrdy_lib/trunk

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [env/] [verilog/] [bench_fifo_s.v] - Blame information for rev 15

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 ghutchis
`timescale 1ns/1ns
2
 
3
module bench_fifo_s;
4
 
5
  reg clk, reset;
6
 
7
  localparam width = 8;
8
 
9
  initial clk = 0;
10
  always #10 clk = ~clk;
11
 
12
  /*AUTOWIRE*/
13
  // Beginning of automatic wires (for undeclared instantiated-module outputs)
14
  wire [width-1:0]       chk_data;               // From fifo_s of sd_fifo_s.v
15
  wire                  chk_drdy;               // From chk of sd_seq_check.v
16
  wire                  chk_srdy;               // From fifo_s of sd_fifo_s.v
17
  wire [width-1:0]       gen_data;               // From gen of sd_seq_gen.v
18
  wire                  gen_drdy;               // From fifo_s of sd_fifo_s.v
19
  wire                  gen_srdy;               // From gen of sd_seq_gen.v
20
  // End of automatics
21
 
22
/* sd_seq_gen AUTO_TEMPLATE
23
 (
24
 .p_\(.*\)   (gen_\1[]),
25
 );
26
 */
27
  sd_seq_gen gen
28
    (/*AUTOINST*/
29
     // Outputs
30
     .p_srdy                            (gen_srdy),              // Templated
31
     .p_data                            (gen_data[width-1:0]),    // Templated
32
     // Inputs
33
     .clk                               (clk),
34
     .reset                             (reset),
35
     .p_drdy                            (gen_drdy));             // Templated
36
 
37
/* sd_seq_check AUTO_TEMPLATE
38
 (
39
 .c_\(.*\)   (chk_\1[]),
40
 );
41
 */
42
  sd_seq_check chk
43
    (/*AUTOINST*/
44
     // Outputs
45
     .c_drdy                            (chk_drdy),              // Templated
46
     // Inputs
47
     .clk                               (clk),
48
     .reset                             (reset),
49
     .c_srdy                            (chk_srdy),              // Templated
50
     .c_data                            (chk_data[width-1:0]));   // Templated
51
 
52
/* sd_fifo_s AUTO_TEMPLATE
53
 (
54
     .c_clk                             (clk),
55
     .c_reset                           (reset),
56
     .p_clk                             (clk),
57
     .p_reset                           (reset),
58
     .p_\(.*\)   (chk_\1[]),
59
     .c_\(.*\)   (gen_\1[]),
60
 );
61
 */
62
  sd_fifo_s #(8, 32, 1) fifo_s
63
    (/*AUTOINST*/
64
     // Outputs
65
     .c_drdy                            (gen_drdy),              // Templated
66
     .p_srdy                            (chk_srdy),              // Templated
67
     .p_data                            (chk_data[width-1:0]),    // Templated
68
     // Inputs
69
     .c_clk                             (clk),                   // Templated
70
     .c_reset                           (reset),                 // Templated
71
     .c_srdy                            (gen_srdy),              // Templated
72
     .c_data                            (gen_data[width-1:0]),    // Templated
73
     .p_clk                             (clk),                   // Templated
74
     .p_reset                           (reset),                 // Templated
75
     .p_drdy                            (chk_drdy));             // Templated
76
 
77
  initial
78
    begin
79
      $dumpfile("fifo_s.vcd");
80
      $dumpvars;
81
      reset = 1;
82
      #100;
83
      reset = 0;
84
 
85 14 ghutchis
      gen.rep_count = 1000;
86
 
87 3 ghutchis
      // burst normal data for 20 cycles
88
      repeat (20) @(posedge clk);
89
 
90
      gen.srdy_pat = 8'h5A;
91
      repeat (20) @(posedge clk);
92
 
93
      chk.drdy_pat = 8'hA5;
94
      repeat (40) @(posedge clk);
95
 
96
      // check FIFO overflow
97
      gen.srdy_pat = 8'hFD;
98
      repeat (100) @(posedge clk);
99
 
100
      // check FIFO underflow
101
      gen.srdy_pat = 8'h11;
102
      repeat (100) @(posedge clk);
103
 
104
      #5000;
105
      $finish;
106
    end
107
 
108
endmodule // bench_fifo_s
109
// Local Variables:
110
// verilog-library-directories:("." "../../rtl/verilog/buffers")
111
// End:

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.