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

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [port_register/] [port_register_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_register_tb;
8
 
9
// Input stimulus:
10
reg     clk;
11
reg     rst;
12
reg     wen, ren;
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
 
19
// Output connections:
20
wire    [7:0]    out_data;
21
wire    out_sof;
22
wire    out_eof;
23
wire    out_src_rdy;
24
wire    in_dst_rdy;
25
 
26
 
27
//Instantiate the DUT (device under test):
28
port_register DUT (
29
        // Inputs:
30
        .clk ( clk ),
31
        .rst ( rst ),
32
        .wen ( wen ),
33
        .ren ( ren ),
34
        .in_data ( in_data ),   // Input
35
        .in_sof ( in_sof ),     // Input
36
        .in_eof ( in_eof ),     // Input
37
        .in_src_rdy ( in_src_rdy ),     // Input
38
        .out_dst_rdy ( out_dst_rdy ),   // Output
39
 
40
        // Outputs:
41
        .out_data ( out_data ), // Output
42
        .out_sof ( out_sof ),   // Output
43
        .out_eof ( out_eof ),   // Output
44
        .out_src_rdy ( out_src_rdy ),   // Output
45
        .in_dst_rdy ( in_dst_rdy )      // Input
46
);
47
 
48
        // Specify input stimulus:
49
 
50
initial begin
51
 
52
        // Initial values for input stimulus:
53
        clk = 1;
54
        rst = 1'b0;
55
        wen = 1'b0;
56
        ren = 1'b0;
57
        in_data = 8'b0;
58
        in_sof = 1'b0;
59
        in_eof = 1'b0;
60
        in_src_rdy = 1'b1;
61
        out_dst_rdy = 1'b0;
62
 
63
        //
64
        //--- INSERT YOUR INPUT STIMULUS DESCRIPTION HERE ---
65
        //
66
 
67
        @(posedge clk);
68
        rst = 1;
69
        @(posedge clk);
70
        rst = 0;
71
        @(posedge clk);
72
        in_sof = 1;
73
        in_data = 8'h01;
74
        @(posedge clk);
75
        wen = 1;
76
        @(posedge clk);
77
        in_sof = 0;
78
        in_data = 8'h02;
79
        @(posedge clk);
80
        in_data = 8'h03;
81
        @(posedge clk);
82
        in_eof = 1;
83
        in_data = 4;
84
        @(posedge clk);
85
        wen = 0;
86
        @(posedge clk);
87
        ren = 1;
88
        out_dst_rdy = 1;
89
        @(posedge clk);
90
        @(posedge clk);
91
        @(posedge clk);
92
        @(posedge clk);
93
        @(posedge clk);
94
end
95
 
96
        // Template for master clock. Uncomment and modify signal name as needed.
97
        // Remember to set the initial value of 'Clock' in the 'initial' block above.
98
always #10 clk = ~clk;
99
 
100
 
101
endmodule

powered by: WebSVN 2.1.0

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