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

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [port_clkcntl/] [port_clkcntl_tb.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 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_clkcntl_tb;
8
 
9
// Input stimulus:
10
reg     clk;
11
reg     rst;
12
reg     en;
13
reg     [7:0]    in_data;
14
reg     in_sof;
15
reg     in_eof;
16
reg     in_src_rdy;
17
reg     out_dst_rdy;
18
reg     usr_clk_in;
19
 
20
// Output connections:
21
wire    [7:0]    out_data;
22
wire    out_sof;
23
wire    out_eof;
24
wire    out_src_rdy;
25
wire    in_dst_rdy;
26
wire    usr_clk_out;
27
 
28
 
29
//Instantiate the DUT (device under test):
30
port_clkcntl DUT (
31
        // Inputs:
32
        .clk ( clk ),
33
        .rst ( rst ),
34
        .en ( en ),
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
        .usr_clk_in (usr_clk_in),
41
 
42
        // Outputs:
43
        .out_data ( out_data ), // Output
44
        .out_sof ( out_sof ),   // Output
45
        .out_eof ( out_eof ),   // Output
46
        .out_src_rdy ( out_src_rdy ),   // Output
47
        .in_dst_rdy ( in_dst_rdy ),     // Input
48
        .usr_clk_out ( usr_clk_out )
49
);
50
 
51
        // Specify input stimulus:
52
 
53
initial begin
54
 
55
        // Initial values for input stimulus:
56
        clk = 1;
57
        rst = 1'b0;
58
        en = 1'b0;
59
        in_data = 8'b0;
60
        in_sof = 1'b0;
61
        in_eof = 1'b0;
62
        in_src_rdy = 1'b1;
63
        out_dst_rdy = 1'b0;
64
        usr_clk_in = 1'b0;
65
 
66
        //
67
        //--- INSERT YOUR INPUT STIMULUS DESCRIPTION HERE ---
68
        //
69
 
70
        @(posedge clk);
71
        rst = 1;
72
        @(posedge clk);
73
        rst = 0;
74
        @(posedge clk);
75
        en = 1;
76
        in_sof = 1;
77
        in_data = 8'h00;
78
        @(posedge clk);
79
        en = 1;
80
        @(posedge clk);
81
        in_sof = 0;
82
        @(posedge clk);
83
        @(posedge clk);
84
        in_data = 10;
85
        @(posedge clk);
86
        in_eof = 1;
87
        in_data = 8'h01;
88
        @(posedge clk);
89
        en = 0;
90
        in_src_rdy = 0;
91
        @(posedge clk);
92
        @(posedge clk);
93
        @(posedge clk);
94
        @(posedge clk);
95
        @(posedge clk);
96
        @(posedge clk);
97
        @(posedge clk);
98
        @(posedge clk);
99
        @(posedge clk);
100
        @(posedge clk);
101
        @(posedge clk);
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
always #10 usr_clk_in = ~usr_clk_in;
113
 
114
 
115
endmodule

powered by: WebSVN 2.1.0

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