OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [port_fifo/] [port_fifo_tb.v] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 peteralieb
//----- Testbench -----
2
 
3
// Timescale: one time unit = 1ns (e.g., delay specification of #42 means 42ns of time), and
4
// simulator resolution is 0.1 ns
5
`timescale 1ns / 100ps
6
 
7
module port_fifo_tb;
8
 
9
// Input stimulus:
10
reg     clk;
11
wire    out_clk;
12
reg     rst;
13
reg     wen, ren;
14
reg     [7:0]    in_data;
15
reg     in_sof;
16
reg     in_eof;
17
reg     in_src_rdy;
18
reg     out_dst_rdy;
19
reg     out_clk_en;
20
 
21
// Output connections:
22
wire    [7:0]    out_data;
23
wire    out_sof;
24
wire    out_eof;
25
wire    out_src_rdy;
26
wire    in_dst_rdy;
27
 
28
 
29
//Instantiate the DUT (device under test):
30
port_fifo DUT (
31
        // Inputs:
32
        .in_clk ( clk ),
33
        .out_clk ( out_clk ),
34
        .rst ( rst ),
35
        .in_data ( in_data ),   // Input
36
        .in_sof ( in_sof ),     // Input
37
        .in_eof ( in_eof ),     // Input
38
        .in_src_rdy ( in_src_rdy ),     // Input
39
        .out_dst_rdy ( out_dst_rdy ),   // Output
40
 
41
        // Outputs:
42
        .out_data ( out_data ), // Output
43
        .out_sof ( out_sof ),   // Output
44
        .out_eof ( out_eof ),   // Output
45
        .out_src_rdy ( out_src_rdy ),   // Output
46
        .in_dst_rdy ( in_dst_rdy )      // Input
47
);
48
 
49
        // Specify input stimulus:
50
 
51
initial begin
52
 
53
        // Initial values for input stimulus:
54
        clk = 1;
55
        rst = 1'b0;
56
        in_data = 8'b0;
57
        in_sof = 1'b0;
58
        in_eof = 1'b0;
59
        in_src_rdy = 1'b0;
60
        out_dst_rdy = 1'b0;
61
        out_clk_en = 0;
62
 
63
        //
64
        //--- INSERT YOUR INPUT STIMULUS DESCRIPTION HERE ---
65
        //
66
 
67
        @(posedge clk);
68
        rst = 1;
69
        out_clk_en = 1;
70
        @(posedge clk);
71
        @(posedge clk);
72
        @(posedge clk);
73
        @(posedge clk);
74
        out_clk_en = 0;
75
        rst = 0;
76
        @(posedge clk);
77
        in_sof = 1;
78
        in_data = 8'h01;
79
        @(posedge clk);
80
        in_src_rdy = 1;
81
        @(posedge clk);
82
        in_sof = 0;
83
        in_data = 8'h02;
84
        @(posedge clk);
85
        in_data = 8'h03;
86
        @(posedge clk);
87
        in_eof = 1;
88
        in_data = 4;
89
        @(posedge clk);
90
        in_src_rdy = 0;
91
        @(posedge clk);
92
        @(posedge clk);
93
        @(posedge clk);
94
        @(posedge clk);
95
        out_dst_rdy = 1;
96
        @(posedge clk);
97
        @(posedge clk);
98
        @(posedge clk);
99
        @(posedge clk);
100
        @(posedge clk);
101
        out_clk_en = 1;
102
        @(posedge clk);
103
        @(posedge clk);
104
        @(posedge clk);
105
        @(posedge clk);
106
        @(posedge clk);
107
end
108
 
109
        // Template for master clock. Uncomment and modify signal name as needed.
110
        // Remember to set the initial value of 'Clock' in the 'initial' block above.
111
always #10 clk = ~clk;
112
 
113
assign out_clk = clk & out_clk_en;
114
 
115
 
116
endmodule

powered by: WebSVN 2.1.0

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